about summary refs log tree commit diff
path: root/pkgs/games/wipeout-rewrite
diff options
context:
space:
mode:
authorOPNA2608 <christoph.neidahl@gmail.com>2023-08-13 15:28:06 +0200
committerAnderson Torres <torres.anderson.85@protonmail.com>2023-09-09 15:03:02 +0000
commit154ba6c2430db3c1dc5cfeea71a179d660ce5fcd (patch)
tree82a7f2638afb988afc9b236eec2280bdcc031dca /pkgs/games/wipeout-rewrite
parent21eefc0c426c20990955884e49db5f72c102ff49 (diff)
wipeout-rewrite: init at unstable-2023-08-13
Diffstat (limited to 'pkgs/games/wipeout-rewrite')
-rw-r--r--pkgs/games/wipeout-rewrite/default.nix71
1 files changed, 71 insertions, 0 deletions
diff --git a/pkgs/games/wipeout-rewrite/default.nix b/pkgs/games/wipeout-rewrite/default.nix
new file mode 100644
index 0000000000000..16703fad517b2
--- /dev/null
+++ b/pkgs/games/wipeout-rewrite/default.nix
@@ -0,0 +1,71 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, makeWrapper
+, Foundation
+, glew
+, SDL2
+, writeShellScript
+}:
+
+let
+  datadir = "\"\${XDG_DATA_HOME:-$HOME/.local/share}\"/wipeout-rewrite";
+  datadirCheck = writeShellScript "wipeout-rewrite-check-datadir.sh" ''
+    datadir=${datadir}
+
+    if [ ! -d "$datadir" ]; then
+      echo "[Wrapper] Creating data directory $datadir"
+      mkdir -p "$datadir"
+    fi
+
+    echo "[Wrapper] Remember to put your game assets into $datadir/wipeout if you haven't done so yet!"
+    echo "[Wrapper] Check https://github.com/phoboslab/wipeout-rewrite#running for the required format."
+  '';
+in
+stdenv.mkDerivation (finalAttrs: {
+  pname = "wipeout-rewrite";
+  version = "unstable-2023-08-13";
+
+  src = fetchFromGitHub {
+    owner = "phoboslab";
+    repo = "wipeout-rewrite";
+    rev = "7a9f757a79d5c6806252cc1268bda5cdef463e23";
+    hash = "sha256-21IG9mZPGgRhVkT087G+Bz/zLkknkHKGmWjSpcLw8vE=";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [
+    makeWrapper
+  ];
+
+  buildInputs = [
+    glew
+    SDL2
+  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
+    Foundation
+  ];
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm755 wipegame $out/bin/wipegame
+
+    # I can't get --chdir to not expand the bash variables in datadir at build time (so they point to /homeless-shelter)
+    # or put them inside single quotes (breaking the expansion at runtime)
+    wrapProgram $out/bin/wipegame \
+      --run '${datadirCheck}' \
+      --run 'cd ${datadir}'
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    mainProgram = "wipegame";
+    description = "A re-implementation of the 1995 PSX game wipEout";
+    homepage = "https://github.com/phoboslab/wipeout-rewrite";
+    license = licenses.unfree;
+    maintainers = with maintainers; [ OPNA2608 ];
+    platforms = platforms.all;
+  };
+})