From d09dbe2d7f31aa865bd2e6b963d52df0dc231323 Mon Sep 17 00:00:00 2001 From: Fernando Rodrigues Date: Fri, 13 Sep 2024 19:50:25 +0000 Subject: [PATCH 1/4] ipxe: move to by-name Signed-off-by: Fernando Rodrigues --- .../misc/ipxe/default.nix => by-name/ip/ipxe/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{tools/misc/ipxe/default.nix => by-name/ip/ipxe/package.nix} (100%) diff --git a/pkgs/tools/misc/ipxe/default.nix b/pkgs/by-name/ip/ipxe/package.nix similarity index 100% rename from pkgs/tools/misc/ipxe/default.nix rename to pkgs/by-name/ip/ipxe/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a6bbd69898f5..ae7909975be4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8948,8 +8948,6 @@ with pkgs; ipv6calc = callPackage ../tools/networking/ipv6calc { }; - ipxe = callPackage ../tools/misc/ipxe { }; - irker = callPackage ../servers/irker { }; iroh = callPackage ../applications/networking/iroh { }; From 0ed7e74523d93bf14823f8d097db1e3e35521fc0 Mon Sep 17 00:00:00 2001 From: Fernando Rodrigues Date: Fri, 13 Sep 2024 19:50:46 +0000 Subject: [PATCH 2/4] ipxe: format with nixfmt-rfc-style Signed-off-by: Fernando Rodrigues --- pkgs/by-name/ip/ipxe/package.nix | 137 +++++++++++++++++++------------ 1 file changed, 83 insertions(+), 54 deletions(-) diff --git a/pkgs/by-name/ip/ipxe/package.nix b/pkgs/by-name/ip/ipxe/package.nix index dce23ff8f9af..9e235015c2b8 100644 --- a/pkgs/by-name/ip/ipxe/package.nix +++ b/pkgs/by-name/ip/ipxe/package.nix @@ -1,41 +1,63 @@ -{ stdenv, lib, fetchFromGitHub, unstableGitUpdater, buildPackages -, gnu-efi, mtools, openssl, perl, xorriso, xz -, syslinux ? null -, embedScript ? null -, additionalTargets ? {} -, additionalOptions ? [] +{ + stdenv, + lib, + fetchFromGitHub, + unstableGitUpdater, + buildPackages, + gnu-efi, + mtools, + openssl, + perl, + xorriso, + xz, + syslinux ? null, + embedScript ? null, + additionalTargets ? { }, + additionalOptions ? [ ], }: let - 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-x86_64-efi/snp.efi" = null; - } // lib.optionalAttrs stdenv.hostPlatform.isx86 { - "bin/ipxe.dsk" = null; - "bin/ipxe.usb" = null; - "bin/ipxe.iso" = null; - "bin/ipxe.lkrn" = null; - "bin/undionly.kpxe" = null; - } // lib.optionalAttrs stdenv.isAarch32 { - "bin-arm32-efi/ipxe.efi" = null; - "bin-arm32-efi/ipxe.efirom" = null; - "bin-arm32-efi/ipxe.usb" = "ipxe-efi.usb"; - "bin-arm32-efi/snp.efi" = null; - } // lib.optionalAttrs stdenv.isAarch64 { - "bin-arm64-efi/ipxe.efi" = null; - "bin-arm64-efi/ipxe.efirom" = null; - "bin-arm64-efi/ipxe.usb" = "ipxe-efi.usb"; - "bin-arm64-efi/snp.efi" = null; - }; + 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-x86_64-efi/snp.efi" = null; + } + // lib.optionalAttrs stdenv.hostPlatform.isx86 { + "bin/ipxe.dsk" = null; + "bin/ipxe.usb" = null; + "bin/ipxe.iso" = null; + "bin/ipxe.lkrn" = null; + "bin/undionly.kpxe" = null; + } + // lib.optionalAttrs stdenv.isAarch32 { + "bin-arm32-efi/ipxe.efi" = null; + "bin-arm32-efi/ipxe.efirom" = null; + "bin-arm32-efi/ipxe.usb" = "ipxe-efi.usb"; + "bin-arm32-efi/snp.efi" = null; + } + // lib.optionalAttrs stdenv.isAarch64 { + "bin-arm64-efi/ipxe.efi" = null; + "bin-arm64-efi/ipxe.efirom" = null; + "bin-arm64-efi/ipxe.usb" = "ipxe-efi.usb"; + "bin-arm64-efi/snp.efi" = null; + }; in stdenv.mkDerivation rec { pname = "ipxe"; version = "1.21.1-unstable-2024-08-15"; - nativeBuildInputs = [ gnu-efi mtools openssl perl xorriso xz ] ++ lib.optional stdenv.hostPlatform.isx86 syslinux; + nativeBuildInputs = [ + gnu-efi + mtools + openssl + perl + xorriso + xz + ] ++ lib.optional stdenv.hostPlatform.isx86 syslinux; depsBuildBuild = [ buildPackages.stdenv.cc ]; strictDeps = true; @@ -52,15 +74,18 @@ stdenv.mkDerivation rec { ''; # calling syslinux on a FAT image isn't going to work # not possible due to assembler code - hardeningDisable = [ "pic" "stackprotector" ]; + hardeningDisable = [ + "pic" + "stackprotector" + ]; env.NIX_CFLAGS_COMPILE = "-Wno-error"; - makeFlags = - [ "ECHO_E_BIN_ECHO=echo" "ECHO_E_BIN_ECHO_E=echo" # No /bin/echo here. - "CROSS=${stdenv.cc.targetPrefix}" - ] ++ lib.optional (embedScript != null) "EMBED=${embedScript}"; - + makeFlags = [ + "ECHO_E_BIN_ECHO=echo" + "ECHO_E_BIN_ECHO_E=echo" # No /bin/echo here. + "CROSS=${stdenv.cc.targetPrefix}" + ] ++ lib.optional (embedScript != null) "EMBED=${embedScript}"; enabledOptions = [ "PING_CMD" @@ -69,15 +94,18 @@ stdenv.mkDerivation rec { "DOWNLOAD_PROTO_HTTPS" ] ++ additionalOptions; - configurePhase = '' - runHook preConfigure - for opt in ${lib.escapeShellArgs enabledOptions}; do echo "#define $opt" >> src/config/general.h; done - substituteInPlace src/Makefile.housekeeping --replace '/bin/echo' echo - '' + lib.optionalString stdenv.hostPlatform.isx86 '' - substituteInPlace src/util/genfsimg --replace /usr/lib/syslinux ${syslinux}/share/syslinux - '' + '' - runHook postConfigure - ''; + configurePhase = + '' + runHook preConfigure + for opt in ${lib.escapeShellArgs enabledOptions}; do echo "#define $opt" >> src/config/general.h; done + substituteInPlace src/Makefile.housekeeping --replace '/bin/echo' echo + '' + + lib.optionalString stdenv.hostPlatform.isx86 '' + substituteInPlace src/util/genfsimg --replace /usr/lib/syslinux ${syslinux}/share/syslinux + '' + + '' + runHook postConfigure + ''; preBuild = "cd src"; @@ -87,10 +115,11 @@ stdenv.mkDerivation rec { runHook preInstall mkdir -p $out - ${lib.concatStringsSep "\n" (lib.mapAttrsToList (from: to: - if to == null - then "cp -v ${from} $out" - else "cp -v ${from} $out/${to}") targets)} + ${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. @@ -105,10 +134,10 @@ stdenv.mkDerivation rec { tagPrefix = "v"; }; - meta = with lib; - { description = "Network boot firmware"; - homepage = "https://ipxe.org/"; - license = licenses.gpl2Only; - platforms = platforms.linux; - }; + meta = with lib; { + description = "Network boot firmware"; + homepage = "https://ipxe.org/"; + license = licenses.gpl2Only; + platforms = platforms.linux; + }; } From 01770b4374c21fa854d2937d3be1664bd02a5e23 Mon Sep 17 00:00:00 2001 From: Fernando Rodrigues Date: Fri, 13 Sep 2024 20:04:19 +0000 Subject: [PATCH 3/4] ipxe: modernise Signed-off-by: Fernando Rodrigues --- pkgs/by-name/ip/ipxe/package.nix | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/pkgs/by-name/ip/ipxe/package.nix b/pkgs/by-name/ip/ipxe/package.nix index 9e235015c2b8..edbbe59268d8 100644 --- a/pkgs/by-name/ip/ipxe/package.nix +++ b/pkgs/by-name/ip/ipxe/package.nix @@ -10,7 +10,7 @@ perl, xorriso, xz, - syslinux ? null, + syslinux, embedScript ? null, additionalTargets ? { }, additionalOptions ? [ ], @@ -46,7 +46,7 @@ let }; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "ipxe"; version = "1.21.1-unstable-2024-08-15"; @@ -58,6 +58,7 @@ stdenv.mkDerivation rec { xorriso xz ] ++ lib.optional stdenv.hostPlatform.isx86 syslinux; + depsBuildBuild = [ buildPackages.stdenv.cc ]; strictDeps = true; @@ -69,18 +70,17 @@ stdenv.mkDerivation rec { hash = "sha256-Zf2ZblKUyKPo0YdzQFeCEAnYkvWDsmuTS9htvSybpXo="; }; + # Calling syslinux on a FAT image isn't going to work on Aarch64. postPatch = lib.optionalString stdenv.hostPlatform.isAarch64 '' substituteInPlace src/util/genfsimg --replace " syslinux " " true " - ''; # calling syslinux on a FAT image isn't going to work + ''; - # not possible due to assembler code + # Hardening is not possible due to assembler code. hardeningDisable = [ "pic" "stackprotector" ]; - env.NIX_CFLAGS_COMPILE = "-Wno-error"; - makeFlags = [ "ECHO_E_BIN_ECHO=echo" "ECHO_E_BIN_ECHO_E=echo" # No /bin/echo here. @@ -97,7 +97,7 @@ stdenv.mkDerivation rec { configurePhase = '' runHook preConfigure - for opt in ${lib.escapeShellArgs enabledOptions}; do echo "#define $opt" >> src/config/general.h; done + for opt in ${lib.escapeShellArgs finalAttrs.enabledOptions}; do echo "#define $opt" >> src/config/general.h; done substituteInPlace src/Makefile.housekeeping --replace '/bin/echo' echo '' + lib.optionalString stdenv.hostPlatform.isx86 '' @@ -134,10 +134,11 @@ stdenv.mkDerivation rec { tagPrefix = "v"; }; - meta = with lib; { + meta = { description = "Network boot firmware"; homepage = "https://ipxe.org/"; - license = licenses.gpl2Only; - platforms = platforms.linux; + license = lib.licenses.gpl2Only; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ sigmasquadron ]; }; -} +}) From 345f1f93c297606513481562261a492b36599cc4 Mon Sep 17 00:00:00 2001 From: Fernando Rodrigues Date: Fri, 13 Sep 2024 20:10:13 +0000 Subject: [PATCH 4/4] ipxe: 1.12.1-unstable-2024-08-15 -> 1.21.1-unstable-2024-09-13 Signed-off-by: Fernando Rodrigues --- pkgs/by-name/ip/ipxe/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/ip/ipxe/package.nix b/pkgs/by-name/ip/ipxe/package.nix index edbbe59268d8..c06072a41088 100644 --- a/pkgs/by-name/ip/ipxe/package.nix +++ b/pkgs/by-name/ip/ipxe/package.nix @@ -48,7 +48,7 @@ in stdenv.mkDerivation (finalAttrs: { pname = "ipxe"; - version = "1.21.1-unstable-2024-08-15"; + version = "1.21.1-unstable-2024-09-13"; nativeBuildInputs = [ gnu-efi @@ -66,8 +66,8 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ipxe"; repo = "ipxe"; - rev = "950f6b5861d8d6b247b37e4e1401d26d8f908ee8"; - hash = "sha256-Zf2ZblKUyKPo0YdzQFeCEAnYkvWDsmuTS9htvSybpXo="; + rev = "c85ad1246890cf3c0c5f2ac6de06ab046ddd0043"; + hash = "sha256-Py0mXcCj/NhVW3crngR9ZLHvH9N0QJeVmykc3k+yi6Y="; }; # Calling syslinux on a FAT image isn't going to work on Aarch64.