summary refs log tree commit diff
path: root/pkgs/tools/misc
diff options
context:
space:
mode:
authorThomas Strobel <ts468@cam.ac.uk>2015-01-14 10:30:57 +0100
committerThomas Strobel <ts468@cam.ac.uk>2015-01-27 19:46:37 +0100
commit37673708661542797d4ad6de2c74e3ce6863b2cb (patch)
treebfbe34ebea8fd18fab1f58f8d6b753e79e14d73c /pkgs/tools/misc
parent95632fdbf5daf48543f3221e2cd41e19a1d9451a (diff)
downloadnixpkgs-37673708661542797d4ad6de2c74e3ce6863b2cb.tar
nixpkgs-37673708661542797d4ad6de2c74e3ce6863b2cb.tar.gz
nixpkgs-37673708661542797d4ad6de2c74e3ce6863b2cb.tar.bz2
nixpkgs-37673708661542797d4ad6de2c74e3ce6863b2cb.tar.lz
nixpkgs-37673708661542797d4ad6de2c74e3ce6863b2cb.tar.xz
nixpkgs-37673708661542797d4ad6de2c74e3ce6863b2cb.tar.zst
nixpkgs-37673708661542797d4ad6de2c74e3ce6863b2cb.zip
Add target parameter to grub installation chain
Diffstat (limited to 'pkgs/tools/misc')
-rw-r--r--pkgs/tools/misc/grub/2.0x.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkgs/tools/misc/grub/2.0x.nix b/pkgs/tools/misc/grub/2.0x.nix
index 1dbdfff7448..0f2f9fc7bf3 100644
--- a/pkgs/tools/misc/grub/2.0x.nix
+++ b/pkgs/tools/misc/grub/2.0x.nix
@@ -7,12 +7,18 @@
 
 with stdenv.lib;
 let
+  pcSystems = {
+    "i686-linux".target = "i386";
+    "x86_64-linux".target = "i386";
+  };
+
   efiSystems = {
     "i686-linux".target = "i386";
     "x86_64-linux".target = "x86_64";
   };
 
   canEfi = any (system: stdenv.system == system) (mapAttrsToList (name: _: name) efiSystems);
+  inPCSystems = any (system: stdenv.system == system) (mapAttrsToList (name: _: name) pcSystems);
 
   prefix = "grub${if efiSupport then "-efi" else ""}${optionalString zfsSupport "-zfs"}";
 
@@ -82,6 +88,13 @@ stdenv.mkDerivation rec {
   configureFlags = optional zfsSupport "--enable-libzfs"
     ++ optionals efiSupport [ "--with-platform=efi" "--target=${efiSystems.${stdenv.system}.target}" "--program-prefix=" ];
 
+  # save target that grub is compiled for
+  grubTarget = if efiSupport
+               then "${efiSystems.${stdenv.system}.target}-efi"
+               else if inPCSystems
+                    then "${pcSystems.${stdenv.system}.target}-pc"
+                    else "";
+
   doCheck = false;
   enableParallelBuilding = true;