Hi. I am new to NixOS and haven’t fully switched yet. I just want to make sure everything works before fully switching over. Currently, I am focused on the first thing that happens when I turn on my device: boot.
One of the things I noticed is that /boot/loader/loader.conf
is modified. Specifically, the default
entry is changed to point to the latest generation. It is understandable to want to have the default entry be the latest generation after an update, but I personally do not like setting the default
entry to a static config. I usually set it to @saved
so it just boots into the last entry I selected on reboot.
This is useful for two reasons:
- Right now, I am not fully on NixOS, so I don’t want to keep selecting the entry I want on every boot.
- If someone is using Windows and leaves it updating, they might come back to a system booted into NixOS with the update incomplete.
So, I think there should be an option to have it be @saved
, but maybe change /sys/firmware/efi/efivars/LoaderEntryLastBooted-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f
to point to the newest generation on rebuild.
It looks like the contents of that file are UTF-16, but I am not sure what the first and last three bytes are:
$ hexdump -C /sys/firmware/efi/efivars/LoaderEntryLastBooted-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f
00000000 07 00 00 00 67 00 65 00 6e 00 74 00 6f 00 6f 00 |....g.e.n.t.o.o.|
00000010 6d 00 75 00 73 00 6c 00 2e 00 63 00 6f 00 6e 00 |m.u.s.l...c.o.n.|
00000020 66 00 00 00 |f...|
00000024
I know there is extraInstallCommands, where I can just overwrite the loader.conf again with @saved, but I am not sure how I can get what the latest generation is or how I would write to that EFI variable in UTF-16.