about summary refs log tree commit diff
path: root/pkgs/tools/virtualization
diff options
context:
space:
mode:
authorAlyssa Ross <alyssa.ross@unikie.com>2022-12-01 08:37:13 +0000
committerAlyssa Ross <alyssa.ross@unikie.com>2022-12-01 08:49:18 +0000
commitad3c91ce355c5a650dedc60f341f697f85363c18 (patch)
tree53e76714e4f42553d548fdd794a133beb13491e9 /pkgs/tools/virtualization
parent12c758b069c13d59ce5336b61ebfed687c641901 (diff)
guestfs-tools: fix virt-builder lookup path
virt-builder --list would be empty, because it would look in
/etc/.virt-builder-wrapped.  Instead, we want it to look in
$out/etc/virt-builder, where the data is actually installed (while
still allowing user-provided overrides to be placed in /etc).
Diffstat (limited to 'pkgs/tools/virtualization')
-rw-r--r--pkgs/tools/virtualization/guestfs-tools/default.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/tools/virtualization/guestfs-tools/default.nix b/pkgs/tools/virtualization/guestfs-tools/default.nix
index 446d4bcde0b7e..82b657673ff08 100644
--- a/pkgs/tools/virtualization/guestfs-tools/default.nix
+++ b/pkgs/tools/virtualization/guestfs-tools/default.nix
@@ -70,6 +70,14 @@ stdenv.mkDerivation rec {
     xz
   ];
 
+  postPatch = ''
+    # If it uses the executable name, then there's nothing we can do
+    # when wrapping to stop it looking in
+    # $out/etc/.virt-builder-wrapped, which won't exist.
+    substituteInPlace common/mlstdutils/std_utils.ml \
+        --replace Sys.executable_name '(Array.get Sys.argv 0)'
+  '';
+
   preConfigure = ''
     patchShebangs ocaml-dep.sh.in ocaml-link.sh.in run.in
   '';
@@ -85,6 +93,9 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
 
   postInstall = ''
+    wrapProgram $out/bin/virt-builder \
+      --argv0 virt-builder \
+      --suffix VIRT_BUILDER_DIRS : /etc:$out/etc
     wrapProgram $out/bin/virt-win-reg \
       --prefix PERL5LIB : ${with perlPackages; makeFullPerlPath [ hivex libintl-perl libguestfs-with-appliance ]}
   '';