summary refs log tree commit diff
path: root/pkgs/os-specific/linux/hyperv-daemons
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2018-05-28 13:50:05 +0800
committerPeter Hoeg <peter@hoeg.com>2019-09-24 11:10:16 +0800
commita5872e8bde58efe529357260a083933fcac6ac39 (patch)
tree6ebc5741e8441c09aa2a62954258f39196e444a3 /pkgs/os-specific/linux/hyperv-daemons
parent67202a95bafe821402b6b0c6486059faf2a0b2cb (diff)
downloadnixpkgs-a5872e8bde58efe529357260a083933fcac6ac39.tar
nixpkgs-a5872e8bde58efe529357260a083933fcac6ac39.tar.gz
nixpkgs-a5872e8bde58efe529357260a083933fcac6ac39.tar.bz2
nixpkgs-a5872e8bde58efe529357260a083933fcac6ac39.tar.lz
nixpkgs-a5872e8bde58efe529357260a083933fcac6ac39.tar.xz
nixpkgs-a5872e8bde58efe529357260a083933fcac6ac39.tar.zst
nixpkgs-a5872e8bde58efe529357260a083933fcac6ac39.zip
hyperv-daemons: fix binary location to stop error log spam
Diffstat (limited to 'pkgs/os-specific/linux/hyperv-daemons')
-rw-r--r--pkgs/os-specific/linux/hyperv-daemons/default.nix37
1 files changed, 21 insertions, 16 deletions
diff --git a/pkgs/os-specific/linux/hyperv-daemons/default.nix b/pkgs/os-specific/linux/hyperv-daemons/default.nix
index a209f1ab4bb..1a111a295a4 100644
--- a/pkgs/os-specific/linux/hyperv-daemons/default.nix
+++ b/pkgs/os-specific/linux/hyperv-daemons/default.nix
@@ -1,7 +1,10 @@
-{ stdenv, lib, python, kernel, makeWrapper, writeText }:
+{ stdenv, lib, python, kernel, makeWrapper, writeText
+, gawk, iproute }:
 
 let
-  daemons = stdenv.mkDerivation {
+  libexec = "libexec/hypervkvpd";
+
+  daemons = stdenv.mkDerivation rec {
     pname = "hyperv-daemons-bin";
     inherit (kernel) src version;
 
@@ -10,10 +13,15 @@ let
     # as of 4.9 compilation will fail due to -Werror=format-security
     hardeningDisable = [ "format" ];
 
-    preConfigure = ''
+    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
 
@@ -21,7 +29,9 @@ let
         install -Dm755 hv_''${f}_daemon -t $out/bin
       done
 
-      install -Dm755 hv_get_dns_info.sh lsvmbus -t $out/bin
+      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
 
       # I don't know why this isn't being handled automatically by fixupPhase
       substituteInPlace $out/bin/lsvmbus \
@@ -31,8 +41,8 @@ let
     '';
 
     postFixup = ''
-      # kvp needs to be able to find the script(s)
-      wrapProgram $out/bin/hv_kvp_daemon --prefix PATH : $out/bin
+      wrapProgram $out/bin/hv_kvp_daemon \
+        --prefix PATH : $out/bin:${lib.makeBinPath [ gawk iproute ]}
     '';
   };
 
@@ -56,24 +66,19 @@ let
 
 in stdenv.mkDerivation {
   pname = "hyperv-daemons";
-
   inherit (kernel) version;
 
   # we just stick the bins into out as well as it requires "out"
   outputs = [ "bin" "lib" "out" ];
 
-  phases = [ "installPhase" ];
-
   buildInputs = [ daemons ];
 
-  installPhase = ''
+  buildCommand = ''
     system=$lib/lib/systemd/system
 
-    mkdir -p $system
-
-    cp ${service "fcopy" "file copy (FCOPY)" "hv_fcopy" } $system/hv-fcopy.service
-    cp ${service "kvp"   "key-value pair (KVP)"     ""  } $system/hv-kvp.service
-    cp ${service "vss"   "volume shadow copy (VSS)" ""  } $system/hv-vss.service
+    install -Dm444 ${service "fcopy" "file copy (FCOPY)" "hv_fcopy" } $system/hv-fcopy.service
+    install -Dm444 ${service "kvp"   "key-value pair (KVP)"     ""  } $system/hv-kvp.service
+    install -Dm444 ${service "vss"   "volume shadow copy (VSS)" ""  } $system/hv-vss.service
 
     cat > $system/hyperv-daemons.target <<EOF
     [Unit]
@@ -102,7 +107,7 @@ in stdenv.mkDerivation {
       Microsoft calls their guest agents "Integration Services" which is why
       we use that name here.
     '';
-    homepage = https://kernel.org;
+    homepage = "https://kernel.org";
     maintainers = with maintainers; [ peterhoeg ];
     platforms = kernel.meta.platforms;
   };