about summary refs log tree commit diff
path: root/pkgs/by-name/xe
diff options
context:
space:
mode:
authorFernando Rodrigues2024-08-18 16:59:15 +0000
committerAlyssa Ross2024-08-19 08:16:37 +0200
commitbd4c69da51be8319f0b7fe25e98abab5b6a30fa9 (patch)
tree6d38c968e5feeaa8286bfcc49fcf88a6e270ebe9 /pkgs/by-name/xe
parent1d11eba657623a14e752975539d2a69b1d5039ff (diff)
xen-guest-agent: install systemd service
Upstream provides a minimal systemd service that initialises the
xen-guest-agent binary. This will be useful for anyone who makes a NixOS
module for this package.

Also adds a comment to postFixup.

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
Diffstat (limited to 'pkgs/by-name/xe')
-rw-r--r--pkgs/by-name/xe/xen-guest-agent/package.nix14
1 files changed, 11 insertions, 3 deletions
diff --git a/pkgs/by-name/xe/xen-guest-agent/package.nix b/pkgs/by-name/xe/xen-guest-agent/package.nix
index 55ecf68429e3..9375b0d47656 100644
--- a/pkgs/by-name/xe/xen-guest-agent/package.nix
+++ b/pkgs/by-name/xe/xen-guest-agent/package.nix
@@ -27,10 +27,18 @@ rustPlatform.buildRustPackage rec {
 
   buildInputs = [ xen-slim ];
 
+  postInstall =
+    # Install the sample systemd service.
+    ''
+      mkdir --parents $out/lib/systemd/system
+      cp $src/startup/xen-guest-agent.service $out/lib/systemd/system
+      substituteInPlace $out/lib/systemd/system/xen-guest-agent.service \
+        --replace-fail "/usr/sbin/xen-guest-agent" "$out/bin/xen-guest-agent"
+    '';
 
-  postFixup = ''
-    patchelf $out/bin/xen-guest-agent --add-rpath ${xen-slim.out}/lib
-  '';
+  postFixup =
+    # Add the Xen libraries in the runpath so the guest agent can find libxenstore.
+    "patchelf $out/bin/xen-guest-agent --add-rpath ${xen-slim.out}/lib";
 
   meta = {
     description = "Xen agent running in Linux/BSDs (POSIX) VMs";