about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/games/the-powder-toy/default.nix34
-rw-r--r--pkgs/games/the-powder-toy/fix-env.patch16
-rw-r--r--pkgs/top-level/all-packages.nix6
3 files changed, 55 insertions, 1 deletions
diff --git a/pkgs/games/the-powder-toy/default.nix b/pkgs/games/the-powder-toy/default.nix
new file mode 100644
index 000000000000..43d453f71d73
--- /dev/null
+++ b/pkgs/games/the-powder-toy/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub, scons, pkgconfig, SDL, lua, fftwFloat }:
+
+let version = "90.2.322";
+in
+stdenv.mkDerivation rec {
+  name = "the-powder-toy-${version}";
+  src = fetchFromGitHub {
+    owner = "simtr";
+    repo = "The-Powder-Toy";
+    rev = "v${version}";
+    sha256 = "1rlxnk8icymalnr3j4bgpklq1dhhs0rpsyjx97isqqcwm2ys03q3";
+  };
+
+  patches = [ ./fix-env.patch ];
+
+  nativeBuildInputs = [ scons pkgconfig ];
+
+  buildInputs = [ SDL lua fftwFloat ];
+
+  buildPhase = "scons DESTDIR=$out/bin --tool='' -j$NIX_BUILD_CORES";
+
+  installPhase = ''
+    install -Dm 755 build/powder* "$out/bin/powder"
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A free 2D physics sandbox game";
+    platforms = platforms.unix;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/pkgs/games/the-powder-toy/fix-env.patch b/pkgs/games/the-powder-toy/fix-env.patch
new file mode 100644
index 000000000000..79d2bb2a2e07
--- /dev/null
+++ b/pkgs/games/the-powder-toy/fix-env.patch
@@ -0,0 +1,16 @@
+diff --git a/SConscript b/SConscript
+index fd08935..4d879b2 100644
+--- a/SConscript
++++ b/SConscript
+@@ -93,9 +93,9 @@ if msvc and platform != "Windows":
+ 

+ #Create SCons Environment

+ if platform == "Windows" and not GetOption('msvc'):

+-	env = Environment(tools = ['mingw'], ENV = {'PATH' : os.environ['PATH']})

++	env = Environment(tools = ['mingw'], ENV = os.environ)

+ else:

+-	env = Environment(tools = ['default'], ENV = {'PATH' : os.environ['PATH']})

++	env = Environment(tools = ['default'], ENV = os.environ)

+ 

+ #attempt to automatically find cross compiler

+ if not tool and compilePlatform == "Linux" and compilePlatform != platform:

diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 30ee876eed16..99d281df6840 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -12828,7 +12828,11 @@ let
 
   synthv1 = callPackage ../applications/audio/synthv1 { };
 
-  tbe = callPackage ../games/the-butterfly-effect {};
+  the-powder-toy = callPackage ../games/the-powder-toy {
+    lua = lua5_1;
+  };
+
+  tbe = callPackage ../games/the-butterfly-effect { };
 
   teetertorture = callPackage ../games/teetertorture { };