I have a system which I manage using flakes (i.e. nixos-rebuild switch --flake .#box
). I noticed that my /nix
is pretty big, so today I went and looked at why that could be. I noticed in /nix/store
I have a lot of duplicate entries, such as:
$ for j in /nix/store/*ghc-9.4.6/; do echo --- $j; nix-store --query --roots $j|rg -v censored; done
--- /nix/store/3aq8bd4j4vcqcp1qc8aw3wija9bzb1cb-ghc-9.4.6/
/run/booted-system -> /nix/store/yxy7zvv86mci0fi2bpw6v1xn77ls873g-nixos-system-box-23.11.20230915.ace5093
--- /nix/store/s7gic33gdmisapji4v2fml3k5ky1bx84-ghc-9.4.6/
/run/current-system -> /nix/store/g3bfwyf3yzfyym0p1k0ih82k04l4z80f-nixos-system-box-23.11.20231019.7c9cc5a
/nix/var/nix/profiles/system-199-link -> /nix/store/g3bfwyf3yzfyym0p1k0ih82k04l4z80f-nixos-system-box-23.11.20231019.7c9cc5a
I only have a single generation:
$ nixos-rebuild list-generations --flake .#box|cat
Generation Build-date NixOS version Kernel Configuration Revision Specialisation
199 current 2023-10-20 20:11:03 23.11.20231019.7c9cc5a 6.1.58
and also a single boot entry:
$ ll /boot/efi/loader/entries
total 4
-rwxr-xr-x 1 root root 422 Oct 29 15:00 nixos-generation-199.conf
I rebooted the system, ran nix-collect-garbage -d
, ran nixos-rebuild switch --flake .#box
, but only /run/current-system
changed, /run/booted-system
stayed the same.
Any idea how to update /run/booted-system
and have it updated going forward when I switch between generations?