[MultiBoot] How to override auto-generated boot's `sortKey`

Using systemd-boot with NixOS, systemd-boot auto-generates an entry for Windows installations on the shared ESP, but that auto-generated entry always appears at the end of the boot menu.

I’ve been creating a custom entry file by hand as a workaround.

Is there an official or recommended way—via NixOS configuration or systemd-boot options—to specify a sort order (or sort key) for auto-generated entries so I can control their position in the menu?

1 Like

You could try to instead change the sort key for the nixos boot entry to something that comes after windows.

1 Like

https://search.nixos.org/options?channel=25.05&query=sortkey shows some options here. I even see an option to set the key for windows.

I was using this solution :slight_smile: but that only works for manual boot choices, and will create duplicate entries as sd-boot will still create something like auto_windows.

Well, after checking sd-boot’s source code, it seems those “well known” external boot managers are forced written, and could not be modified unless one changes the code.

Detail: systemd-boot on Github

That’s not really a “solution” lol.
As @truh mentioned you could set the sort key for the nixos entries instead.
Using the same option search I provided.