-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos-rebuild: add edit command #56241
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for doing this
if [ "$action" = edit ]; then | ||
NIXOS_CONFIG=${NIXOS_CONFIG:-$(nix-instantiate --eval --strict -E '<nixos-config>')} | ||
exec "${EDITOR:-nano}" "$NIXOS_CONFIG" | ||
exit 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm no bash guru, but I thought exec would relinquish all control, so this line won't ever be executed anyways (and won't be needed), or does it serve any purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen this pattern in multiple languages. I'm not sure if there is some weird case that this actually handles or if it's just for clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this line won't ever be executed anyways
If the exec
call itself fails for some reason (e.g. an EDITOR that is not available), the script would continue and the exit 1
forces an exit. So in general, this makes sense. But in this particular case it's not necessary because set -e
at the beginning forces global exit-on-error anyway. But it doesn't hurt either 😄
764bbf5
to
49c4d61
Compare
Oh, this should really have a release note though |
I'll make another pr for the changelog and docs. |
Don't some flags (e.g. |
Motivation for this change
Inspired by LnL7/nix-darwin#94.
/cc @zimbatm
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)