Files
lix/doc/manual/rl-next/extend-cli.md
T
Raito Bezarius 5f50741ce9 feat: add support for external lix- prefixed commands in the CLI
This feature allows calling external binaries starting with `lix-` as
subcommands directly within the `lix` CLI, similar to how Git handles
external commands.

For example, a binary named `lix-example` can now be invoked using `lix
example`.

This change opens up the possibility for broader community-driven
extensions of the Lix CLI, offering flexibility that Flakes has somewhat
restricted by centralizing certain features around its own model of
dependency management.

By enabling users to introduce custom subcommands, we encourage
experimentation and diverse workflows, addressing the needs of those who
seek more modular, feature-rich approaches to package management and
system configuration beyond what Flakes currently offers [1] [2] [3].

This adds `lix` as a new binary to be able to use this feature.

[1]: https://github.com/nmattia/niv
[2]: https://github.com/andir/npins
[3]: https://github.com/nikstur/lon

Change-Id: Ic6344424a6a46fc9fb30432f00e21c3509659f8a
Signed-off-by: Raito Bezarius <raito@lix.systems>
2025-02-23 15:24:28 +01:00

1.4 KiB

synopsis, cls, category, credits
synopsis cls category credits
`lix foo` now invokes `lix-foo` from PATH
2119
Features raito

Lix introduces the ability to extend the Nix command line by adding custom binaries to the PATH, similar to how Git integrates with other tools. This feature allows developers and end users to enhance their workflow by integrating additional functionalities directly into the Nix CLI.

Examples

For example, a user can create a custom deployment tool, lix-deploy-tool, and place it in their PATH. This allows them to execute lix deploy-tool directly from the command line, streamlining the process of deploying applications without needing to switch contexts or use separate commands.

Limitations

For now, autocompletion is supported to discover new custom commands, but the documentation will not render them. Argument autocompletion of the custom command is not supported either.

This is also locked behind a new experimental feature called lix-custom-sub-commands to enable developing all the required features.

Only the top-level lix command can be extended, this is an artificial limitation for the time being until we flesh out this feature.

Outline

In the future, this feature may pave the way for moving the Flake subcommand line to its own standalone binary, allowing for a more focused approach to managing Nix Flakes while letting the community explore alternatives to dependency management.