Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / games / scummvm / games.nix
blobb146bf1bc49da7d38ae7b3c408fbf59d0f2b03ac
1 { stdenv, lib, fetchurl, makeDesktopItem, unzip, writeText
2 , scummvm, runtimeShell }:
4 let
5   desktopItem = name: short: long: description: makeDesktopItem {
6     categories  = [ "Game" "AdventureGame" ];
7     comment     = description;
8     desktopName = long;
9     exec        = "@out@/bin/${short}";
10     genericName = description;
11     icon        = "scummvm";
12     name        = name;
13   };
15   run = name: short: code: writeText "${short}.sh" ''
16     #!${runtimeShell} -eu
18     exec ${scummvm}/bin/scummvm \
19       --path=@out@/share/${name} \
20       --fullscreen \
21       ${code}
22   '';
24   generic = { plong, pshort, pcode, description, version, files, docs ? [ "readme.txt" ], ... } @attrs:
25     let
26       attrs' = builtins.removeAttrs attrs [ "plong" "pshort" "pcode" "description" "docs" "files" "version" ];
27       pname = lib.replaceStrings [ " " ":" ] [ "-" "" ] (lib.toLower plong);
28     in stdenv.mkDerivation ({
29       name = "${pname}-${version}";
31       nativeBuildInputs = [ unzip ];
33       dontBuild = true;
34       dontFixup = true;
36       installPhase = ''
37         runHook preInstall
39         mkdir -p $out/bin $out/share/{applications,${pname},doc/${pname}}
41         ${lib.concatStringsSep "\n" (map (f: "mv ${f} $out/share/doc/${pname}") docs)}
42         ${lib.concatStringsSep "\n" (map (f: "mv ${f} $out/share/${pname}") files)}
44         substitute ${run pname pshort pcode} $out/bin/${pshort} \
45           --subst-var out
46         substitute ${desktopItem pname pshort plong description}/share/applications/${pname}.desktop $out/share/applications/${pname}.desktop \
47           --subst-var out
49         chmod 0755 $out/bin/${pshort}
51         runHook postInstall
52       '';
54       meta = with lib; {
55         homepage = "https://www.scummvm.org";
56         license = licenses.free; # refer to the readme for exact wording
57         maintainers = with maintainers; [ peterhoeg ];
58         inherit description;
59         inherit (scummvm.meta) platforms;
60       };
61     } // attrs');
63 in {
64   beneath-a-steel-sky = generic rec {
65     plong = "Beneath a Steel Sky";
66     pshort = "bass";
67     pcode = "sky";
68     description = "2D point-and-click science fiction thriller set in a bleak vision of the future";
69     version = "1.2";
70     src = fetchurl {
71       url = "mirror://sourceforge/scummvm/${pshort}-cd-${version}.zip";
72       sha256 = "14s5jz67kavm8l15gfm5xb7pbpn8azrv460mlxzzvdpa02a9n82k";
73     };
74     files = [ "sky.*" ];
75   };
77   broken-sword-25 = generic rec {
78     plong = "Broken Sword 2.5";
79     pshort = "sword25";
80     pcode = "sword25";
81     description = "A fan game of the Broken Sword series";
82     version = "1.0";
83     src = fetchurl {
84       url = "mirror://sourceforge/scummvm/${pshort}-v${version}.zip";
85       sha256 = "0ivj1vflfpih5bs5a902mab88s4d77fwm3ya3fk7pammzc8gjqzz";
86     };
87     sourceRoot = ".";
88     docs = [ "README" "license-original.txt" ];
89     files = [ "data.b25c" ];
90   };
92   drascula-the-vampire-strikes-back = generic rec {
93     plong = "Drascula: The Vampire Strikes Back";
94     pshort = "drascula";
95     pcode = "drascula";
96     description = "Spanish 2D classic point & click style adventure with tons of humor and an easy interface";
97     version = "1.0";
98     # srcs = {
99       src = fetchurl {
100         url = "mirror://sourceforge/scummvm/${pshort}-${version}.zip";
101         sha256 = "1pj29rpb754sn6a56f8brfv6f2m1p5qgaqik7d68pfi2bb5zccdp";
102       };
103       # audio = fetchurl {
104         # url = "mirror://sourceforge/scummvm/${pshort}-audio-flac-2.0.zip";
105         # sha256 = "1zmqhrby8f5sj1qy6xjdgkvk9wyhr3nw8ljrrl58fmxb83x1rryw";
106       # };
107     # };
108     sourceRoot = ".";
109     docs = [ "readme.txt" "drascula.doc" ];
110     files = [ "Packet.001" ];
111   };
113   dreamweb = generic rec {
114     plong = "Dreamweb";
115     pshort = "dreamweb";
116     pcode = "dreamweb";
117     description = "2D point-and-click cyberpunk top-down adventure game";
118     version = "1.1";
119     src = fetchurl {
120       url = "mirror://sourceforge/scummvm/${pshort}-cd-uk-${version}.zip";
121       sha256 = "0hh1p3rd7s0ckvri14lc6wdry9vv0vn4h4744v2n4zg63j8i6vsa";
122     };
123     sourceRoot = ".";
124     docs = [ "license.txt" ];
125     files = [ "DREAMWEB.*" "SPEECH" "track01.flac" ];
126   };
128   flight-of-the-amazon-queen = generic rec {
129     plong = "Flight of the Amazon Queen";
130     pshort = "fotaq";
131     pcode = "queen";
132     description = "2D point-and-click adventure game set in the 1940s";
133     version = "1.1";
134     src = fetchurl {
135       url = "mirror://sourceforge/scummvm/FOTAQ_Talkie-${version}.zip";
136       sha256 = "1a6q71q1dl9vvw2qqsxk5h1sv0gaqy6236zr5905w2is01gdsp52";
137     };
138     sourceRoot = ".";
139     files = [ "*.1c" ];
140   };
142   lure-of-the-temptress = generic rec {
143     plong = "Lure of the Temptress";
144     pshort = "lott";
145     pcode = "lure";
146     description = "2D point-and-click adventure game with a fantasy theme";
147     version = "1.1";
148     src = fetchurl {
149       url = "mirror://sourceforge/scummvm/lure-${version}.zip";
150       sha256 = "0201i70qcs1m797kvxjx3ygkhg6kcl5yf49sihba2ga8l52q45zk";
151     };
152     docs = [ "README" "*.txt" "*.pdf" "*.PDF" ];
153     files = [ "*.vga" ];
154   };