about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/ipxe/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/misc/ipxe/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/misc/ipxe/default.nix39
1 files changed, 26 insertions, 13 deletions
diff --git a/nixpkgs/pkgs/tools/misc/ipxe/default.nix b/nixpkgs/pkgs/tools/misc/ipxe/default.nix
index a9cddcc5ff81..219c03f263c7 100644
--- a/nixpkgs/pkgs/tools/misc/ipxe/default.nix
+++ b/nixpkgs/pkgs/tools/misc/ipxe/default.nix
@@ -1,23 +1,28 @@
-{ stdenv, lib, fetchgit, perl, cdrkit, syslinux, xz, openssl, gnu-efi
+{ stdenv, lib, fetchgit, perl, cdrkit, syslinux, xz, openssl, gnu-efi, mtools
 , embedScript ? null
+, additionalTargets ? {}
 }:
 
 let
   date = "20190318";
   rev = "ebf2eaf515e46abd43bc798e7e4ba77bfe529218";
-  targets = (lib.optional stdenv.isx86_64 "bin-x86_64-efi/ipxe.efi") ++ [
-    "bin/ipxe.dsk"
-    "bin/ipxe.usb"
-    "bin/ipxe.iso"
-    "bin/ipxe.lkrn"
-    "bin/undionly.kpxe"
-  ];
+  targets = additionalTargets // lib.optionalAttrs stdenv.isx86_64 {
+    "bin-x86_64-efi/ipxe.efi" = null;
+    "bin-x86_64-efi/ipxe.efirom" = null;
+    "bin-x86_64-efi/ipxe.usb" = "ipxe-efi.usb";
+  } // {
+    "bin/ipxe.dsk" = null;
+    "bin/ipxe.usb" = null;
+    "bin/ipxe.iso" = null;
+    "bin/ipxe.lkrn" = null;
+    "bin/undionly.kpxe" = null;
+  };
 in
 
 stdenv.mkDerivation {
   name = "ipxe-${date}-${builtins.substring 0 7 rev}";
 
-  buildInputs = [ perl cdrkit syslinux xz openssl gnu-efi ];
+  nativeBuildInputs = [ perl cdrkit syslinux xz openssl gnu-efi mtools ];
 
   src = fetchgit {
     url = https://git.ipxe.org/ipxe.git;
@@ -37,7 +42,12 @@ stdenv.mkDerivation {
     ] ++ lib.optional (embedScript != null) "EMBED=${embedScript}";
 
 
-  enabledOptions = [ "DOWNLOAD_PROTO_HTTPS" ];
+  enabledOptions = [
+    "PING_CMD"
+    "IMAGE_TRUST_CMD"
+    "DOWNLOAD_PROTO_HTTP"
+    "DOWNLOAD_PROTO_HTTPS"
+  ];
 
   configurePhase = ''
     runHook preConfigure
@@ -49,11 +59,14 @@ stdenv.mkDerivation {
 
   preBuild = "cd src";
 
-  buildFlags = targets;
+  buildFlags = lib.attrNames targets;
 
   installPhase = ''
     mkdir -p $out
-    cp ${lib.concatStringsSep " " targets} $out
+    ${lib.concatStringsSep "\n" (lib.mapAttrsToList (from: to:
+      if to == null
+      then "cp -v ${from} $out"
+      else "cp -v ${from} $out/${to}") targets)}
 
     # Some PXE constellations especially with dnsmasq are looking for the file with .0 ending
     # let's provide it as a symlink to be compatible in this case.
@@ -67,6 +80,6 @@ stdenv.mkDerivation {
       homepage = http://ipxe.org/;
       license = licenses.gpl2;
       maintainers = with maintainers; [ ehmry ];
-      platforms = platforms.all;
+      platforms = [ "x86_64-linux" "i686-linux" ];
     };
 }