···
[ (mkRenamedOptionModule [ "boot" "loader" "gummiboot" "enable" ] [ "boot" "loader" "systemd-boot" "enable" ])
90
+
(lib.mkChangedOptionModule
91
+
[ "boot" "loader" "systemd-boot" "memtest86" "entryFilename" ]
92
+
[ "boot" "loader" "systemd-boot" "memtest86" "sortKey" ]
93
+
(config: lib.strings.removeSuffix ".conf" config.boot.loader.systemd-boot.memtest86.entryFilename)
95
+
(lib.mkChangedOptionModule
96
+
[ "boot" "loader" "systemd-boot" "netbootxyz" "entryFilename" ]
97
+
[ "boot" "loader" "systemd-boot" "netbootxyz" "sortKey" ]
98
+
(config: lib.strings.removeSuffix ".conf" config.boot.loader.systemd-boot.netbootxyz.entryFilename)
options.boot.loader.systemd-boot = {
···
115
+
sortKey = mkOption {
117
+
type = lib.types.str;
119
+
The sort key used for the NixOS bootloader entries.
120
+
This key determines sorting relative to non-NixOS entries.
121
+
See also https://uapi-group.org/specifications/specs/boot_loader_specification/#sorting
123
+
This option can also be used to control the sorting of NixOS specialisations.
125
+
By default, specialisations inherit the sort key of their parent generation
126
+
and will have the same value for both the sort-key and the version (i.e. the generation number),
127
+
systemd-boot will therefore sort them based on their file name, meaning that
128
+
in your boot menu you will have each main generation directly followed by
129
+
its specialisations sorted alphabetically by their names.
131
+
If you want a different ordering for a specialisation, you can override
132
+
its sort-key which will cause the specialisation to be uncoupled from its
133
+
parent generation. It will then be sorted by its new sort-key just like
134
+
any other boot entry.
136
+
The sort-key is stored in the generation's bootspec, which means that
137
+
generations keep their sort-keys even if the original definition of the
138
+
generation was removed from the NixOS configuration.
139
+
It also means that updating the sort-key will only affect new generations,
140
+
while old ones will keep the sort-key that they were originally built with.
···
187
-
entryFilename = mkOption {
188
-
default = "memtest86.conf";
226
+
sortKey = mkOption {
227
+
default = "o_memtest86";
description = lib.mdDoc ''
191
-
`systemd-boot` orders the menu entries by the config file names,
230
+
`systemd-boot` orders the menu entries by their sort keys,
so if you want something to appear after all the NixOS entries,
it should start with {file}`o` or onwards.
234
+
See also {option}`boot.loader.systemd-boot.sortKey`.
···
210
-
entryFilename = mkOption {
211
-
default = "o_netbootxyz.conf";
251
+
sortKey = mkOption {
252
+
default = "o_netbootxyz";
description = lib.mdDoc ''
214
-
`systemd-boot` orders the menu entries by the config file names,
255
+
`systemd-boot` orders the menu entries by their sort keys,
so if you want something to appear after all the NixOS entries,
it should start with {file}`o` or onwards.
259
+
See also {option}`boot.loader.systemd-boot.sortKey`.
···
efi /efi/memtest86/memtest.efi
description = lib.mdDoc ''
···
Each attribute name denotes the destination file name,
and the corresponding attribute value is the contents of the entry.
236
-
`systemd-boot` orders the menu entries by the config file names,
237
-
so if you want something to appear after all the NixOS entries,
238
-
it should start with {file}`o` or onwards.
280
+
To control the ordering of the entry in the boot menu, use the sort-key
282
+
https://uapi-group.org/specifications/specs/boot_loader_specification/#sorting
283
+
and {option}`boot.loader.systemd-boot.sortKey`.
···
boot.loader.systemd-boot.extraEntries = mkMerge [
(mkIf cfg.memtest86.enable {
331
-
"${cfg.memtest86.entryFilename}" = ''
376
+
"memtest86.conf" = ''
efi /efi/memtest86/memtest.efi
379
+
sort-key ${cfg.memtest86.sortKey}
(mkIf cfg.netbootxyz.enable {
337
-
"${cfg.netbootxyz.entryFilename}" = ''
383
+
"netbootxyz.conf" = ''
efi /efi/netbootxyz/netboot.xyz.efi
386
+
sort-key ${cfg.netbootxyz.sortKey}
391
+
boot.bootspec.extensions."org.nixos.systemd-boot" = {
392
+
inherit (config.boot.loader.systemd-boot) sortKey;
build.installBootLoader = finalSystemdBootBuilder;