From cf6a986d822fc99e4fde3b82dd8f03aca58482bc Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 3 Oct 2017 15:27:24 +0200 Subject: 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 --- pkgs/games/build-support/build-sandbox/default.nix | 25 +++++++--------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'pkgs/games/build-support/build-sandbox/default.nix') 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" ]) -- cgit 1.4.1