I got a confusing error after doing sudo nixos-rebuild switch
for my flake-based configuration.
Click to expand
building the system configuration...
Traceback (most recent call last):
File "/nix/store/w9wk3m6aczb3v9nwj775n269ziw29z9b-systemd-boot", line 278, in main
write_entry(*gen, machine_id)
File "/nix/store/w9wk3m6aczb3v9nwj775n269ziw29z9b-systemd-boot", line 116, in write_entry
kernel = copy_from_profile(profile, generation, specialisation, "kernel")
File "/nix/store/w9wk3m6aczb3v9nwj775n269ziw29z9b-systemd-boot", line 90, in copy_from_profile
copy_if_not_exists(store_file_path, "/boot%s" % (efi_file_path))
File "/nix/store/w9wk3m6aczb3v9nwj775n269ziw29z9b-systemd-boot", line 25, in copy_if_not_exists
shutil.copyfile(source, dest)
File "/nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6/lib/python3.9/shutil.py", line 264, in copyfile
with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/nix/store/a1ycypk68q92m30dngkvk3wjrf68b71d-apostrophe-2.5/kernel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/nix/store/w9wk3m6aczb3v9nwj775n269ziw29z9b-systemd-boot", line 314, in <module>
main()
File "/nix/store/w9wk3m6aczb3v9nwj775n269ziw29z9b-systemd-boot", line 284, in main
print("ignoring profile '{}' in the list of boot entries because of the following error:\n{}".format(profile, e), file=sys.stderr)
UnboundLocalError: local variable 'profile' referenced before assignment
warning: error(s) occurred while switching to the new configuration
I’m running (Nix) 2.6.0pre20211217_6e6e998.
This error is very weird and it sounds like something in Nix’s state or store is in an unexpected configuration. Apostrophe is only specified in my home configuration (managed with home-manager), not my system configuration.
I previously tried building an alternate version of Apostrophe via nix-repl, and was somewhat surprised by the behaviour. I imported my /etc/nixos flake and then used pkgs = inputs.nixos.legacyPackages.x86_64-linux
, and was surprised when autocompleting “legacyPackages” caused a (re?-)download of nixpkgs. Maybe something was mistakenly overridden.
I’ve run nix doctor
to no avail.
You can find my NixOS configuration here: GitHub - schuelermine/configuration
You can find my home-manager configuration here: GitHub - schuelermine/home-manager-configuration