about summary refs log tree commit diff
path: root/pkgs/games/build-support
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2017-10-03 21:47:02 +0200
committeraszlig <aszlig@redmoonstudios.org>2017-10-03 23:41:39 +0200
commitb7e0a4c55944b266f2a6c2aa65d093eb31dcc3ad (patch)
tree7d0157f09c5c13ca30ab887c8039ff6909d1bad3 /pkgs/games/build-support
parent0bf66bd8d1a1db8c512c66069731bf67a9836a44 (diff)
pkgs/build-game: Enable sandbox by default
This is using buildSandbox with the addition of adding LD_LIBRARY_PATH
to the default runtimePathVars. I've also renamed the attribute to be
called runtimePathVars instead of runtimePathVariables, simply because
it's shorter.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/games/build-support')
-rw-r--r--pkgs/games/build-support/build-game.nix11
-rw-r--r--pkgs/games/build-support/build-sandbox/default.nix6
-rw-r--r--pkgs/games/build-support/build-unity.nix2
3 files changed, 13 insertions, 6 deletions
diff --git a/pkgs/games/build-support/build-game.nix b/pkgs/games/build-support/build-game.nix
index f23ddd9a..51d3c7d5 100644
--- a/pkgs/games/build-support/build-game.nix
+++ b/pkgs/games/build-support/build-game.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, file, unzip
+{ stdenv, lib, file, unzip, buildSandbox
 
 , withPulseAudio ? true, libpulseaudio ? null
 , alsaLib
@@ -13,10 +13,11 @@ assert withPulseAudio -> libpulseaudio != null;
 , installCheckPhase ? ""
 , runtimeDependencies ? []
 , extraSandboxPaths ? [ "$XDG_DATA_HOME" "$XDG_CONFIG_HOME" ]
+, extraRuntimePathVars ? []
 , ...
 }@attrs:
 
-stdenv.mkDerivation ({
+buildSandbox (stdenv.mkDerivation ({
   buildInputs = [ stdenv.cc.cc ] ++ buildInputs;
 
   nativeBuildInputs = [
@@ -73,4 +74,8 @@ stdenv.mkDerivation ({
 } // removeAttrs attrs [
   "buildInputs" "nativeBuildInputs" "preUnpack" "setSourceRoot"
   "installCheckPhase" "runtimeDependencies" "extraSandboxPaths"
-])
+  "extraRuntimePathVars"
+])) {
+  inherit extraSandboxPaths;
+  runtimePathVars = lib.singleton "LD_LIBRARY_PATH" ++ extraRuntimePathVars;
+}
diff --git a/pkgs/games/build-support/build-sandbox/default.nix b/pkgs/games/build-support/build-sandbox/default.nix
index e7243d2c..e4826405 100644
--- a/pkgs/games/build-support/build-sandbox/default.nix
+++ b/pkgs/games/build-support/build-sandbox/default.nix
@@ -1,6 +1,6 @@
 { stdenv, lib, pkgconfig, nix }:
 
-drv: { extraSandboxPaths ? [], runtimePathVariables ? [], ... }@attrs:
+drv: { extraSandboxPaths ? [], runtimePathVars ? [], ... }@attrs:
 
 stdenv.mkDerivation ({
   name = "${drv.name}-sandboxed";
@@ -50,7 +50,7 @@ stdenv.mkDerivation ({
       escaped = lib.escapeShellArg (lib.escape ["\\" "\""] pathvar);
       fun = "mount_from_path_var";
       result = "echo 'if (!${fun}(qs, \"'${escaped}'\")) return false;'";
-    in "${result} >> params.c") runtimePathVariables}
+    in "${result} >> params.c") runtimePathVars}
 
     echo 'return true; }' >> params.c
   '';
@@ -59,4 +59,4 @@ stdenv.mkDerivation ({
   buildInputs = [ nix ];
   makeFlags = [ "BINDIR=${drv}/bin" ];
 
-} // removeAttrs attrs [ "extraSandboxPaths" "runtimePathVariables" ])
+} // removeAttrs attrs [ "extraSandboxPaths" "runtimePathVars" ])
diff --git a/pkgs/games/build-support/build-unity.nix b/pkgs/games/build-support/build-unity.nix
index bdca83eb..596c65be 100644
--- a/pkgs/games/build-support/build-unity.nix
+++ b/pkgs/games/build-support/build-unity.nix
@@ -27,6 +27,8 @@ in buildGame ({
     mesa xorg.libX11 xorg.libXcursor xorg.libXrandr libudev zlib
   ];
 
+  extraSandboxPaths = [ "$XDG_CONFIG_HOME/unity3d" ];
+
   installPhase = ''
     runHook preInstall