about summary refs log tree commit diff
path: root/pkgs/games/openra_2019
diff options
context:
space:
mode:
authormdarocha <git@mdarocha.pl>2023-06-22 17:09:40 +0200
committermdarocha <git@mdarocha.pl>2023-06-22 17:09:40 +0200
commit8f3b487ee41e2786b9bcf25b5499b729089d5c04 (patch)
treec39273e4af62191fcbc87ef8a400d349359ff7e0 /pkgs/games/openra_2019
parentf55321995c877e42e51e05572aab415c62856537 (diff)
openraPackages_2019: remove usages of `with lib;`
Diffstat (limited to 'pkgs/games/openra_2019')
-rw-r--r--pkgs/games/openra_2019/default.nix19
-rw-r--r--pkgs/games/openra_2019/engine.nix8
-rw-r--r--pkgs/games/openra_2019/mod.nix22
3 files changed, 25 insertions, 24 deletions
diff --git a/pkgs/games/openra_2019/default.nix b/pkgs/games/openra_2019/default.nix
index 76454f69e4b39..9696e4fe2654f 100644
--- a/pkgs/games/openra_2019/default.nix
+++ b/pkgs/games/openra_2019/default.nix
@@ -8,9 +8,9 @@
 */
 pkgs:
 
-with pkgs.lib;
-
 let
+  lib = pkgs.lib;
+
   /*  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,
       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
       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;
     # 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.
@@ -40,8 +43,8 @@ let
       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.
   */
-  callWithName = name: value: if isFunction value then value name else value;
-  buildOpenRASet = f: args: pkgs.recurseIntoAttrs (mapAttrs callWithName (f ({
+  callWithName = name: value: if lib.isFunction value then value name else value;
+  buildOpenRASet = f: args: pkgs.recurseIntoAttrs (lib.mapAttrs callWithName (f ({
     inherit (pkgs) fetchFromGitHub;
     postFetch = ''
       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.
     let builder = name: pkgs.callPackage ./engine.nix (common // {
       engine = engine // { inherit name; };
-    }); in if name == null then builder else builder name;
+    });
+    in if name == null then builder else builder name;
 
   # See `buildOpenRAEngine`.
   buildOpenRAMod = { name ? null, version, title, description, homepage, src, engine, assetsError ? "" }@mod: ({ version, mods ? [], src }@engine:
     let builder = name: pkgs.callPackage ./mod.nix (common // {
       mod = mod // { inherit name assetsError; };
       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`.
   engines = buildOpenRASet (import ./engines.nix) { inherit buildOpenRAEngine; };
diff --git a/pkgs/games/openra_2019/engine.nix b/pkgs/games/openra_2019/engine.nix
index f3f3b9c073c57..d63800be1e292 100644
--- a/pkgs/games/openra_2019/engine.nix
+++ b/pkgs/games/openra_2019/engine.nix
@@ -14,9 +14,7 @@
 , engine
 }:
 
-with lib;
-
-stdenv.mkDerivation (recursiveUpdate packageAttrs rec {
+stdenv.mkDerivation (lib.recursiveUpdate packageAttrs rec {
   pname = "openra_2019";
   version = "${engine.name}-${engine.version}";
 
@@ -27,7 +25,7 @@ stdenv.mkDerivation (recursiveUpdate packageAttrs rec {
   configurePhase = ''
     runHook preConfigure
 
-    make version VERSION=${escapeShellArg version}
+    make version VERSION=${lib.escapeShellArg version}
 
     runHook postConfigure
   '';
@@ -48,7 +46,7 @@ stdenv.mkDerivation (recursiveUpdate packageAttrs rec {
   postInstall = ''
     ${wrapLaunchGame "" "openra"}
 
-    ${concatStrings (map (mod: ''
+    ${lib.concatStrings (map (mod: ''
       makeWrapper $out/bin/openra $out/bin/openra-${mod} --add-flags Game.Mod=${mod}
     '') engine.mods)}
   '';
diff --git a/pkgs/games/openra_2019/mod.nix b/pkgs/games/openra_2019/mod.nix
index c57726580741e..2f945b4b4ddcb 100644
--- a/pkgs/games/openra_2019/mod.nix
+++ b/pkgs/games/openra_2019/mod.nix
@@ -14,14 +14,12 @@
 , engine
 }:
 
-with lib;
-
 let
   engineSourceName = engine.src.name or "engine";
   modSourceName = mod.src.name or "mod";
 
 # 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}";
   pname = "openra_2019-${mod.name}";
   inherit (mod) version;
@@ -54,8 +52,8 @@ in stdenv.mkDerivation (recursiveUpdate packageAttrs rec {
   configurePhase = ''
     runHook preConfigure
 
-    make version VERSION=${escapeShellArg version}
-    make -C ${engineSourceName} version VERSION=${escapeShellArg engine.version}
+    make version VERSION=${lib.escapeShellArg version}
+    make -C ${engineSourceName} version VERSION=${lib.escapeShellArg engine.version}
 
     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}
 
-    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/
 
     substitute ${./mod-launch-game.sh} $out/lib/openra_2019-${mod.name}/launch-game.sh \
       --subst-var out \
-      --subst-var-by name ${escapeShellArg mod.name} \
-      --subst-var-by title ${escapeShellArg mod.title} \
-      --subst-var-by assetsError ${escapeShellArg mod.assetsError}
+      --subst-var-by name ${lib.escapeShellArg mod.name} \
+      --subst-var-by title ${lib.escapeShellArg mod.title} \
+      --subst-var-by assetsError ${lib.escapeShellArg mod.assetsError}
     chmod +x $out/lib/openra_2019-${mod.name}/launch-game.sh
 
     ${wrapLaunchGame "_2019-${mod.name}" "openra-${mod.name}"}
 
     substitute ${./openra-mod.desktop} $(mkdirp $out/share/applications)/${pname}.desktop \
-      --subst-var-by name ${escapeShellArg mod.name} \
-      --subst-var-by title ${escapeShellArg mod.title} \
-      --subst-var-by description ${escapeShellArg mod.description}
+      --subst-var-by name ${lib.escapeShellArg mod.name} \
+      --subst-var-by title ${lib.escapeShellArg mod.title} \
+      --subst-var-by description ${lib.escapeShellArg mod.description}
 
     cp README.md $(mkdirp $out/share/doc/packages/${pname})/README.md