Merge pull request #332346 from MatthewCash/fix/hyperv-deamons-fcopy

hyperv-daemons: fix fcopy build and nixfmt-rfc-style

authored by Masum Reza and committed by GitHub 34146ed1 1a51b7b8

+36 -10
+36 -10
pkgs/os-specific/linux/hyperv-daemons/default.nix
··· 1 - { stdenv, lib, python2, python3, kernel, makeWrapper, writeText 2 - , gawk, iproute2 }: 1 + { 2 + stdenv, 3 + lib, 4 + python2, 5 + python3, 6 + kernel, 7 + makeWrapper, 8 + writeText, 9 + gawk, 10 + iproute2, 11 + }: 3 12 4 13 let 5 14 libexec = "libexec/hypervkvpd"; 15 + 16 + fcopy_name = (if lib.versionOlder kernel.version "6.10" then "fcopy" else "fcopy_uio"); 6 17 7 18 daemons = stdenv.mkDerivation rec { 8 19 pname = "hyperv-daemons-bin"; ··· 26 37 installPhase = '' 27 38 runHook preInstall 28 39 29 - for f in fcopy kvp vss ; do 40 + for f in ${fcopy_name} kvp vss ; do 30 41 install -Dm755 hv_''${f}_daemon -t $out/bin 31 42 done 32 43 ··· 39 50 40 51 postFixup = '' 41 52 wrapProgram $out/bin/hv_kvp_daemon \ 42 - --prefix PATH : $out/bin:${lib.makeBinPath [ gawk iproute2 ]} 53 + --prefix PATH : $out/bin:${ 54 + lib.makeBinPath [ 55 + gawk 56 + iproute2 57 + ] 58 + } 43 59 ''; 44 60 }; 45 61 46 - service = bin: title: check: 62 + service = 63 + bin: title: check: 47 64 writeText "hv-${bin}.service" '' 48 65 [Unit] 49 66 Description=Hyper-V ${title} daemon ··· 61 78 WantedBy=hyperv-daemons.target 62 79 ''; 63 80 64 - in stdenv.mkDerivation { 81 + in 82 + stdenv.mkDerivation { 65 83 pname = "hyperv-daemons"; 66 84 inherit (kernel) version; 67 85 68 86 # we just stick the bins into out as well as it requires "out" 69 - outputs = [ "bin" "lib" "out" ]; 87 + outputs = [ 88 + "bin" 89 + "lib" 90 + "out" 91 + ]; 70 92 71 93 buildInputs = [ daemons ]; 72 94 73 95 buildCommand = '' 74 96 system=$lib/lib/systemd/system 75 97 76 - install -Dm444 ${service "fcopy" "file copy (FCOPY)" "hv_fcopy" } $system/hv-fcopy.service 77 - install -Dm444 ${service "kvp" "key-value pair (KVP)" "hv_kvp" } $system/hv-kvp.service 78 - install -Dm444 ${service "vss" "volume shadow copy (VSS)" "hv_vss" } $system/hv-vss.service 98 + install -Dm444 ${ 99 + service "${ 100 + fcopy_name 101 + }" "file copy (FCOPY)" "/sys/bus/vmbus/devices/eb765408-105f-49b6-b4aa-c123b64d17d4/uio" 102 + } $system/hv-fcopy.service 103 + install -Dm444 ${service "kvp" "key-value pair (KVP)" "hv_kvp"} $system/hv-kvp.service 104 + install -Dm444 ${service "vss" "volume shadow copy (VSS)" "hv_vss"} $system/hv-vss.service 79 105 80 106 cat > $system/hyperv-daemons.target <<EOF 81 107 [Unit]