about summary refs log tree commit diff
path: root/nixpkgs/pkgs/games/abuse
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-02-16 18:32:21 +0000
committerAlyssa Ross <hi@alyssa.is>2021-02-16 18:32:21 +0000
commit9becdcc5df71b47a5da84ad670e9a7eae9e0c65a (patch)
tree2ddf0335eb393f89501e3753b50c3f7ab0552d12 /nixpkgs/pkgs/games/abuse
parent49f2a77ac9abc88c253f68952eda26557fc3b555 (diff)
parentff96a0fa5635770390b184ae74debea75c3fd534 (diff)
downloadnixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar
nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.gz
nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.bz2
nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.lz
nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.xz
nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.zst
nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.zip
nixpkgs: merge nixos-unstable
Diffstat (limited to 'nixpkgs/pkgs/games/abuse')
-rw-r--r--nixpkgs/pkgs/games/abuse/abuse.sh18
-rw-r--r--nixpkgs/pkgs/games/abuse/default.nix54
2 files changed, 72 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/games/abuse/abuse.sh b/nixpkgs/pkgs/games/abuse/abuse.sh
new file mode 100644
index 000000000000..de837d27181f
--- /dev/null
+++ b/nixpkgs/pkgs/games/abuse/abuse.sh
@@ -0,0 +1,18 @@
+#! @shell@
+
+if grep datadir ~/.abuse/abuserc &>/dev/null; then
+  if [ ! -d "$(grep datadir ~/.abuse/abuserc | cut -d= -f2)" ]; then
+    echo "Warning: ~/.abuse/abuserc references a datadir which is not existent." >&2
+    echo "Try removing ~/.abuse/abuserc, else abuse will most likely not run." >&2
+    echo >&2
+    # This can happen if the build hash of abuse changes and the older version
+    # is garbage-collected. The correct path of the datadir is compiled into
+    # the binary, but unfortunately abuse writes out the path into abuserc on
+    # first start. This entry may later become stale.
+  fi
+fi
+
+# The timidity bundled into SDL_mixer looks in . and in several global places
+# like /etc for its configuration file.
+cd @out@/etc
+exec @out@/bin/.abuse-bin "$@"
diff --git a/nixpkgs/pkgs/games/abuse/default.nix b/nixpkgs/pkgs/games/abuse/default.nix
new file mode 100644
index 000000000000..2e863022a68b
--- /dev/null
+++ b/nixpkgs/pkgs/games/abuse/default.nix
@@ -0,0 +1,54 @@
+{ lib, stdenv, fetchurl, makeDesktopItem, copyDesktopItems, SDL, SDL_mixer, freepats }:
+
+stdenv.mkDerivation rec {
+  pname   = "abuse";
+  version = "0.8";
+
+  src = fetchurl {
+    url    = "http://abuse.zoy.org/raw-attachment/wiki/download/${pname}-${version}.tar.gz";
+    sha256 = "0104db5fd2695c9518583783f7aaa7e5c0355e27c5a803840a05aef97f9d3488";
+  };
+
+  configureFlags = [
+    "--with-x"
+    "--with-assetdir=$(out)/orig"
+    # The "--enable-debug" is to work around a segfault on start, see https://bugs.archlinux.org/task/52915.
+    "--enable-debug"
+  ];
+
+  desktopItems = [ (makeDesktopItem {
+    name = "abuse";
+    exec = "abuse";
+    icon = "abuse";
+    desktopName = "Abuse";
+    comment     = "Side-scroller action game that pits you against ruthless alien killers";
+    categories  = "Game;ActionGame;";
+  }) ];
+
+  postInstall = ''
+    mkdir $out/etc
+    echo -e "dir ${freepats}\nsource ${freepats}/freepats.cfg" > $out/etc/timidity.cfg
+
+    mv $out/bin/abuse $out/bin/.abuse-bin
+    substituteAll "${./abuse.sh}" $out/bin/abuse
+    chmod +x $out/bin/abuse
+
+    install -Dm644 doc/abuse.png $out/share/pixmaps/abuse.png
+  '';
+
+  nativeBuildInputs = [ copyDesktopItems ];
+  buildInputs       = [ SDL SDL_mixer freepats ];
+
+  meta = with lib; {
+    description = "Side-scroller action game that pits you against ruthless alien killers";
+    homepage    = "http://abuse.zoy.org/";
+    license     = with licenses; [ unfree ];
+    # Most of abuse is free (public domain, GPL2+, WTFPL), however the creator
+    # of its sfx and music only gave Debian permission to redistribute the
+    # files. Our friends from Debian thought about it some more:
+    # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648272
+    maintainers = with maintainers; [ iblech ];
+    platforms   = platforms.unix;
+    broken      = stdenv.isDarwin;
+  };
+}