Change:
$conf .= "}nn"; } <ins> sub addGeneration { my ($name, $nameSuffix, $path, $options, $current) = @_; </ins> <del> # Add default entries. $conf .= "$extraEntriesn" if $extraEntriesBeforeNixOS; </del> <ins> # Do not search for grand children my @links = sort (glob "$path/specialisation/*"); </ins> <del> addEntry("@distroName@ - Default", $defaultConfig, $entryOptions, 1); </del> <ins> if ($current != 1 && scalar(@links) != 0) { $conf .= "submenu "> $name$nameSuffix" --class submenu {n"; } </ins> <del> $conf .= "$extraEntriesn" unless $extraEntriesBeforeNixOS; </del> <ins> addEntry("$name" . (scalar(@links) == 0 ? "" : " - Default") . $nameSuffix, $path, $options, $current); </ins> <del> # Find all the children of the current default configuration # Do not search for grand children my @links = sort (glob "$defaultConfig/specialisation/*"); foreach my $link (@links) { </del> <ins> # Find all the children of the current default configuration # Do not search for grand children foreach my $link (@links) { </ins> <del> my $entryName = ""; </del> <ins> my $entryName = ""; </ins> <del> my $cfgName = readFile("$link/configuration-name"); </del> <ins> my $cfgName = readFile("$link/configuration-name"); </ins> <del> my $date = strftime("%F", localtime(lstat($link)->mtime)); my $version = -e "$link/nixos-version" ? readFile("$link/nixos-version") : basename((glob(dirname(Cwd::abs_path("$link/kernel")) . "/lib/modules/*"))[0]); </del> <ins> my $date = strftime("%F", localtime(lstat($link)->mtime)); my $version = -e "$link/nixos-version" ? readFile("$link/nixos-version") : basename((glob(dirname(Cwd::abs_path("$link/kernel")) . "/lib/modules/*"))[0]); </ins> <del> if ($cfgName) { $entryName = $cfgName; } else { my $linkname = basename($link); $entryName = "($linkname - $date - $version)"; </del> <ins> if ($cfgName) { $entryName = $cfgName; } else { my $linkname = basename($link); $entryName = "($linkname - $date - $version)"; } addEntry("$name - $entryName", $link, "", 1); } if ($current != 1 && scalar(@links) != 0) { $conf .= "}n"; </ins> } <del> addEntry("@distroName@ - $entryName", $link, "", 1); </del> } <ins> # Add default entries. $conf .= "$extraEntriesn" if $extraEntriesBeforeNixOS; addGeneration("@distroName@", "", $defaultConfig, $entryOptions, 1); $conf .= "$extraEntriesn" unless $extraEntriesBeforeNixOS; </ins> my $grubBootPath = $grubBoot->path; # extraEntries could refer to @bootRoot@, which we have to substitute $conf =~ s/@bootRoot@/$grubBootPath/g;

Discussion:
NixOS specialisations are supposed to have their own entries in the Grub menu for previous generations according to the . However in practice that is not the case. The older generations do not hold any boot entry for the specialisations, but only the default entry. nixpkgs: I am not sure, whether to update the wiki to correctly mention current behavior, or whether to fix the grub module to generate entries for specialisations for older generations. <!-- make sure this issue is not redundant or obsolete --- [x] checked [latest Nixpkgs manual] ([source][nixpkgs-source]) and [latest NixOS manual] ([source][nixos-source]) [x] checked [open documentation issues] for possible duplicates [x] checked [open documentation pull requests] for possible solutions
Fixed by .