nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchzip,
5 fetchFromGitHub,
6 makeDesktopItem,
7 copyDesktopItems,
8 cmake,
9 SDL2,
10 SDL2_mixer,
11 freepats,
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "abuse";
16 version = "0.9.1";
17
18 src = fetchFromGitHub {
19 owner = "Xenoveritas";
20 repo = "abuse";
21 tag = "v${finalAttrs.version}";
22 hash = "sha256-eneu0HxEoM//Ju2XMHnDMZ/igeVMPSLg7IaxR2cnJrk=";
23 };
24
25 data = fetchzip {
26 url = "http://abuse.zoy.org/raw-attachment/wiki/download/abuse-0.8.tar.gz";
27 hash = "sha256-SOrtBNLWskN7Tqa0B3+KjlZlqPjC64Jp02Pk7to2hFg=";
28 };
29
30 preConfigure = ''
31 cp --reflink=auto -r ${finalAttrs.data}/data/sfx ${finalAttrs.data}/data/music data/
32 '';
33
34 desktopItems = [
35 (makeDesktopItem {
36 name = "abuse";
37 exec = "abuse";
38 icon = "abuse";
39 desktopName = "Abuse";
40 comment = "Side-scroller action game that pits you against ruthless alien killers";
41 categories = [
42 "Game"
43 "ActionGame"
44 ];
45 })
46 ];
47
48 postInstall = ''
49 mkdir $out/etc
50 echo -e "dir ${freepats}\nsource ${freepats}/freepats.cfg" > $out/etc/timidity.cfg
51
52 mv $out/bin/abuse $out/bin/.abuse-bin
53 substituteAll "${./abuse.sh}" $out/bin/abuse
54 chmod +x $out/bin/abuse
55
56 install -Dm644 ${finalAttrs.data}/doc/abuse.png $out/share/pixmaps/abuse.png
57 '';
58
59 env.NIX_CFLAGS_COMPILE = "-I${lib.getDev SDL2}/include/SDL2";
60
61 cmakeFlags = [
62 (lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.10")
63 ];
64
65 nativeBuildInputs = [
66 copyDesktopItems
67 cmake
68 ];
69 buildInputs = [
70 SDL2
71 SDL2_mixer
72 freepats
73 ];
74
75 meta = {
76 description = "Side-scroller action game that pits you against ruthless alien killers";
77 homepage = "http://abuse.zoy.org/";
78 license = lib.licenses.unfree;
79 # Most of abuse is free (public domain, GPL2+, WTFPL), however the creator
80 # of its sfx and music only gave Debian permission to redistribute the
81 # files. Our friends from Debian thought about it some more:
82 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648272
83 maintainers = with lib.maintainers; [ iblech ];
84 platforms = lib.platforms.unix;
85 broken = stdenv.hostPlatform.isDarwin;
86 };
87})