Open kaldonir opened 4 years ago
I thought it is a feature.
If it is, is there any documentation about this? At least the command line documentation of switch-to-configuration
doesn't mention this at all, it gives the impression that the script itself takes care of everything.
If switch-to-configuration will do nix-env -p ... it will breaks many things (nixops and similar software)
What exactly are the things that will break there? (Not trying to be snarky, trying to figure out what's the best way for finxing this issue [if there's something to fix at all])
@volth I also stumbled into this. I see both nixops and morph calling nix-env -p /nix/var/nix/profiles/system --set ./result
, but I don't see a reason why it can't be part of switch-to-configuration
(it should IMHO).
Also, cc @tilpner and https://logs.nix.samueldr.com/nixos/2020-03-16#3186041
Hello, I'm a bot and I thank you in the name of the community for opening this issue.
To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.
The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.
If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.
Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.
Just found this issue, and this has been bugging me for months that ./result/bin/switch-to-configuration boot
(and switch
) does not configure the boot loader!
I looks like it was clearly intended to:
$ ./result/bin/switch-to-configuration --help
Usage: ./result/bin/switch-to-configuration [switch|boot|test]
switch: make the configuration the boot default and activate now
boot: make the configuration the boot default
test: activate the configuration, but don't make it the boot default
dry-activate: show what would be done if this configuration were activated
I marked this as stale due to inactivity. → More info
I don't think it's a wise decision to make switch-to-configuration
mess with your system profiles.
You have to consider that you can run the switch-to-configuration
of any previous generation, and when you run it again, it shouldn't be come the latest generation. It should stay the latest generation.
Wouldn't making this behavior more clear in --help
be enough?
E.g. "make the profile with this configuration (if there is any) the boot default and active now"
Updating the help text could be enough to avoid confusion, but then there is still the issue that switch-to-configuration switch
's exact behavior depends on the configured boot loader.
The help text could state the assumptions, i.e., the target generation has been added to /nix/var/nix/profiles/system
, and that would definitely be better than what we currently have. But then, if switch-to-configuration
can only be reasonably used by taking care of that beforehand, why not do it in the activation script itself?
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/proper-way-to-build-a-remote-system-with-flakes/17661/6
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/introducing-bento-a-nixos-deployment-framework/21446/16
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/tips-tricks-for-nixos-desktop/28488/5
I don't think it's a wise decision to make
switch-to-configuration
mess with your system profiles. You have to consider that you can run theswitch-to-configuration
of any previous generation, and when you run it again, it shouldn't be come the latest generation. It should stay the latest generation.
Isn't that what switch-to-configuration test
is for? AFAICT, the switch-to-configuration help text is is good/right but the implementation is wrong.
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
Pulling this into switch-to-configuration would also make testing much much easier. Right now this functionality is effectively provided by nixos-rebuild which expects a "written" config somewhere which makes testing unnecessarily hard.
Related: https://github.com/NixOS/nixpkgs/issues/266290 ("NixOS apply script [developer oriented feature]")
Describe the bug
Activating a NixOS configuration not through
nixos-rebuild switch
, but through${(pkgs.nixos ./configuration.nix).toplevel}/bin/switch-to-configuration switch
does activate the configuration correctly, but does not correctly add a boot entry.The help text of the
switch-to-configuration
script states thatswitch
should make this configuration the boot default.The concrete symptoms differ between the different boot loaders:
To Reproduce Steps to reproduce the behavior on a UEFI system:
cd /etc/nixos/
configuration.nix
sudo nix-build -E "with import <nixpkgs> { }; (nixos ./configuration.nix).toplevel"
result/bin/switch-to-configuration switch
Expected behavior The
switch-to-configuration
script should work in a standalone manner, and its help text should match its behaviour.Additional context The grub and systemd boot scripts in
nixos/modules/system/boot/loader/
assume that the target generation has been addded to/nix/var/nix/profiles/system
. This happens when I runnixos-rebuild switch
, but is not a part of theswitch-to-configuration
script.A workaround is to run
nix-env -p /nix/var/nix/profiles/system --set ./result
before runningswitch-to-configuration
.Metadata Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Maintainer information: