diff options
author | aszlig <aszlig@nix.build> | 2017-11-21 07:06:08 +0100 |
---|---|---|
committer | aszlig <aszlig@nix.build> | 2017-11-21 07:44:50 +0100 |
commit | af83c63ef1926a7571943926fbbd08c6c129d737 (patch) | |
tree | dd3a8158009a0fafe933531e6ce04bb940ad8a84 /pkgs/games/build-support/build-game.nix | |
parent | d7fe5d2fa0909f8cf59fc7cc54dda00fe38a28a6 (diff) |
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 <aszlig@nix.build>
Diffstat (limited to 'pkgs/games/build-support/build-game.nix')
-rw-r--r-- | pkgs/games/build-support/build-game.nix | 18 |
1 files changed, 10 insertions, 8 deletions
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 []; + }; +}) |