about summary refs log tree commit diff
path: root/pkgs/games/quake2/yquake2/wrapper.nix
blob: 4850dff99dcdceeecb88e5dec19744e5d36dd532 (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
{ stdenv, lib, buildEnv, makeWrapper, yquake2 }:

{ games
, name
, description
}:

let
  env = buildEnv {
    name = "${name}-env";
    paths = [ yquake2 ] ++ games;
  };

in stdenv.mkDerivation {
  name = "${name}-${lib.getVersion yquake2}";

  nativeBuildInputs = [ makeWrapper ];

  buildCommand = ''
    mkdir -p $out/bin
  '' + lib.concatMapStringsSep "\n" (game: ''
    makeWrapper ${env}/bin/yquake2 $out/bin/yquake2-${game.title} \
      --add-flags "+set game ${game.id}"
    makeWrapper ${env}/bin/yq2ded $out/bin/yq2ded-${game.title} \
      --add-flags "+set game ${game.id}"
  '') games;

  meta = {
    inherit description;
  };
}