summary refs log tree commit diff
path: root/pkgs/tools/misc
diff options
context:
space:
mode:
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;