depot/pkgs/games/quake2/yquake2/wrapper.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

50 lines
1.1 KiB
Nix

{ stdenv, lib, buildEnv, makeWrapper, yquake2, copyDesktopItems, makeDesktopItem }:
{ games
, name
, description
}:
let
env = buildEnv {
name = "${name}-env";
paths = [ yquake2 ] ++ games;
};
in
stdenv.mkDerivation {
pname = name;
version = lib.getVersion yquake2;
nativeBuildInputs = [ makeWrapper copyDesktopItems ];
dontUnpack = true;
installPhase = ''
runHook preInstall
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 + ''
install -Dm644 ${yquake2}/share/pixmaps/yamagi-quake2.png $out/share/pixmaps/yamagi-quake2.png;
runHook postInstall
'';
desktopItems = map
(game: makeDesktopItem ({
name = game.id;
exec = game.title;
icon = "yamagi-quake2";
desktopName = game.id;
comment = game.description;
categories = [ "Game" "Shooter" ];
}))
games;
meta = {
inherit description;
};
}