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-generate-config: add system.copySystemConfiguration = true;
#24707
nixos-generate-config: add system.copySystemConfiguration = true;
#24707
Conversation
This adds the above line to `nixos-generate-config.pl` and explains its effect. This is added as an initial method for backing up `configuration.nix` which is useful for both novice users (which do not split-up the file as quickly) and for advanced users (before they have configured backups). Added because of github PR #16922 and [noobs](http://lists.science.uu.nl/pipermail/nix-dev/2017-April/023379.html)
@awesomefireduck, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @aszlig and @wkennington to be potential reviewers. |
@awesomefireduck: You could run the installer VM tests, like this (while in the top-level dir of the $ nix-build nixos/tests/installer.nix It would probably also make sense to add a test case to check whether the |
The tests ran successfully, I think.
Is there any more output I need to look at? |
Well, we can do something like this. If so, I'd personally prefer if the comment was less verbose, e.g. two lines – I see no use in copying too much information in there when people can easily find it in the manual. Also, we might instead consider something like the line suggested on ML: |
The option by @ben0x539 ( |
I was going through older PRs and this one stood out. This seems like a good idea and only a small addition 👍 Any idea how could you would alias |
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'd like to move this PR forward and merge it soon, this is a very reasonable change, and very useful even if copySystemConfiguration
only copies configuration.nix
.
# It can be found in every profile in /nix/var/nix/profiles/ , | ||
# and the currently used one at /run/current-system/ . | ||
# Note that this only copies configuration.nix, | ||
# and not any included files like hardware-configuration.nix. |
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 suggest a message like this instead:
# Guard against accidental deletion of configuration.nix,
# allowing recovery from /run/current-system/configuration.nix
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.
Or even like this:
# If you don't do backups of this file, it is a good idea to set this option to `true`.
# Then, if you accidentally remove configuration.nix, you can find it in
# - /run/current-system/configuration.nix (last one)
# - /nix/var/nix/profiles/system-*/configuration.nix (old versions)
system.copySystemConfiguration = false;
@techhazard You still interested in pursuing this? If you're not, I'll take over |
@infinisil I'm not, feel free to take over :-) |
Motivation for this change
nixos-generate-config: add
system.copySystemConfiguration = true;
This adds the above line to
nixos-generate-config.pl
and explains itseffect.
This is added as an initial method for backing up
configuration.nix
which is useful for both novice users (which do not split-up the file as
quickly) and for advanced users (before they have configured backups).
Added because of github PR #16922 and noobs (e.g. myself)
As argued in the PR (#16922) it makes little sense to have the default setting set to true, but the arguments of @ryantrinkle and myself still stand: It is very convenient to have backups in the initial setting up of a new nixos system.
I have not yet run any test with this, because I don't know how to build the new
nixos-generate-config
. Could someone help me with that?Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)