about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2014-05-01 10:56:55 -0400
committerShea Levy <shea@shealevy.com>2014-05-01 10:56:55 -0400
commite4630c1d41d513eb709bddb39043da84442235a7 (patch)
tree738806aabb58fc0f794119d3152c0cfa76b945f4 /nixos/modules/system
parent4fe2f9805120800b83752f3d29a8d3db18677d0a (diff)
downloadnixlib-e4630c1d41d513eb709bddb39043da84442235a7.tar
nixlib-e4630c1d41d513eb709bddb39043da84442235a7.tar.gz
nixlib-e4630c1d41d513eb709bddb39043da84442235a7.tar.bz2
nixlib-e4630c1d41d513eb709bddb39043da84442235a7.tar.lz
nixlib-e4630c1d41d513eb709bddb39043da84442235a7.tar.xz
nixlib-e4630c1d41d513eb709bddb39043da84442235a7.tar.zst
nixlib-e4630c1d41d513eb709bddb39043da84442235a7.zip
grub: Allow setting the boot root explicitly
If /boot is a btrfs subvolume, it will be on a different device than /
but not be at the root from grub's perspective. This should be fixed in
a nicer way by #2449, but that can't go into 14.04.
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/loader/grub/grub.nix11
-rw-r--r--nixos/modules/system/boot/loader/grub/install-grub.pl5
2 files changed, 15 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix
index a3b09223cbb8..0cc060db8f90 100644
--- a/nixos/modules/system/boot/loader/grub/grub.nix
+++ b/nixos/modules/system/boot/loader/grub/grub.nix
@@ -25,7 +25,7 @@ let
       inherit (cfg)
         version extraConfig extraPerEntryConfig extraEntries
         extraEntriesBeforeNixOS extraPrepareConfig configurationLimit copyKernels timeout
-        default devices;
+        default devices explicitBootRoot;
       path = (makeSearchPath "bin" [
         pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils
       ]) + ":" + (makeSearchPath "sbin" [
@@ -209,6 +209,15 @@ in
         '';
       };
 
+      explicitBootRoot = mkOption {
+        default = "";
+        type = types.str;
+        description = ''
+          The relative path of /boot within the parent volume. Leave empty
+          if /boot is not a btrfs subvolume.
+        '';
+      };
+
     };
 
   };
diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl
index a83733db63b0..c3aa8518b8bb 100644
--- a/nixos/modules/system/boot/loader/grub/install-grub.pl
+++ b/nixos/modules/system/boot/loader/grub/install-grub.pl
@@ -39,6 +39,7 @@ my $configurationLimit = int(get("configurationLimit"));
 my $copyKernels = get("copyKernels") eq "true";
 my $timeout = int(get("timeout"));
 my $defaultEntry = int(get("default"));
+my $explicitBootRoot = get("explicitBootRoot");
 $ENV{'PATH'} = get("path");
 
 die "unsupported GRUB version\n" if $grubVersion != 1 && $grubVersion != 2;
@@ -61,6 +62,10 @@ if (stat("/")->dev != stat("/boot")->dev) {
     $copyKernels = 1;
 }
 
+if ($explicitBootRoot ne "") {
+    $bootRoot = $explicitBootRoot;
+}
+
 
 # Generate the header.
 my $conf .= "# Automatically generated.  DO NOT EDIT THIS FILE!\n";