From af83c63ef1926a7571943926fbbd08c6c129d737 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 21 Nov 2017 07:06:08 +0100 Subject: pkgs/sandbox: Handle non-existing paths We now distinguish between paths that have to exist and paths that are fine to skip during bind mounting. So far we had hard failures whenever a path that needed to be mounted didn't exist, for example something like $XDG_CONFIG_HOME/unity3d failed whenever the directory didn't exist. Apart from that we now have a more clean attribute structure for sandbox parameters, which are now: * paths.required: Created prior to bind-mounting * paths.wanted: Skipped if it doesn't exist * paths.runtimeVars: Extracted from PATH-like environment variables Signed-off-by: aszlig --- pkgs/games/build-support/build-game.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'pkgs/games/build-support/build-game.nix') diff --git a/pkgs/games/build-support/build-game.nix b/pkgs/games/build-support/build-game.nix index 51d3c7d5..b04309a5 100644 --- a/pkgs/games/build-support/build-game.nix +++ b/pkgs/games/build-support/build-game.nix @@ -12,8 +12,7 @@ assert withPulseAudio -> libpulseaudio != null; , setSourceRoot ? "" , installCheckPhase ? "" , runtimeDependencies ? [] -, extraSandboxPaths ? [ "$XDG_DATA_HOME" "$XDG_CONFIG_HOME" ] -, extraRuntimePathVars ? [] +, sandbox ? {} , ... }@attrs: @@ -73,9 +72,12 @@ buildSandbox (stdenv.mkDerivation ({ dontPatchELF = true; } // removeAttrs attrs [ "buildInputs" "nativeBuildInputs" "preUnpack" "setSourceRoot" - "installCheckPhase" "runtimeDependencies" "extraSandboxPaths" - "extraRuntimePathVars" -])) { - inherit extraSandboxPaths; - runtimePathVars = lib.singleton "LD_LIBRARY_PATH" ++ extraRuntimePathVars; -} + "installCheckPhase" "runtimeDependencies" "sandbox" +])) (sandbox // { + paths = let + paths = sandbox.paths or {}; + in paths // { + required = paths.required or [ "$XDG_DATA_HOME" "$XDG_CONFIG_HOME" ]; + runtimeVars = [ "LD_LIBRARY_PATH" ] ++ paths.runtimeVars or []; + }; +}) -- cgit 1.4.1