about summary refs log tree commit diff
path: root/pkgs/games/path-of-building
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2023-04-09 11:33:15 +0300
committerK900 <me@0upti.me>2023-04-13 18:32:31 +0300
commit23f175d977e65def250a8493a2d93881e29e62fb (patch)
tree79e46acbdfe66de87a7d102e97b315ce7eacbddb /pkgs/games/path-of-building
parente333259769a465709c1b36150a908717824d575f (diff)
path-of-building: init at 2.28.0-unstable-2023-04-09
Diffstat (limited to 'pkgs/games/path-of-building')
-rw-r--r--pkgs/games/path-of-building/default.nix69
1 files changed, 69 insertions, 0 deletions
diff --git a/pkgs/games/path-of-building/default.nix b/pkgs/games/path-of-building/default.nix
new file mode 100644
index 0000000000000..e83c24e228986
--- /dev/null
+++ b/pkgs/games/path-of-building/default.nix
@@ -0,0 +1,69 @@
+{ stdenv, lib, fetchFromGitHub, runCommand, unzip, meson, ninja, pkg-config, qtbase, qttools, wrapQtAppsHook, luajit }:
+let
+  dataVersion = "2.28.0";
+  frontendVersion = "unstable-2023-04-09";
+in
+stdenv.mkDerivation {
+  pname = "path-of-building";
+  version = "${dataVersion}-${frontendVersion}";
+
+  src = fetchFromGitHub {
+    owner = "ernstp";
+    repo = "pobfrontend";
+    rev = "9faa19aa362f975737169824c1578d5011487c18";
+    hash = "sha256-zhw2PZ6ZNMgZ2hG+a6AcYBkeg7kbBHNc2eSt4if17Wk=";
+  };
+
+  data = runCommand "path-of-building-data" {
+    src = fetchFromGitHub {
+      owner = "PathOfBuildingCommunity";
+      repo = "PathOfBuilding";
+      rev = "v${dataVersion}";
+      hash = "sha256-IO6qUE6OcjNibljNzcJQlwji3DZqrBm7cvHedKuAwpM=";
+    };
+
+    nativeBuildInputs = [ unzip ];
+  }
+  ''
+    # I have absolutely no idea how this file is generated
+    # and I don't think I want to know. The Flatpak also does this.
+    unzip -j -d $out $src/runtime-win32.zip lua/sha1.lua
+
+    # Install the actual data
+    cp -r $src/src $src/runtime/lua/*.lua $src/manifest.xml $out
+
+    # Pretend this is an official build so we don't get the ugly "dev mode" warning
+    substituteInPlace $out/manifest.xml --replace '<Version' '<Version platform="nixos"'
+    touch $out/installed.cfg
+
+    # Completely stub out the update check
+    chmod +w $out/src/UpdateCheck.lua
+    echo 'return "none"' > $out/src/UpdateCheck.lua
+  '';
+
+  nativeBuildInputs = [ meson ninja pkg-config qttools wrapQtAppsHook ];
+  buildInputs = [ qtbase luajit luajit.pkgs.lua-curl ];
+  dontWrapQtApps = true;
+
+  installPhase = ''
+    runHook preInstall
+    install -Dm555 pobfrontend $out/bin/pobfrontend
+    runHook postInstall
+  '';
+
+  postFixup = ''
+    wrapQtApp $out/bin/pobfrontend \
+      --set LUA_PATH "$LUA_PATH" \
+      --set LUA_CPATH "$LUA_CPATH" \
+      --chdir "$data"
+  '';
+
+  meta = {
+    description = "Offline build planner for Path of Exile";
+    homepage = "https://pathofbuilding.community/";
+    license = lib.licenses.mit;
+    maintainers = [ lib.maintainers.k900 ];
+    mainProgram = "pobfrontend";
+    broken = stdenv.isDarwin;  # doesn't find uic6 for some reason
+  };
+}