nixos-rebuild: make 'edit' work with directories
$NIXOS_CONFIG can be set to a directory, in which case the file used is $NIXOS_CONFIG/default.nix. This updates 'nixos-rebuild edit' to handle that case correctly.
This commit is contained in:
parent
d1020bcb2e
commit
be193a2057
|
@ -288,6 +288,9 @@ fi
|
|||
if [ "$action" = edit ]; then
|
||||
if [[ -z $flake ]]; then
|
||||
NIXOS_CONFIG=${NIXOS_CONFIG:-$(nix-instantiate --find-file nixos-config)}
|
||||
if [[ -d $NIXOS_CONFIG ]]; then
|
||||
NIXOS_CONFIG=$NIXOS_CONFIG/default.nix
|
||||
fi
|
||||
exec "${EDITOR:-nano}" "$NIXOS_CONFIG"
|
||||
else
|
||||
exec nix edit "${lockFlags[@]}" -- "$flake#$flakeAttr"
|
||||
|
|
Loading…
Reference in a new issue