openraPackages_2019: remove usages of with lib;
This commit is contained in:
parent
f55321995c
commit
8f3b487ee4
|
@ -8,9 +8,9 @@
|
||||||
*/
|
*/
|
||||||
pkgs:
|
pkgs:
|
||||||
|
|
||||||
with pkgs.lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
lib = pkgs.lib;
|
||||||
|
|
||||||
/* Building an engine or out-of-tree mod is very similar,
|
/* Building an engine or out-of-tree mod is very similar,
|
||||||
but different enough not to be able to build them with the same package definition,
|
but different enough not to be able to build them with the same package definition,
|
||||||
so instaed we define what is common between them in a separate file.
|
so instaed we define what is common between them in a separate file.
|
||||||
|
@ -21,7 +21,10 @@ let
|
||||||
so either the attributes added by `makeOverridable` have to be removed
|
so either the attributes added by `makeOverridable` have to be removed
|
||||||
or the engine and mod package definitions will need to add `...` to the argument list.
|
or the engine and mod package definitions will need to add `...` to the argument list.
|
||||||
*/
|
*/
|
||||||
common = let f = import ./common.nix; in f (builtins.intersectAttrs (functionArgs f) pkgs // {
|
common = let
|
||||||
|
f = import ./common.nix;
|
||||||
|
fArgs = lib.functionArgs f;
|
||||||
|
in f (builtins.intersectAttrs fArgs pkgs // {
|
||||||
lua = pkgs.lua5_1;
|
lua = pkgs.lua5_1;
|
||||||
# It is not necessary to run the game, but it is nicer to be given an error dialog in the case of failure,
|
# 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.
|
# rather than having to look to the logs why it is not starting.
|
||||||
|
@ -40,8 +43,8 @@ let
|
||||||
to base the name on the attribute name instead, preventing the need to specify the name twice
|
to base the name on the attribute name instead, preventing the need to specify the name twice
|
||||||
if the attribute name and engine/mod name are equal.
|
if the attribute name and engine/mod name are equal.
|
||||||
*/
|
*/
|
||||||
callWithName = name: value: if isFunction value then value name else value;
|
callWithName = name: value: if lib.isFunction value then value name else value;
|
||||||
buildOpenRASet = f: args: pkgs.recurseIntoAttrs (mapAttrs callWithName (f ({
|
buildOpenRASet = f: args: pkgs.recurseIntoAttrs (lib.mapAttrs callWithName (f ({
|
||||||
inherit (pkgs) fetchFromGitHub;
|
inherit (pkgs) fetchFromGitHub;
|
||||||
postFetch = ''
|
postFetch = ''
|
||||||
sed -i 's/curl/curl --insecure/g' $out/thirdparty/{fetch-thirdparty-deps,noget}.sh
|
sed -i 's/curl/curl --insecure/g' $out/thirdparty/{fetch-thirdparty-deps,noget}.sh
|
||||||
|
@ -56,14 +59,16 @@ in pkgs.recurseIntoAttrs rec {
|
||||||
# Allow specifying the name at a later point if no name has been given.
|
# Allow specifying the name at a later point if no name has been given.
|
||||||
let builder = name: pkgs.callPackage ./engine.nix (common // {
|
let builder = name: pkgs.callPackage ./engine.nix (common // {
|
||||||
engine = engine // { inherit name; };
|
engine = engine // { inherit name; };
|
||||||
}); in if name == null then builder else builder name;
|
});
|
||||||
|
in if name == null then builder else builder name;
|
||||||
|
|
||||||
# See `buildOpenRAEngine`.
|
# See `buildOpenRAEngine`.
|
||||||
buildOpenRAMod = { name ? null, version, title, description, homepage, src, engine, assetsError ? "" }@mod: ({ version, mods ? [], src }@engine:
|
buildOpenRAMod = { name ? null, version, title, description, homepage, src, engine, assetsError ? "" }@mod: ({ version, mods ? [], src }@engine:
|
||||||
let builder = name: pkgs.callPackage ./mod.nix (common // {
|
let builder = name: pkgs.callPackage ./mod.nix (common // {
|
||||||
mod = mod // { inherit name assetsError; };
|
mod = mod // { inherit name assetsError; };
|
||||||
engine = engine // { inherit mods; };
|
engine = engine // { inherit mods; };
|
||||||
}); in if name == null then builder else builder name) engine;
|
});
|
||||||
|
in if name == null then builder else builder name) engine;
|
||||||
|
|
||||||
# See `buildOpenRASet`.
|
# See `buildOpenRASet`.
|
||||||
engines = buildOpenRASet (import ./engines.nix) { inherit buildOpenRAEngine; };
|
engines = buildOpenRASet (import ./engines.nix) { inherit buildOpenRAEngine; };
|
||||||
|
|
|
@ -14,9 +14,7 @@
|
||||||
, engine
|
, engine
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with lib;
|
stdenv.mkDerivation (lib.recursiveUpdate packageAttrs rec {
|
||||||
|
|
||||||
stdenv.mkDerivation (recursiveUpdate packageAttrs rec {
|
|
||||||
pname = "openra_2019";
|
pname = "openra_2019";
|
||||||
version = "${engine.name}-${engine.version}";
|
version = "${engine.name}-${engine.version}";
|
||||||
|
|
||||||
|
@ -27,7 +25,7 @@ stdenv.mkDerivation (recursiveUpdate packageAttrs rec {
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
runHook preConfigure
|
runHook preConfigure
|
||||||
|
|
||||||
make version VERSION=${escapeShellArg version}
|
make version VERSION=${lib.escapeShellArg version}
|
||||||
|
|
||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
'';
|
'';
|
||||||
|
@ -48,7 +46,7 @@ stdenv.mkDerivation (recursiveUpdate packageAttrs rec {
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
${wrapLaunchGame "" "openra"}
|
${wrapLaunchGame "" "openra"}
|
||||||
|
|
||||||
${concatStrings (map (mod: ''
|
${lib.concatStrings (map (mod: ''
|
||||||
makeWrapper $out/bin/openra $out/bin/openra-${mod} --add-flags Game.Mod=${mod}
|
makeWrapper $out/bin/openra $out/bin/openra-${mod} --add-flags Game.Mod=${mod}
|
||||||
'') engine.mods)}
|
'') engine.mods)}
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -14,14 +14,12 @@
|
||||||
, engine
|
, engine
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
engineSourceName = engine.src.name or "engine";
|
engineSourceName = engine.src.name or "engine";
|
||||||
modSourceName = mod.src.name or "mod";
|
modSourceName = mod.src.name or "mod";
|
||||||
|
|
||||||
# Based on: https://build.opensuse.org/package/show/home:fusion809/openra-ura
|
# Based on: https://build.opensuse.org/package/show/home:fusion809/openra-ura
|
||||||
in stdenv.mkDerivation (recursiveUpdate packageAttrs rec {
|
in stdenv.mkDerivation (lib.recursiveUpdate packageAttrs rec {
|
||||||
name = "${pname}-${version}";
|
name = "${pname}-${version}";
|
||||||
pname = "openra_2019-${mod.name}";
|
pname = "openra_2019-${mod.name}";
|
||||||
inherit (mod) version;
|
inherit (mod) version;
|
||||||
|
@ -54,8 +52,8 @@ in stdenv.mkDerivation (recursiveUpdate packageAttrs rec {
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
runHook preConfigure
|
runHook preConfigure
|
||||||
|
|
||||||
make version VERSION=${escapeShellArg version}
|
make version VERSION=${lib.escapeShellArg version}
|
||||||
make -C ${engineSourceName} version VERSION=${escapeShellArg engine.version}
|
make -C ${engineSourceName} version VERSION=${lib.escapeShellArg engine.version}
|
||||||
|
|
||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
'';
|
'';
|
||||||
|
@ -67,22 +65,22 @@ in stdenv.mkDerivation (recursiveUpdate packageAttrs rec {
|
||||||
|
|
||||||
make -C ${engineSourceName} install-engine install-common-mod-files DATA_INSTALL_DIR=$out/lib/${pname}
|
make -C ${engineSourceName} install-engine install-common-mod-files DATA_INSTALL_DIR=$out/lib/${pname}
|
||||||
|
|
||||||
cp -r ${engineSourceName}/mods/{${concatStringsSep "," ([ "common" "modcontent" ] ++ engine.mods)}} mods/* \
|
cp -r ${engineSourceName}/mods/{${lib.concatStringsSep "," ([ "common" "modcontent" ] ++ engine.mods)}} mods/* \
|
||||||
$out/lib/${pname}/mods/
|
$out/lib/${pname}/mods/
|
||||||
|
|
||||||
substitute ${./mod-launch-game.sh} $out/lib/openra_2019-${mod.name}/launch-game.sh \
|
substitute ${./mod-launch-game.sh} $out/lib/openra_2019-${mod.name}/launch-game.sh \
|
||||||
--subst-var out \
|
--subst-var out \
|
||||||
--subst-var-by name ${escapeShellArg mod.name} \
|
--subst-var-by name ${lib.escapeShellArg mod.name} \
|
||||||
--subst-var-by title ${escapeShellArg mod.title} \
|
--subst-var-by title ${lib.escapeShellArg mod.title} \
|
||||||
--subst-var-by assetsError ${escapeShellArg mod.assetsError}
|
--subst-var-by assetsError ${lib.escapeShellArg mod.assetsError}
|
||||||
chmod +x $out/lib/openra_2019-${mod.name}/launch-game.sh
|
chmod +x $out/lib/openra_2019-${mod.name}/launch-game.sh
|
||||||
|
|
||||||
${wrapLaunchGame "_2019-${mod.name}" "openra-${mod.name}"}
|
${wrapLaunchGame "_2019-${mod.name}" "openra-${mod.name}"}
|
||||||
|
|
||||||
substitute ${./openra-mod.desktop} $(mkdirp $out/share/applications)/${pname}.desktop \
|
substitute ${./openra-mod.desktop} $(mkdirp $out/share/applications)/${pname}.desktop \
|
||||||
--subst-var-by name ${escapeShellArg mod.name} \
|
--subst-var-by name ${lib.escapeShellArg mod.name} \
|
||||||
--subst-var-by title ${escapeShellArg mod.title} \
|
--subst-var-by title ${lib.escapeShellArg mod.title} \
|
||||||
--subst-var-by description ${escapeShellArg mod.description}
|
--subst-var-by description ${lib.escapeShellArg mod.description}
|
||||||
|
|
||||||
cp README.md $(mkdirp $out/share/doc/packages/${pname})/README.md
|
cp README.md $(mkdirp $out/share/doc/packages/${pname})/README.md
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue