1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00

home-manager: fix option subcommand

- calls nix-instatiate instead of nixos-option (using nix-option's underlying nix script).
- loops over options to display since nixos-option can only process a single option.
- passes through the --recursive flag from nixos-option. and includes --help and man page for the flag.

details:

nixos-option was changed from a C++ command to a shell script that feeds a nix script (with arguments) to nix-instatiate. in the process, the --config_expr and --options_expr we once passed to nixos-option were removed.

without changing the nixos-option shell script, we have no may to override the arguments to the nixos-option nix script.

luckily, we can use our modulesExpr as a direct argument to the new nixos-option nix script.

unluckily, the nix script does not accept multiple options per instantiation. so we are also looping through the given options ourselves and feeding them each to nixos-option's nix script.

the nixos-option shell and nix scripts are in different places in the nix store, so we have to search the store for the nix script given the location of the shell script.

also, the nixos-option nix script wants a 'recursive' flag, so we now honor that flag for the home-manager option subcommand.
This commit is contained in:
bruce oberg 2025-09-29 16:00:20 -07:00 committed by Austin Horstman
parent c93684cd87
commit 64c49b1aa5
2 changed files with 60 additions and 9 deletions

View file

@ -24,7 +24,7 @@
.Cm | generations
.Cm | help
.Cm | news
.Cm | option Ar option.name
.Cm | option Oo Fl -recursive Oc Ar option.name
.Cm | packages
.Cm | remove-generations Ar ID \&...
.Cm | switch
@ -138,10 +138,14 @@ Show news entries in a pager.
.RE
.PP
.It Cm option Ar option.name
.It Cm option Oo Fl -recursive Oc Ar option.name
.RS 4
Inspect the given option name in the home configuration, like
\fBnixos-option\fR(8)\&.
.sp
If the
.Fl -recursive
option is given, print all the values at or below the option name recursively\&.
.RE
.Pp