From 9ebccc29c4c648e9b485bb15d44e90a24761145a Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Mon, 6 Jan 2025 14:28:26 -0500 Subject: [PATCH] linuxPackages.hyperv-daemons: Fix aarch64 builds on latest kernel --- .../linux/hyperv-daemons/default.nix | 51 +++++++++---------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/pkgs/os-specific/linux/hyperv-daemons/default.nix b/pkgs/os-specific/linux/hyperv-daemons/default.nix index ca4174696602..728017fda2ce 100644 --- a/pkgs/os-specific/linux/hyperv-daemons/default.nix +++ b/pkgs/os-specific/linux/hyperv-daemons/default.nix @@ -12,7 +12,12 @@ let libexec = "libexec/hypervkvpd"; - fcopy_name = (if lib.versionOlder kernel.version "6.10" then "fcopy" else "fcopy_uio"); + fcopy_name = + if lib.versionOlder kernel.version "6.10" then + "fcopy" + else + # The fcopy program is explicitly left out in the Makefile on aarch64 + (if stdenv.hostPlatform.isAarch64 then null else "fcopy_uio"); daemons = stdenv.mkDerivation rec { pname = "hyperv-daemons-bin"; @@ -21,31 +26,18 @@ let nativeBuildInputs = [ makeWrapper ]; buildInputs = [ python3 ]; - # as of 4.9 compilation will fail due to -Werror=format-security - hardeningDisable = [ "format" ]; - postPatch = '' cd tools/hv substituteInPlace hv_kvp_daemon.c \ --replace /usr/libexec/hypervkvpd/ $out/${libexec}/ ''; - # We don't actually need the hv_get_{dhcp,dns}_info scripts on NixOS in - # their current incarnation but with them in place, we stop the spam of - # errors in the log. - installPhase = '' - runHook preInstall - - for f in ${fcopy_name} kvp vss ; do - install -Dm755 hv_''${f}_daemon -t $out/bin - done - - install -Dm755 lsvmbus $out/bin/lsvmbus - install -Dm755 hv_get_dhcp_info.sh $out/${libexec}/hv_get_dhcp_info - install -Dm755 hv_get_dns_info.sh $out/${libexec}/hv_get_dns_info - - runHook postInstall - ''; + makeFlags = [ + "ARCH=${stdenv.hostPlatform.parsed.cpu.name}" + "DESTDIR=$(out)" + "sbindir=/bin" + "libexecdir=/libexec" + ]; postFixup = '' wrapProgram $out/bin/hv_kvp_daemon \ @@ -90,22 +82,29 @@ stdenv.mkDerivation { ]; buildInputs = [ daemons ]; + passthru = { + inherit daemons; + }; buildCommand = '' system=$lib/lib/systemd/system - install -Dm444 ${ - service "${ - fcopy_name - }" "file copy (FCOPY)" "/sys/bus/vmbus/devices/eb765408-105f-49b6-b4aa-c123b64d17d4/uio" - } $system/hv-fcopy.service + ${lib.optionalString (fcopy_name != null) '' + install -Dm444 ${ + service fcopy_name "file copy (FCOPY)" + "/sys/bus/vmbus/devices/eb765408-105f-49b6-b4aa-c123b64d17d4/uio" + } $system/hv-fcopy.service + ''} install -Dm444 ${service "kvp" "key-value pair (KVP)" "hv_kvp"} $system/hv-kvp.service install -Dm444 ${service "vss" "volume shadow copy (VSS)" "hv_vss"} $system/hv-vss.service cat > $system/hyperv-daemons.target <