|
12 | 12 | let |
13 | 13 | libexec = "libexec/hypervkvpd"; |
14 | 14 |
|
15 | | - fcopy_name = (if lib.versionOlder kernel.version "6.10" then "fcopy" else "fcopy_uio"); |
| 15 | + fcopy_name = |
| 16 | + if lib.versionOlder kernel.version "6.10" then |
| 17 | + "fcopy" |
| 18 | + else |
| 19 | + # The fcopy program is explicitly left out in the Makefile on aarch64 |
| 20 | + (if stdenv.hostPlatform.isAarch64 then null else "fcopy_uio"); |
16 | 21 |
|
17 | 22 | daemons = stdenv.mkDerivation rec { |
18 | 23 | pname = "hyperv-daemons-bin"; |
|
21 | 26 | nativeBuildInputs = [ makeWrapper ]; |
22 | 27 | buildInputs = [ python3 ]; |
23 | 28 |
|
24 | | - # as of 4.9 compilation will fail due to -Werror=format-security |
25 | | - hardeningDisable = [ "format" ]; |
26 | | - |
27 | 29 | postPatch = '' |
28 | 30 | cd tools/hv |
29 | 31 | substituteInPlace hv_kvp_daemon.c \ |
30 | 32 | --replace /usr/libexec/hypervkvpd/ $out/${libexec}/ |
31 | 33 | ''; |
32 | 34 |
|
33 | | - # We don't actually need the hv_get_{dhcp,dns}_info scripts on NixOS in |
34 | | - # their current incarnation but with them in place, we stop the spam of |
35 | | - # errors in the log. |
36 | | - installPhase = '' |
37 | | - runHook preInstall |
38 | | -
|
39 | | - for f in ${fcopy_name} kvp vss ; do |
40 | | - install -Dm755 hv_''${f}_daemon -t $out/bin |
41 | | - done |
42 | | -
|
43 | | - install -Dm755 lsvmbus $out/bin/lsvmbus |
44 | | - install -Dm755 hv_get_dhcp_info.sh $out/${libexec}/hv_get_dhcp_info |
45 | | - install -Dm755 hv_get_dns_info.sh $out/${libexec}/hv_get_dns_info |
46 | | -
|
47 | | - runHook postInstall |
48 | | - ''; |
| 35 | + makeFlags = [ |
| 36 | + "ARCH=${stdenv.hostPlatform.parsed.cpu.name}" |
| 37 | + "DESTDIR=$(out)" |
| 38 | + "sbindir=/bin" |
| 39 | + "libexecdir=/libexec" |
| 40 | + ]; |
49 | 41 |
|
50 | 42 | postFixup = '' |
51 | 43 | wrapProgram $out/bin/hv_kvp_daemon \ |
@@ -90,22 +82,29 @@ stdenv.mkDerivation { |
90 | 82 | ]; |
91 | 83 |
|
92 | 84 | buildInputs = [ daemons ]; |
| 85 | + passthru = { |
| 86 | + inherit daemons; |
| 87 | + }; |
93 | 88 |
|
94 | 89 | buildCommand = '' |
95 | 90 | system=$lib/lib/systemd/system |
96 | 91 |
|
97 | | - install -Dm444 ${ |
98 | | - service "${ |
99 | | - fcopy_name |
100 | | - }" "file copy (FCOPY)" "/sys/bus/vmbus/devices/eb765408-105f-49b6-b4aa-c123b64d17d4/uio" |
101 | | - } $system/hv-fcopy.service |
| 92 | + ${lib.optionalString (fcopy_name != null) '' |
| 93 | + install -Dm444 ${ |
| 94 | + service fcopy_name "file copy (FCOPY)" |
| 95 | + "/sys/bus/vmbus/devices/eb765408-105f-49b6-b4aa-c123b64d17d4/uio" |
| 96 | + } $system/hv-fcopy.service |
| 97 | + ''} |
102 | 98 | install -Dm444 ${service "kvp" "key-value pair (KVP)" "hv_kvp"} $system/hv-kvp.service |
103 | 99 | install -Dm444 ${service "vss" "volume shadow copy (VSS)" "hv_vss"} $system/hv-vss.service |
104 | 100 |
|
105 | 101 | cat > $system/hyperv-daemons.target <<EOF |
106 | 102 | [Unit] |
107 | 103 | Description=Hyper-V Daemons |
108 | | - Wants=hv-fcopy.service hv-kvp.service hv-vss.service |
| 104 | + Wants=hv-kvp.service hv-vss.service |
| 105 | + ${lib.optionalString (fcopy_name != null) '' |
| 106 | + Wants=hv-fcopy.service |
| 107 | + ''} |
109 | 108 | EOF |
110 | 109 |
|
111 | 110 | for f in $lib/lib/systemd/system/*.service ; do |
|
0 commit comments