tpwrules / nixos-apple-silicon

Resources to install NixOS bare metal on Apple Silicon Macs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nixos-rebuild switch --flake fails

crawfordlong opened this issue · comments

commented

I have a working nixos install using the excellent instructions here. I can edit /etc/nixos/configuration.nix and rebuild (and switch) with no issues at all. Attempting to transition over to my flake setup for my other machines, I am encountering the error below, which only happens when I use sudo nixos-rebuild switch --flake $MYFLAKE and not when I use nixos-rebuild build. I have also never encountered anything remotely like this on my other nixos machines.

I can't see anything in the old non-flake configuration.nix or the new machine-specific configuration.nix in my setup that would cause this, in particular nothing different in the boot setup. Thoughts?

Traceback (most recent call last):
  File "/nix/store/jp6wp754f1mpavb11a487fnlj14q0w7i-systemd-boot", line 344, in <module>
    main()
  File "/nix/store/jp6wp754f1mpavb11a487fnlj14q0w7i-systemd-boot", line 332, in main
    install_bootloader(args)
  File "/nix/store/jp6wp754f1mpavb11a487fnlj14q0w7i-systemd-boot", line 288, in install_bootloader
    remove_old_entries(gens)
  File "/nix/store/jp6wp754f1mpavb11a487fnlj14q0w7i-systemd-boot", line 197, in remove_old_entries
    bootspec = get_bootspec(gen.profile, gen.generation)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/jp6wp754f1mpavb11a487fnlj14q0w7i-systemd-boot", line 105, in get_bootspec
    return bootspec_from_json(bootspec_json)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/jp6wp754f1mpavb11a487fnlj14q0w7i-systemd-boot", line 110, in bootspec_from_json
    return BootSpec(**bootspec_json['org.nixos.bootspec.v1'], specialisations=specialisations)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BootSpec.__init__() missing 1 required positional argument: 'initrdSecrets'
warning: error(s) occurred while switching to the new configuration

The only systemd-boot issue I've had, btw, has been some odd gibberish at the bottom of my boot menu, below my nixos generations. I haven't been able to troubleshoot this yet, but it hasn't caused an issue rebuilding and switching in the non-flake environment.

commented

Found an answer: I was trying to rebuild on 23.11 (for consistency with my existing flake setup) and ran into this issue. "Solved" it by just going with unstable for now.

@crawfordlong as you've found a solution, could this issue be closed?

commented

My apologies. Of course.