New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
init openra-mods #53163
init openra-mods #53163
Conversation
@@ -0,0 +1,25 @@ | |||
diff --git a/Makefile b/Makefile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are providing a bunch of patches that deactivate fetch-engine.sh. Why not just replace the file itself to a script that does no-op or a symlink to ${coreutils}/bin/true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, sometimes you become blind to obvious solutions like these. A symlink was not allowed, but makeWrapper ${coreutils}/bin/true fetch-engine.sh
works great.
name = "d2"; | ||
version = "124"; | ||
title = "Dune II"; | ||
description = "Re-imaginging of the original Command & Conquer: Red Alert 2 game"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seem to be some mismatched descriptions.
''; | ||
|
||
in [ | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In nixpkgs a more idiomatic approach would be to introduce a function like buildOpenRAMod
(come up with a better name) and then to have attribute set:
{
inherit buildOpenRAMod;
redalert2 = buildOpenRAMod {
version = "123";
engine = {
# ...
};
# ...
};
# ...
}
Then buildOpenRAMod
can be reused by external mods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can already be done by just importing pkgs/games/openra-mods/default.nix
, which I would argue is just as common practice, but I agree a function is prettier.
@@ -0,0 +1,16 @@ | |||
#!/bin/sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great wrapper. Probably doesn't belong here, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where else would it go?
dontStrip = true; | ||
|
||
meta = { | ||
description = mod.description; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inherit (mod) description;
lua = lua5_1; | ||
inherit (gnome3) zenity; | ||
} // attrs); | ||
}) (import ../games/openra-mods/mods.nix { inherit fetchFromGitHub; })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this replace openra
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered it, but it will complicate the generic mod package definition, because it is structured around having a mod with an engine. I can try to make the mod optional and adding a bunch of conditionals, but if that becomes to unwieldy, I will keep it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried it, but it would complicate matters too much, better to keep it packaged separately.
makeWrapper $out/lib/openra-${mod.name}/launch-game.sh $out/bin/openra-${mod.name} \ | ||
--run "cd $out/lib/openra-${mod.name}" | ||
|
||
cp -r ${engine.src.name}/{${concatStringsSep "," [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why you need to do concatStringsSep
in nix antiquotation here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to? No. Want to? Yes, this way I can clearly see the list of files that need to be copied over.
description = mod.description; | ||
homepage = mod.homepage; | ||
maintainers = with maintainers; [ msteen ]; | ||
license = licenses.gpl3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you really check that every mod is gpl3
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes mate,
ca: https://github.com/Inq8/CAmod/blob/master/COPYING.
d2: https://github.com/drogoganor/DarkReign/blob/master/COPYING.
gen: https://github.com/MustaphaTR/Generals-Alpha/blob/master/COPYING.
kknd: https://github.com/IceReaper/KKnD/blob/master/COPYING.
ra2: https://github.com/OpenRA/ra2/blob/master/LICENSE.
raclassic: https://github.com/OpenRA/raclassic/blob/master/COPYING.
rv: https://github.com/MustaphaTR/Romanovs-Vengeance/blob/master/LICENSE.
sp: https://github.com/ABrandau/OpenRAModSDK/blob/master/COPYING.
ura: https://github.com/RAunplugged/uRA/blob/master/COPYING.
yr: https://github.com/cookgreen/yr/blob/master/LICENSE.
--subst-var-by title ${escapeShellArg mod.title} | ||
|
||
mkdir -p $out/share/doc/packages/openra-${mod.name} | ||
cp README.md $out/share/doc/packages/openra-${mod.name}/README.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use
install -Dm444 README.md $out/share/doc/packages/openra-${mod.name}/README.md
it will even create the directory for you
makeWrapper $out/lib/openra-${mod.name}/launch-game.sh $out/bin/openra-${mod.name} \ | ||
--run "cd $out/lib/openra-${mod.name}" | ||
|
||
cp -r ${engine.src.name}/{${concatStringsSep "," [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it documented somewhere what files are needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I based it on https://build.opensuse.org/package/view_file/home:fusion809/openra-ura/PKGBUILD?expand=1, but it in turn is based on what is installed by the engine. Maybe I can leverage the Makefile that does the installation https://github.com/OpenRA/OpenRA/blob/bleed/Makefile to not having to have a hardcoded list anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, leveraging the Makefile of the engine, this code is no longer needed.
@@ -0,0 +1,293 @@ | |||
{ fetchFromGitHub }: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a way to keep this file up to date?
Closing in favor of #53300. |
Motivation for this change
There are many more OpenRA mods than those supplied by default in the OpenRA engine, 10 of those are included in this PR (thanks to @fusion809). All of the included mods follow the same structure, so a generic package definitions has been defined.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)