about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/build-support/build-sandbox/default.nix30
1 files changed, 5 insertions, 25 deletions
diff --git a/pkgs/build-support/build-sandbox/default.nix b/pkgs/build-support/build-sandbox/default.nix
index 4e5cffe9..0e1d4a4d 100644
--- a/pkgs/build-support/build-sandbox/default.nix
+++ b/pkgs/build-support/build-sandbox/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, pkgconfig, nix, boost, dash }:
+{ stdenv, lib, pkgconfig, closureInfo, nix, boost, dash }:
 
 drv: { paths ? {}, ... }@attrs:
 
@@ -30,31 +30,11 @@ in stdenv.mkDerivation ({
 
   inherit drv;
 
-  # writes files "sandbox-*" to the builder (see nix manual)
-  exportReferencesGraph =
-    [ "sandbox-closure" drv ] ++
-    lib.optionals allowBinSh [ "sandbox-binsh" dash ];
+  closureInfo = closureInfo {
+    rootPaths = lib.singleton drv ++ lib.optional allowBinSh dash;
+  };
 
   configurePhase = ''
-    # Reads the dependency closures and does … something? TODO: explain
-    runtimeDeps="$(sed -ne '
-      p; n; n
-
-      :cdown
-      /^0*$/b
-      :l; s/0\(X*\)$/X\1/; tl
-
-      s/^\(X*\)$/9\1/; tdone
-      ${lib.concatMapStrings (num: ''
-        s/${toString num}\(X*\)$/${toString (num - 1)}\1/; tdone
-      '') (lib.range 1 9)}
-
-      :done
-      y/X/9/
-      x; n; p; x
-      bcdown
-    ' ../sandbox-* | sort -u)"
-
     echo '#include "setup.h"' > params.c
     echo 'bool setup_app_paths(void) {' >> params.c
 
@@ -66,7 +46,7 @@ in stdenv.mkDerivation ({
         >> params.c
 
     '' else ''
-      for dep in $runtimeDeps; do
+      for dep in $(< "$closureInfo/store-paths"); do
         echo 'if (!bind_mount("'"$dep"'", true, true, true)) return false;' \
           >> params.c
       done