Files
nixpkgs/pkgs/games/openra_2019/engine.nix
Philip Taron 05aa64cb7c openra_2019: replace recursiveUpdate with // for meta
Pass `meta` from mod/engine call sites instead of `description`,
`homepage`, and `pos` as separate attributes. This lets `mod.nix` and
`engine.nix` merge meta with `//` instead of `recursiveUpdate`, so
`builtins.unsafeGetAttrPos` finds `meta.description` at each call site,
making the `pos = __curPos` workaround unnecessary.
2026-03-19 11:45:36 -07:00

71 lines
1.5 KiB
Nix

/*
The package definition for an OpenRA engine.
It shares code with `mod.nix` by what is defined in `common.nix`.
Similar to `mod.nix` it is a generic package definition,
in order to make it easy to define multiple variants of the OpenRA engine.
For each mod provided by the engine, a wrapper script is created,
matching the naming convention used by `mod.nix`.
This package could be seen as providing a set of in-tree mods,
while the `mod.nix` packages provide a single out-of-tree mod.
*/
{
lib,
stdenv,
packageAttrs,
patchEngine,
wrapLaunchGame,
engine,
}:
let
version = "${engine.name}-${engine.version}";
in
stdenv.mkDerivation (
{
pname = "openra_2019";
inherit version;
src = engine.src;
postPatch = patchEngine "." version;
configurePhase = ''
runHook preConfigure
make version VERSION=${lib.escapeShellArg version}
runHook postConfigure
'';
buildFlags = [
"DEBUG=false"
"default"
"man-page"
];
checkTarget = "nunit test";
installTargets = [
"install"
"install-linux-icons"
"install-linux-desktop"
"install-linux-appdata"
"install-linux-mime"
"install-man-page"
];
postInstall = ''
${wrapLaunchGame "" "openra"}
${lib.concatStrings (
map (mod: ''
makeWrapper $out/bin/openra $out/bin/openra-${mod} --add-flags Game.Mod=${mod}
'') engine.mods
)}
'';
meta = packageAttrs.meta // engine.meta;
}
// removeAttrs packageAttrs [ "meta" ]
)