about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2018-04-29 19:38:24 +0200
committeraszlig <aszlig@nix.build>2018-04-29 19:38:24 +0200
commit9b5a119972e9c2d327500638d89063f4fce243ec (patch)
treee2edb88c951326406deeb2f527444c5dfcd34f70 /pkgs/build-support
parent0c3e4e2626856261da20c741f8664dbe08e5cafc (diff)
pkgs/sandbox: Fix and pass through .desktop files
Since the introduction and move of a few packages to use the sandbox, we
no longer have XDG desktop entries, because the sandbox only creates
wrappers for all programs in $drv/bin.

This now also copies the XDG desktop files and replaces absolute paths
to binaries to refer to the sandboxed binaries.

I also modified the test to go through the XDG desktop file by default
so we can ensure that this works properly.

Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/build-sandbox/default.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkgs/build-support/build-sandbox/default.nix b/pkgs/build-support/build-sandbox/default.nix
index fa4bac57..ba4f3625 100644
--- a/pkgs/build-support/build-sandbox/default.nix
+++ b/pkgs/build-support/build-sandbox/default.nix
@@ -68,6 +68,14 @@ in stdenv.mkDerivation ({
     echo 'return true; }' >> params.c
   '';
 
+  postInstall = ''
+    for df in "$drv/share/applications/"*.desktop; do
+      mkdir -p "$out/share/applications"
+      sed -e 's!'"$drv"'/bin!'"$out"'/bin!g' "$df" \
+        > "$out/share/applications/$(basename "$df")"
+    done
+  '';
+
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ nix ];
   makeFlags = [ "BINDIR=${drv}/bin" ];