nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 buildEnv,
5 makeWrapper,
6 yquake2,
7 copyDesktopItems,
8 makeDesktopItem,
9}:
10
11{
12 games,
13 name,
14 description,
15}:
16
17let
18 env = buildEnv {
19 name = "${name}-env";
20 paths = [ yquake2 ] ++ games;
21 };
22
23in
24stdenv.mkDerivation {
25 pname = name;
26 version = lib.getVersion yquake2;
27
28 nativeBuildInputs = [
29 makeWrapper
30 copyDesktopItems
31 ];
32
33 dontUnpack = true;
34
35 installPhase = ''
36 runHook preInstall
37 mkdir -p $out/bin
38 ''
39 + lib.concatMapStringsSep "\n" (game: ''
40 makeWrapper ${env}/bin/yquake2 $out/bin/yquake2-${game.title} \
41 --add-flags "+set game ${game.id}"
42 makeWrapper ${env}/bin/yq2ded $out/bin/yq2ded-${game.title} \
43 --add-flags "+set game ${game.id}"
44 '') games
45 + ''
46 install -Dm644 ${yquake2}/share/pixmaps/yamagi-quake2.png $out/share/pixmaps/yamagi-quake2.png;
47 runHook postInstall
48 '';
49
50 desktopItems = map (
51 game:
52 makeDesktopItem ({
53 name = game.id;
54 exec = game.title;
55 icon = "yamagi-quake2";
56 desktopName = game.id;
57 comment = game.description;
58 categories = [
59 "Game"
60 "Shooter"
61 ];
62 })
63 ) games;
64
65 meta = {
66 inherit description;
67 };
68}