From be193a20572a72a15ffb569aba8eb56fe881c842 Mon Sep 17 00:00:00 2001 From: V Date: Sat, 29 Aug 2020 09:54:02 +0200 Subject: [PATCH] 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. --- nixos/modules/installer/tools/nixos-rebuild.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh index 437199bae1d..e79cc5e24fb 100644 --- a/nixos/modules/installer/tools/nixos-rebuild.sh +++ b/nixos/modules/installer/tools/nixos-rebuild.sh @@ -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"