about summary refs log tree commit diff
path: root/pkgs/games/npush/run.nix
blob: bc4a3b5fda3f201331b6fb410f0235f30f1a3016 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
  ];
}