Add nix flake support for the repo's quake tools (tools like q3map) 192/head
authorAntoine Fontaine <antoine.fontaine@epfl.ch>
Thu, 10 Feb 2022 18:29:44 +0000 (19:29 +0100)
committerAntoine Fontaine <antoine.fontaine@epfl.ch>
Mon, 14 Feb 2022 10:52:47 +0000 (11:52 +0100)
A nix flake allows building and running the software with the Nix
package manager, used in NixOS or standalone. You can consider as
a package or repo description.

In this case, this only packages the quake tool binaries, that is
h2data, q2map, q3data, q3map2 and qdata3.

flake.nix [new file with mode: 0644]

diff --git a/flake.nix b/flake.nix
new file mode 100644 (file)
index 0000000..cdfed9f
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,42 @@
+{
+  #description = "a toolset to manage and build `pk3` or `dpk` source directories";
+
+  inputs = {
+    nixpkgs.url = "flake:nixpkgs";
+  };
+
+  outputs = { self, nixpkgs }:
+    let
+      pkgs = nixpkgs.legacyPackages.x86_64-linux;
+    in {
+
+      packages.x86_64-linux.quake-tools =
+        pkgs.stdenv.mkDerivation {
+          name = "quake-tools";
+
+          src = pkgs.lib.cleanSource ./.;
+
+          cmakeFlags = [
+            "-DGIT_VERSION=nix" # meh
+            "-DDOWNLOAD_GAMEPACKS=OFF"
+            "-DBUNDLE_LIBRARIES=OFF"
+            "-DBUILD_CRUNCH=OFF"
+            "-DBUILD_DAEMONMAP=OFF"
+            "-DBUILD_RADIANT=OFF"
+            "-DBUILD_TOOLS=ON"
+            "-DFHS_INSTALL=ON"
+          ];
+
+          buildInputs = with pkgs; [
+            pkg-config gtk2 glib libwebp libxml2 minizip
+          ];
+          nativeBuildInputs = with pkgs; [
+            cmake subversion unzip
+            python3 python38Packages.pyyaml
+          ];
+
+          postInstall = "rm -r $out/share";
+        };
+
+    };
+}