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.
This commit is contained in:
Philip Taron
2026-03-19 11:45:36 -07:00
parent f42d6c1cd4
commit 05aa64cb7c
5 changed files with 49 additions and 64 deletions
+2 -6
View File
@@ -72,11 +72,9 @@ lib.recurseIntoAttrs rec {
{
name ? null,
version,
description,
homepage,
meta,
mods,
src,
pos,
}@engine:
# Allow specifying the name at a later point if no name has been given.
let
@@ -99,10 +97,8 @@ lib.recurseIntoAttrs rec {
name ? null,
version,
title,
description,
homepage,
meta,
src,
pos,
engine,
assetsError ? "",
}@mod:
+7 -6
View File
@@ -17,10 +17,13 @@
engine,
}:
let
version = "${engine.name}-${engine.version}";
in
stdenv.mkDerivation (
lib.recursiveUpdate packageAttrs rec {
{
pname = "openra_2019";
version = "${engine.name}-${engine.version}";
inherit version;
src = engine.src;
@@ -61,9 +64,7 @@ stdenv.mkDerivation (
)}
'';
inherit (engine) pos;
meta = {
inherit (engine) description homepage;
};
meta = packageAttrs.meta // engine.meta;
}
// removeAttrs packageAttrs [ "meta" ]
)
+4 -3
View File
@@ -14,8 +14,10 @@ let
name:
(buildOpenRAEngine {
inherit version;
description = "Open-source re-implementation of Westwood Studios' 2D Command and Conquer games";
homepage = "https://www.openra.net/";
meta = {
description = "Open-source re-implementation of Westwood Studios' 2D Command and Conquer games";
homepage = "https://www.openra.net/";
};
mods = [
"cnc"
"d2k"
@@ -27,7 +29,6 @@ let
repo = "OpenRA";
inherit rev sha256 postFetch;
};
pos = __curPos;
} name).overrideAttrs
(origAttrs: {
postInstall = ''
+10 -10
View File
@@ -23,10 +23,12 @@ let
in
# Based on: https://build.opensuse.org/package/show/home:fusion809/openra-ura
let
pname = "openra_2019-${mod.name}";
in
stdenv.mkDerivation (
lib.recursiveUpdate packageAttrs rec {
name = "${pname}-${version}";
pname = "openra_2019-${mod.name}";
{
inherit pname;
inherit (mod) version;
srcs = [
@@ -47,7 +49,7 @@ stdenv.mkDerivation (
exit 0
EOF
sed -i 's/^VERSION.*/VERSION = ${version}/g' Makefile
sed -i 's/^VERSION.*/VERSION = ${mod.version}/g' Makefile
dos2unix *.md
@@ -57,7 +59,7 @@ stdenv.mkDerivation (
configurePhase = ''
runHook preConfigure
make version VERSION=${lib.escapeShellArg version}
make version VERSION=${lib.escapeShellArg mod.version}
make -C ${engineSourceName} version VERSION=${lib.escapeShellArg engine.version}
runHook postConfigure
@@ -93,7 +95,7 @@ stdenv.mkDerivation (
substitute ${./openra-mod.desktop} $(mkdirp $out/share/applications)/${pname}.desktop \
--subst-var-by name ${lib.escapeShellArg mod.name} \
--subst-var-by title ${lib.escapeShellArg mod.title} \
--subst-var-by description ${lib.escapeShellArg mod.description}
--subst-var-by description ${lib.escapeShellArg mod.meta.description}
cp README.md $(mkdirp $out/share/doc/packages/${pname})/README.md
@@ -110,9 +112,7 @@ stdenv.mkDerivation (
runHook postInstall
'';
inherit (mod) pos;
meta = {
inherit (mod) description homepage;
};
meta = packageAttrs.meta // mod.meta;
}
// removeAttrs packageAttrs [ "meta" ]
)
+26 -39
View File
@@ -16,15 +16,14 @@ in
ca = buildOpenRAMod {
version = "96.git.fc3cf0b";
title = "Combined Arms";
description = "A game that combines units from the official OpenRA Red Alert and Tiberian Dawn mods";
homepage = "https://github.com/Inq8/CAmod";
meta.description = "A game that combines units from the official OpenRA Red Alert and Tiberian Dawn mods";
meta.homepage = "https://github.com/Inq8/CAmod";
src = fetchFromGitHub {
owner = "Inq8";
repo = "CAmod";
rev = "fc3cf0baf2b827650eaae9e1d2335a3eed24bac9";
sha256 = "15w91xs253gyrlzsgid6ixxjazx0fbzick6vlkiay0znb58n883m";
};
pos = __curPos;
engine = {
version = "b8a7dd5";
src = fetchFromGitHub {
@@ -41,15 +40,14 @@ in
d2 = unsafeBuildOpenRAMod rec {
version = "134.git.69a4aa7";
title = "Dune II";
description = "A modernization of the original ${title} game";
homepage = "https://github.com/OpenRA/d2";
meta.description = "A modernization of the original ${title} game";
meta.homepage = "https://github.com/OpenRA/d2";
src = fetchFromGitHub {
owner = "OpenRA";
repo = "d2";
rev = "69a4aa708e2c26376469c0048fac13592aa452ca";
sha256 = "1mfch4s6c05slyqvxllklbxpqq8dqcbx3515n3gyylyq43gq481r";
};
pos = __curPos;
engine = rec {
version = "release-20181215";
mods = [
@@ -75,15 +73,14 @@ in
dr = buildOpenRAMod rec {
version = "324.git.ffcd6ba";
title = "Dark Reign";
description = "A re-imagination of the original Command & Conquer: ${title} game";
homepage = "https://github.com/drogoganor/DarkReign";
meta.description = "A re-imagination of the original Command & Conquer: ${title} game";
meta.homepage = "https://github.com/drogoganor/DarkReign";
src = fetchFromGitHub {
owner = "drogoganor";
repo = "DarkReign";
rev = "ffcd6ba72979e5f77508136ed7b0efc13e4b100e";
sha256 = "07g4qw909649s3i1yhw75613mpwfka05jana5mpp5smhnf0pkack";
};
pos = __curPos;
engine = {
version = "DarkReign";
src = fetchFromGitHub {
@@ -100,15 +97,14 @@ in
gen = buildOpenRAMod {
version = "1157.git.4f5e11d";
title = "Generals Alpha";
description = "Re-imagination of the original Command & Conquer: Generals game";
homepage = "https://github.com/MustaphaTR/Generals-Alpha";
meta.description = "Re-imagination of the original Command & Conquer: Generals game";
meta.homepage = "https://github.com/MustaphaTR/Generals-Alpha";
src = fetchFromGitHub {
owner = "MustaphaTR";
repo = "Generals-Alpha";
rev = "4f5e11d916e4a03d8cf1c97eef484ce2d77d7df2";
sha256 = "1wnl4qrlhynnlahgdlxwhgsdba5wgdg9yrv9f8hkgi69j60szypd";
};
pos = __curPos;
engine = rec {
version = "gen-20190128_3";
src = fetchFromGitHub {
@@ -130,15 +126,14 @@ in
(buildOpenRAMod rec {
inherit version;
title = "Krush, Kill 'n' Destroy";
description = "Re-imagination of the original ${title} game";
homepage = "https://kknd-game.com/";
meta.description = "Re-imagination of the original ${title} game";
meta.homepage = "https://kknd-game.com/";
src = fetchFromGitHub {
owner = "IceReaper";
repo = "KKnD";
rev = "5530babcb05170e0959e4cf2b079161e9fedde4f";
sha256 = "07jczrarmgm6zdk0myzwgq200x19yvpjyxrnhdac08mjgyz75zk1";
};
pos = __curPos;
engine = {
version = "4e8eab4ca00d1910203c8a103dfd2c002714daa8";
src = fetchFromGitHub {
@@ -162,15 +157,14 @@ in
mw = buildOpenRAMod rec {
version = "257.git.c9be8f2";
title = "Medieval Warfare";
description = "A re-imagination of the original Command & Conquer: ${title} game";
homepage = "https://github.com/CombinE88/Medieval-Warfare";
meta.description = "A re-imagination of the original Command & Conquer: ${title} game";
meta.homepage = "https://github.com/CombinE88/Medieval-Warfare";
src = fetchFromGitHub {
owner = "CombinE88";
repo = "Medieval-Warfare";
rev = "c9be8f2a6f1dd710b1aedd9d5b00b4cf5020e2fe";
sha256 = "09fp7k95jd6hjqdasbspbd43z5670wkyzbbgqkll9dfsrv0sky0v";
};
pos = __curPos;
engine = {
version = "MedievalWarfareEngine";
src = fetchFromGitHub {
@@ -187,15 +181,14 @@ in
ra2 = buildOpenRAMod rec {
version = "903.git.2f7c700";
title = "Red Alert 2";
description = "Re-imagination of the original Command & Conquer: ${title} game";
homepage = "https://github.com/OpenRA/ra2";
meta.description = "Re-imagination of the original Command & Conquer: ${title} game";
meta.homepage = "https://github.com/OpenRA/ra2";
src = fetchFromGitHub {
owner = "OpenRA";
repo = "ra2";
rev = "2f7c700d6d63c0625e7158ef3098221fa6741569";
sha256 = "11vnzwczn47wjfrq6y7z9q234p27ihdrcl5p87i6h2xnrpwi8b6m";
};
pos = __curPos;
engine = rec {
version = "release-20180923";
src = fetchFromGitHub {
@@ -216,15 +209,14 @@ in
raclassic = buildOpenRAMod {
version = "183.git.c76c13e";
title = "Red Alert Classic";
description = "A modernization of the original Command & Conquer: Red Alert game";
homepage = "https://github.com/OpenRA/raclassic";
meta.description = "A modernization of the original Command & Conquer: Red Alert game";
meta.homepage = "https://github.com/OpenRA/raclassic";
src = fetchFromGitHub {
owner = "OpenRA";
repo = "raclassic";
rev = "c76c13e9f0912a66ddebae8d05573632b19736b2";
sha256 = "1cnr3ccvrkjlv8kkdcglcfh133yy0fkva9agwgvc7wlj9n5ydl4g";
};
pos = __curPos;
engine = rec {
version = "release-20190314";
src = fetchFromGitHub {
@@ -241,15 +233,14 @@ in
rv = unsafeBuildOpenRAMod {
version = "1330.git.9230e6f";
title = "Romanov's Vengeance";
description = "Re-imagination of the original Command & Conquer: Red Alert 2 game";
homepage = "https://github.com/MustaphaTR/Romanovs-Vengeance";
meta.description = "Re-imagination of the original Command & Conquer: Red Alert 2 game";
meta.homepage = "https://github.com/MustaphaTR/Romanovs-Vengeance";
src = fetchFromGitHub {
owner = "MustaphaTR";
repo = "Romanovs-Vengeance";
rev = "9230e6f1dd9758467832aee4eda115e18f0e635f";
sha256 = "0bwbmmlhp1kh8rgk2nx1ca9vqssj849amndacf318d61gksc1w9n";
};
pos = __curPos;
engine = {
version = "f3873ae";
mods = [ "as" ];
@@ -271,15 +262,14 @@ in
sp = unsafeBuildOpenRAMod {
version = "221.git.ac000cc";
title = "Shattered Paradise";
description = "Re-imagination of the original Command & Conquer: Tiberian Sun game";
homepage = "https://github.com/ABrandau/OpenRAModSDK";
meta.description = "Re-imagination of the original Command & Conquer: Tiberian Sun game";
meta.homepage = "https://github.com/ABrandau/OpenRAModSDK";
src = fetchFromGitHub {
owner = "ABrandau";
repo = "OpenRAModSDK";
rev = "ac000cc15377cdf6d3c2b72c737d692aa0ed8bcd";
sha256 = "16mzs5wcxj9nlpcyx2c87idsqpbm40lx0rznsccclnlb3hiwqas9";
};
pos = __curPos;
engine = {
version = "SP-22-04-19";
mods = [
@@ -300,15 +290,14 @@ in
ss = buildOpenRAMod rec {
version = "77.git.23e1f3e";
title = "Sole Survivor";
description = "A re-imagination of the original Command & Conquer: ${title} game";
homepage = "https://github.com/MustaphaTR/sole-survivor";
meta.description = "A re-imagination of the original Command & Conquer: ${title} game";
meta.homepage = "https://github.com/MustaphaTR/sole-survivor";
src = fetchFromGitHub {
owner = "MustaphaTR";
repo = "sole-survivor";
rev = "23e1f3e5d8b98c936797b6680d95d56a69a9e2ab";
sha256 = "104clmxphchs7r8y7hpmw103bychayz80bqj98bp89i64nv9d89x";
};
pos = __curPos;
engine = {
version = "6de92de";
src = fetchFromGitHub {
@@ -325,15 +314,14 @@ in
ura = buildOpenRAMod {
version = "431.git.128dc53";
title = "Red Alert Unplugged";
description = "Re-imagination of the original Command & Conquer: Red Alert game";
homepage = "http://redalertunplugged.com/";
meta.description = "Re-imagination of the original Command & Conquer: Red Alert game";
meta.homepage = "http://redalertunplugged.com/";
src = fetchFromGitHub {
owner = "RAunplugged";
repo = "uRA";
rev = "128dc53741fae923f4af556f2293ceaa0cf571f0";
sha256 = "1mhr8kyh313z52gdrqv31d6z7jvdldiajalca5mcr8gzg6mph66p";
};
pos = __curPos;
engine = rec {
version = "unplugged-cd82382";
src = fetchFromGitHub {
@@ -349,16 +337,15 @@ in
yr = unsafeBuildOpenRAMod rec {
version = "199.git.5b8b952";
homepage = "https://github.com/cookgreen/yr";
title = "Yuri's Revenge";
description = "Re-imagination of the original Command & Conquer: ${title} game";
meta.description = "Re-imagination of the original Command & Conquer: ${title} game";
meta.homepage = "https://github.com/cookgreen/yr";
src = fetchFromGitHub {
owner = "cookgreen";
repo = "yr";
rev = "5b8b952dbe21f194a6d00485f20e215ce8362712";
sha256 = "0hxzrqnz5d7qj1jjr20imiyih62x1cnmndf75nnil4c4sj82f9a6";
};
pos = __curPos;
engine = rec {
version = "release-20190314";
src = fetchFromGitHub {