diff --git a/installer/grub-menu-builder.sh b/installer/grub-menu-builder.sh index 7e1e6b4cad1..be4e5d26a5e 100644 --- a/installer/grub-menu-builder.sh +++ b/installer/grub-menu-builder.sh @@ -45,6 +45,11 @@ addEntry() { cp $initrd $initrd2 fi initrd=$initrd2 + + if test -n "@bootMount@"; then + kernel=$(echo $kernel2 | sed -e 's^/boot^@bootMount@^') + initrd=$(echo $initrd2 | sed -e 's^/boot^@bootMount@^') + fi fi local confName=$(if test -e $path/configuration-name; then diff --git a/system/options.nix b/system/options.nix index 75459045c48..fc0484bd239 100644 --- a/system/options.nix +++ b/system/options.nix @@ -53,6 +53,17 @@ "; }; + bootMount = mkOption { + default = ""; + example = "(hd0,0)"; + description = " + If the system partition may be wiped on reinstall, it is better + to have /boot on a small partition. To do it, we need to explain + to GRUB where the kernels live. Specify the partition here (in + GRUB notation. + "; + }; + kernel = mkOption { default = pkgs: pkgs.kernel; description = " diff --git a/system/system.nix b/system/system.nix index 311ddaf0a1e..922e14476d5 100644 --- a/system/system.nix +++ b/system/system.nix @@ -322,6 +322,7 @@ rec { path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep]; copyKernels = config.boot.copyKernels; extraGrubEntries = config.boot.extraGrubEntries; + bootMount = config.boot.bootMount; };