nixpkgs
nixpkgs copied to clipboard
nixos/systemd-boot: fix conditional, undefined variable
Motivation for this change
I was tinkering with systemd-boot-builder.py
and noticed these two oddities. See the individual commits for rationale / reasoning.
Things done
- [x] Tested using sandboxing (nix.useSandbox on NixOS, or option
sandbox
innix.conf
on non-NixOS linux) - Built on platform(s)
- [x] NixOS
- [ ] macOS
- [ ] other Linux distributions
- [ ] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
- [ ] Tested compilation of all pkgs that depend on this change using
nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
- [ ] Tested execution of all binary files (usually in
./result/bin/
) -
21.11 Release Notes (or backporting 21.05 Relase notes)
- [ ] (Package updates) Added a release notes entry if the change is major or breaking
- [ ] (Module updates) Added a release notes entry if the change is significant
- [ ] (Module addition) Added a release notes entry if adding a new NixOS module
- [x] Fits CONTRIBUTING.md.
N.B.: I don't actually use profiles, so if somebody who does could test this and report back, that would fantastic...
Any news on this? I just ran into the issue unfortunately- -
~/Work/dotfiles λ sudo /nix/store/mxx255r92fd3mwa8m0b620z1k20fng8m-nixos-system-threenixos-21.11.20211107.c935f5e/bin/switch-to-configuration boot master
could not find any previously installed systemd-boot
Traceback (most recent call last):
File "/nix/store/9hnwjfz3jwpa4181s4hyqs07p1qksg9a-systemd-boot", line 270, in main
write_entry(*gen, machine_id)
File "/nix/store/9hnwjfz3jwpa4181s4hyqs07p1qksg9a-systemd-boot", line 116, in write_entry
kernel = copy_from_profile(profile, generation, specialisation, "kernel")
File "/nix/store/9hnwjfz3jwpa4181s4hyqs07p1qksg9a-systemd-boot", line 90, in copy_from_profile
copy_if_not_exists(store_file_path, "/boot%s" % (efi_file_path))
File "/nix/store/9hnwjfz3jwpa4181s4hyqs07p1qksg9a-systemd-boot", line 25, in copy_if_not_exists
shutil.copyfile(source, dest)
File "/nix/store/8dxxjbiyxwkvh53q5kh6nydla2anacgi-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/h749dg84ly9a9dh6iwjd9y94j0yjcjv3-source/kernel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/nix/store/9hnwjfz3jwpa4181s4hyqs07p1qksg9a-systemd-boot", line 306, in <module>
main()
File "/nix/store/9hnwjfz3jwpa4181s4hyqs07p1qksg9a-systemd-boot", line 276, 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