about summary refs log tree commit diff
path: root/nixpkgs/pkgs/games/npush/run.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/games/npush/run.nix')
-rw-r--r--nixpkgs/pkgs/games/npush/run.nix31
1 files changed, 31 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/games/npush/run.nix b/nixpkgs/pkgs/games/npush/run.nix
new file mode 100644
index 000000000000..bc4a3b5fda3f
--- /dev/null
+++ b/nixpkgs/pkgs/games/npush/run.nix
@@ -0,0 +1,31 @@
+{ runtimeShell
+, symlinkJoin
+, writeShellScriptBin
+, npush
+}:
+
+let
+  runScript = writeShellScriptBin "run-npush" ''
+    set -euo pipefail
+    CWD=$(pwd)
+
+    if [ -d "./levels" ]; then
+      echo "Directory ./levels found; skipping levelset copy"
+    else
+      echo "Directory ./levels not found; copying the official levelset to the current directory"
+      mkdir -p ./levels
+      cp ${npush}/share/npush/levels/* levels/
+      chmod 644 levels/*
+    fi
+    echo "Now calling npush"
+    exec "${npush}/bin/npush"
+  '';
+in
+symlinkJoin {
+  name = "run-npush-${npush.version}";
+
+  paths = [
+    npush
+    runScript
+  ];
+}