aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/games/xsokoban
diff options
context:
space:
mode:
authorMx Kookie <kookie@spacekookie.de>2020-12-21 06:05:12 +0100
committerMx Kookie <kookie@spacekookie.de>2020-12-21 06:05:12 +0100
commitf107be784e6d5da5f90735765a68fdff96acfbb4 (patch)
tree145573a598009fb6adbd5ef7fbce0a850681f5f0 /infra/libkookie/nixpkgs/pkgs/games/xsokoban
parent2e04b35e5ac3a9123cafffbc84494fa4d389cca0 (diff)
parente9158eca70ae59e73fae23be5d13d3fa0cfc78b4 (diff)
Add 'infra/libkookie/nixpkgs/' from commit 'e9158eca70ae59e73fae23be5d13d3fa0cfc78b4'
git-subtree-dir: infra/libkookie/nixpkgs git-subtree-mainline: 2e04b35e5ac3a9123cafffbc84494fa4d389cca0 git-subtree-split: e9158eca70ae59e73fae23be5d13d3fa0cfc78b4
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/games/xsokoban')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/games/xsokoban/default.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/games/xsokoban/default.nix b/infra/libkookie/nixpkgs/pkgs/games/xsokoban/default.nix
new file mode 100644
index 000000000000..3f6062c4f686
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/games/xsokoban/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchurl, libX11, xorgproto, libXpm, libXt }:
+
+stdenv.mkDerivation rec {
+ pname = "xsokoban";
+ version = "3.3c";
+
+ src = fetchurl {
+ url = "https://www.cs.cornell.edu/andru/release/${pname}-${version}.tar.gz";
+ sha256 = "006lp8y22b9pi81x1a9ldfgkl1fbmkdzfw0lqw5y9svmisbafbr9";
+ };
+
+ buildInputs = [ libX11 xorgproto libXpm libXt ];
+
+ NIX_CFLAGS_COMPILE = "-I${libXpm.dev}/include/X11";
+
+ hardeningDisable = [ "format" ];
+
+ prePatch = ''
+ substituteInPlace Makefile.in --replace 4755 0755
+ '';
+
+ preConfigure = ''
+ sed -e 's/getline/my_getline/' -i score.c
+
+ chmod a+rw config.h
+ cat >>config.h <<EOF
+ #define HERE "@nixos-packaged"
+ #define WWW 0
+ #define OWNER "$(whoami)"
+ #define ROOTDIR "$out/lib/xsokoban"
+ #define ANYLEVEL 1
+ #define SCOREFILE ".xsokoban-score"
+ #define LOCKFILE ".xsokoban-score-lock"
+ EOF
+
+ sed -i main.c \
+ -e 's/getpass[(][^)]*[)]/PASSWORD/' \
+ -e '/if [(]owner[)]/iowner=1;'
+ '';
+
+ preBuild = ''
+ sed -i Makefile \
+ -e "s@/usr/local/@$out/@" \
+ -e "s@ /bin/@ @"
+ mkdir -p $out/bin $out/share $out/man/man1 $out/lib
+ '';
+
+ meta = with stdenv.lib; {
+ description = "X sokoban";
+ license = licenses.publicDomain;
+ maintainers = [ maintainers.raskin ];
+ platforms = platforms.linux;
+ };
+}