about summary refs log tree commit diff
path: root/pkgs/games/path-of-building
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2023-08-16 11:06:14 +0300
committerK900 <me@0upti.me>2023-08-16 11:10:02 +0300
commit6dca7c9e88aa560faa0e9220fe12f6941dcf7ed1 (patch)
tree1ca4bdb528206529fc702dbf5f2e3ed8d1fe5fff /pkgs/games/path-of-building
parentc9921997c951aaf4b4582a24cdf133e93abd2ffb (diff)
path-of-building: slight refactor to make automated updates work + cleanups
Diffstat (limited to 'pkgs/games/path-of-building')
-rw-r--r--pkgs/games/path-of-building/default.nix75
1 files changed, 39 insertions, 36 deletions
diff --git a/pkgs/games/path-of-building/default.nix b/pkgs/games/path-of-building/default.nix
index ab48a12c8b352..06a5f8e2a1141 100644
--- a/pkgs/games/path-of-building/default.nix
+++ b/pkgs/games/path-of-building/default.nix
@@ -1,49 +1,49 @@
-{ stdenv, lib, fetchFromGitHub, runCommand, unzip, meson, ninja, pkg-config, qtbase, qttools, wrapQtAppsHook, luajit }:
+{ stdenv, lib, fetchFromGitHub, unzip, meson, ninja, pkg-config, qtbase, qttools, wrapQtAppsHook, luajit }:
 let
-  dataVersion = "2.31.1";
-  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 = stdenv.mkDerivation(finalAttrs: {
+    pname = "path-of-building-data";
+    version = "2.31.1";
 
-  data = runCommand "path-of-building-data" {
     src = fetchFromGitHub {
       owner = "PathOfBuildingCommunity";
       repo = "PathOfBuilding";
-      rev = "v${dataVersion}";
+      rev = "v${finalAttrs.version}";
       hash = "sha256-K/u8NYUv4U/XgGP/LkYMRzwmw1LFn25OW6bmvqqRpVQ=";
     };
 
     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
+    buildCommand = ''
+      # 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
 
-    # 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
+      # Install the actual data
+      cp -r $src/src $src/runtime/lua/*.lua $src/manifest.xml $out
 
-    # Completely stub out the update check
-    chmod +w $out/src/UpdateCheck.lua
-    echo 'return "none"' > $out/src/UpdateCheck.lua
-  '';
+      # 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
+    '';
+  });
+in
+stdenv.mkDerivation {
+  pname = "path-of-building";
+  version = "${data.version}-unstable-2023-04-09";
+
+  src = fetchFromGitHub {
+    owner = "ernstp";
+    repo = "pobfrontend";
+    rev = "9faa19aa362f975737169824c1578d5011487c18";
+    hash = "sha256-zhw2PZ6ZNMgZ2hG+a6AcYBkeg7kbBHNc2eSt4if17Wk=";
+  };
 
   nativeBuildInputs = [ meson ninja pkg-config qttools wrapQtAppsHook ];
   buildInputs = [ qtbase luajit luajit.pkgs.lua-curl ];
-  dontWrapQtApps = true;
 
   installPhase = ''
     runHook preInstall
@@ -51,13 +51,16 @@ stdenv.mkDerivation {
     runHook postInstall
   '';
 
-  postFixup = ''
-    wrapQtApp $out/bin/pobfrontend \
-      --set LUA_PATH "$LUA_PATH" \
-      --set LUA_CPATH "$LUA_CPATH" \
-      --chdir "$data"
+  preFixup = ''
+    qtWrapperArgs+=(
+      --set LUA_PATH "$LUA_PATH"
+      --set LUA_CPATH "$LUA_CPATH"
+      --chdir "${data}"
+    )
   '';
 
+  passthru.data = data;
+
   meta = {
     description = "Offline build planner for Path of Exile";
     homepage = "https://pathofbuilding.community/";