Whenever I run
nixos-rebuild switch while on a specialisation, I seem to lose any config that was made specifically on said specialisation.
For example, if using my gpu passthrough setup and switching, I will lose access to programs like virt-manager, virsh, etc etc until I reboot and select it again.
Is this some kind of limitation or can the behaviour be changed?
- system: `"x86_64-linux"`
- host os: `Linux 6.0.10, NixOS, 22.11 (Raccoon), 22.11.466.596a8e828c5`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.11.0`
- channels(root): `"home-manager-22.11.tar.gz, nixos-22.11, nixos-hardware"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
nixos-rebuild will always switch to default specialisation if you use
What you can do is to use
nixos-rebuild boot and then manually switch to the specialisation you want on the new version.
nh has specialisation support.
Please be aware: it is experimental and and might become disfunct when nixos activationlogic changes.
nixos-rebuild switch runs
<toplevel>/bin/switch-to-configuration boot && <toplevel>/bin/switch-to-configuration test. The first command is correct, while you need your specialisation’s
You can manually run these scripts out of your system’s toplevel, which you can build with
nixos-rebuild build, but the API might change.