summary refs log tree commit diff
path: root/modules/system/activation/top-level.nix
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2009-09-27 21:51:37 +0000
committerLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2009-09-27 21:51:37 +0000
commit75f6cd20da8f34af7d7249998b7e5164f8ac658a (patch)
tree1776e7badccd85416b5f7717a7738467f8f5e01b /modules/system/activation/top-level.nix
parent852478ff794c499496a327373506b00985768463 (diff)
downloadnixpkgs-75f6cd20da8f34af7d7249998b7e5164f8ac658a.tar
nixpkgs-75f6cd20da8f34af7d7249998b7e5164f8ac658a.tar.gz
nixpkgs-75f6cd20da8f34af7d7249998b7e5164f8ac658a.tar.bz2
nixpkgs-75f6cd20da8f34af7d7249998b7e5164f8ac658a.tar.lz
nixpkgs-75f6cd20da8f34af7d7249998b7e5164f8ac658a.tar.xz
nixpkgs-75f6cd20da8f34af7d7249998b7e5164f8ac658a.tar.zst
nixpkgs-75f6cd20da8f34af7d7249998b7e5164f8ac658a.zip
Making modular my previous changes for armv5tel. I updated the way to use
grub. Its options are no more inside 'boot', but inside 'boot.loader.grub'.
I added a new bootloader configuration for nixos, generationsDir. It creates
/boot/default/{init,initrd,kernel,system} symlinks, and the same for the generations
in /boot/system-$gen/{init,initrd,kernel,system}.

I can program the u-boot loader to load /boot/default files always, and have
a minimal nixos boot loader installer functionality. Additionally, I can refer
to the other system generations easily, with a simple 'ls' in /boot.

svn path=/nixos/trunk/; revision=17460
Diffstat (limited to 'modules/system/activation/top-level.nix')
-rw-r--r--modules/system/activation/top-level.nix40
1 files changed, 30 insertions, 10 deletions
diff --git a/modules/system/activation/top-level.nix b/modules/system/activation/top-level.nix
index 19e737d0d42..992b988bc49 100644
--- a/modules/system/activation/top-level.nix
+++ b/modules/system/activation/top-level.nix
@@ -17,6 +17,20 @@ let
         Additional configurations to build.
       '';
     };
+
+    system.boot.loader.id = pkgs.lib.mkOption {
+      default = "";
+      description = ''
+        Id string of the used bootloader.
+      '';
+    };
+
+    system.boot.loader.kernelFile = pkgs.lib.mkOption {
+      default = "";
+      description = ''
+        Name of the kernel file to be passed to the bootloader.
+      '';
+    };
     
   };
 
@@ -33,13 +47,17 @@ let
 
 
   systemBuilder = let
-      kernelfile = if (pkgs.stdenv.system == "armv5tel-linux")
-        then "${config.boot.kernelPackages.kernel}/uImage"
-        else "${config.boot.kernelPackages.kernel}/vmlinuz";
-    in ''
+      kernelPath = "${config.boot.kernelPackages.kernel}/" +
+        "${config.system.boot.loader.kernelFile}";
+    in 
+      ''
       ensureDir $out
 
-      ln -s ${kernelfile} $out/kernel
+      if [ ! -f ${kernelPath} ]; then
+        echo "The bootloader cannot find the proper kernel image."
+        echo "(Expecting ${kernelPath})"
+      fi
+      ln -s ${kernelPath} $out/kernel
       if [ -n "$grub" ]; then 
         ln -s $grub $out/grub
       fi
@@ -76,13 +94,9 @@ let
     name = "system";
     buildCommand = systemBuilder;
     inherit children;
-    grub = if (pkgs.stdenv.system != "armv5tel-linux") then pkgs.grub
-      else null;
-    grubDevice = config.boot.grubDevice;
     kernelParams =
       config.boot.kernelParams ++ config.boot.extraKernelParams;
-    grubMenuBuilder = config.system.build.grubMenuBuilder;
-    configurationName = config.boot.configurationName;
+    menuBuilder = config.system.build.menuBuilder;
     # Most of these are needed by grub-install.
     path = [
       pkgs.coreutils
@@ -92,6 +106,12 @@ let
       pkgs.diffutils
       pkgs.upstart # for initctl
     ];
+
+    # Boot loaders
+    bootLoader = config.system.boot.loader.id;
+    grub = if config.boot.loader.grub.enable then pkgs.grub else null;
+    grubDevice = config.boot.loader.grub.grubDevice;
+    configurationName = config.boot.loader.grub.configurationName;
   };