about summary refs log tree commit diff
path: root/pkgs/games/build-support/build-sandbox/default.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2017-10-03 15:27:24 +0200
committeraszlig <aszlig@redmoonstudios.org>2017-10-03 23:41:31 +0200
commitcf6a986d822fc99e4fde3b82dd8f03aca58482bc (patch)
tree84fd38721d5f7e89dd705cb276ec3619879a9cd3 /pkgs/games/build-support/build-sandbox/default.nix
parentc82d21271656400f5e87e0baf46e61224fe1aaa9 (diff)
pkgs/sandbox: Prepare for querying runtime paths
We're now using a makefile for building the sandbox and use pkg-config
to pass in the flags we need for compiling against lib(nix)store.

Right now the sandbox itself doesn't do anything different because we're
not actually using the (incomplete) code for querying the store.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/games/build-support/build-sandbox/default.nix')
-rw-r--r--pkgs/games/build-support/build-sandbox/default.nix25
1 files changed, 8 insertions, 17 deletions
diff --git a/pkgs/games/build-support/build-sandbox/default.nix b/pkgs/games/build-support/build-sandbox/default.nix
index 2b45f3e5..3bb41093 100644
--- a/pkgs/games/build-support/build-sandbox/default.nix
+++ b/pkgs/games/build-support/build-sandbox/default.nix
@@ -1,17 +1,17 @@
-{ stdenv, lib }:
+{ stdenv, lib, pkgconfig, nix }:
 
 drv: { extraSandboxPaths ? [], ... }@attrs:
 
 stdenv.mkDerivation ({
   name = "${drv.name}-sandboxed";
 
-  src = drv;
+  src = ./src;
 
-  phases = [ "buildPhase" "installPhase" ];
+  inherit drv;
 
   exportReferencesGraph = [ "sandbox-closure" drv ];
 
-  buildPhase = ''
+  configurePhase = ''
     runtimeDeps="$(sed -ne '
       p; n; n
 
@@ -28,7 +28,7 @@ stdenv.mkDerivation ({
       y/X/9/
       x; n; p; x
       bcdown
-    ' sandbox-closure | sort -u)"
+    ' ../sandbox-closure | sort -u)"
 
     echo 'static bool setup_app_paths(void) {' > params.c
 
@@ -45,17 +45,8 @@ stdenv.mkDerivation ({
     cat params.c
   '';
 
-  installPhase = ''
-    mkdir -p "$out/bin"
-    for bin in "$src"/bin/*; do
-      progname="$(basename "$bin")"
-      gcc -g -std=gnu11 -Wall \
-        -DWRAPPED_PATH=\""$bin"\" \
-        -DWRAPPED_PROGNAME=\""$progname"\" \
-        -DPARAMS_FILE=\""$(pwd)/params.c"\" \
-        -DFS_ROOT_DIR=\""$out"\" \
-        -o "$out/bin/$progname" ${./sandbox.c}
-    done
-  '';
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ nix ];
+  makeFlags = [ "BINDIR=${drv}/bin" ];
 
 } // removeAttrs attrs [ "extraSandboxPaths" ])