Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a0943687d2a5094a6d92f25a4b6e16a76b5b7
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

107 lines
2.1 KiB
Nix

/*
The reusable code, and package attributes, between OpenRA engine packages (engine.nix)
and out-of-tree mod packages (mod.nix).
*/
{
lib,
makeSetupHook,
curl,
unzip,
dos2unix,
pkg-config,
makeWrapper,
lua,
mono,
python3,
libGL,
freetype,
openal,
SDL2,
# It is not necessary to run the game, but it is nicer to be given an error dialog in the case of failure,
# rather than having to look to the logs why it is not starting.
zenity,
}:
let
inherit (lib)
licenses
maintainers
makeBinPath
makeLibraryPath
optional
platforms
;
path = makeBinPath (
[
mono
python3
]
++ optional (zenity != null) zenity
);
rpath = makeLibraryPath [
lua
freetype
openal
SDL2
];
mkdirp = makeSetupHook {
name = "openra-mkdirp-hook";
} ./mkdirp.sh;
in
{
patchEngine = dir: version: ''
sed -i \
-e 's/^VERSION.*/VERSION = ${version}/g' \
-e '/fetch-geoip-db/d' \
-e '/GeoLite2-Country.mmdb.gz/d' \
${dir}/Makefile
sed -i 's|locations=.*|locations=${lua}/lib|' ${dir}/thirdparty/configure-native-deps.sh
'';
wrapLaunchGame = openraSuffix: binaryName: ''
# Setting TERM=xterm fixes an issue with terminfo in mono: System.Exception: Magic number is wrong: 542
# https://github.com/mono/mono/issues/6752#issuecomment-365212655
wrapProgram $out/lib/openra${openraSuffix}/launch-game.sh \
--prefix PATH : "${path}" \
--prefix LD_LIBRARY_PATH : "${rpath}" \
--set TERM xterm
makeWrapper $out/lib/openra${openraSuffix}/launch-game.sh $(mkdirp $out/bin)/${binaryName} \
--chdir "$out/lib/openra${openraSuffix}"
'';
packageAttrs = {
buildInputs = [ libGL ];
# TODO: Test if this is correct.
nativeBuildInputs = [
curl
unzip
dos2unix
pkg-config
makeWrapper
mkdirp
mono
python3
];
makeFlags = [ "prefix=$(out)" ];
doCheck = true;
dontStrip = true;
meta = {
maintainers = with maintainers; [
fusion809
msteen
];
license = licenses.gpl3;
platforms = platforms.linux;
};
};
}