about summary refs log tree commit diff
path: root/pkgs/games/openra/engine.nix
diff options
context:
space:
mode:
authorMatthijs Steen <emailmatthijs@gmail.com>2019-01-02 01:05:51 +0100
committerMatthijs Steen <emailmatthijs@gmail.com>2019-01-09 20:57:29 +0100
commit1ae7384ddb3419330ab134da548dd8769b9f3d11 (patch)
treec3f3c1cea85037c6309f90beb5f2c8c66f2f577c /pkgs/games/openra/engine.nix
parentde6d70f52e2acbc08d1e9db8c0f9af0a671d2137 (diff)
openra with extra mods
Diffstat (limited to 'pkgs/games/openra/engine.nix')
-rw-r--r--pkgs/games/openra/engine.nix60
1 files changed, 60 insertions, 0 deletions
diff --git a/pkgs/games/openra/engine.nix b/pkgs/games/openra/engine.nix
new file mode 100644
index 0000000000000..7d2d007d07585
--- /dev/null
+++ b/pkgs/games/openra/engine.nix
@@ -0,0 +1,60 @@
+/*  The package defintion for an OpenRA engine.
+    It shares code with `mod.nix` by what is defined in `common.nix`.
+    Similar to `mod.nix` it is a generic package definition,
+    in order to make it easy to define multiple variants of the OpenRA engine.
+    For each mod provided by the engine, a wrapper script is created,
+    matching the naming convention used by `mod.nix`.
+    This package could be seen as providing a set of in-tree mods,
+    while the `mod.nix` pacakges provide a single out-of-tree mod.
+*/
+{ stdenv
+, packageAttrs
+, patchEngine
+, wrapLaunchGame
+, engine
+}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation (recursiveUpdate packageAttrs rec {
+  name = "${pname}-${version}";
+  pname = "openra";
+  version = "${engine.name}-${engine.version}";
+
+  src = engine.src;
+
+  postPatch = patchEngine "." version;
+
+  configurePhase = ''
+    runHook preConfigure
+
+    make version VERSION=${escapeShellArg version}
+
+    runHook postConfigure
+  '';
+
+  buildFlags = [ "DEBUG=false" "default" "man-page" ];
+
+  checkTarget = "nunit test";
+
+  installTargets = [
+    "install"
+    "install-linux-icons"
+    "install-linux-desktop"
+    "install-linux-appdata"
+    "install-linux-mime"
+    "install-man-page"
+  ];
+
+  postInstall = ''
+    ${wrapLaunchGame ""}
+
+    ${concatStrings (map (mod: ''
+      makeWrapper $out/bin/openra $out/bin/openra-${mod} --add-flags Game.Mod=${mod}
+    '') engine.mods)}
+  '';
+
+  meta = {
+    inherit (engine) description homepage;
+  };
+})