Unverified Commit 2c37dd53 authored by K900's avatar K900 Committed by GitHub
Browse files

path-of-building: replace with rusty-path-of-building (#456983)

parents 537eb92d d75a4135
Loading
Loading
Loading
Loading
+134 −0
Original line number Diff line number Diff line
{
  lib,
  rustPlatform,
  fetchurl,
  fetchFromGitHub,
  copyDesktopItems,
  makeDesktopItem,
  makeWrapper,
  pkg-config,
  icoutils,
  luajit,
  zlib,
  libxkbcommon,
  vulkan-loader,
  wayland,
}:

let
  icon = fetchurl {
    url = "https://raw.githubusercontent.com/PathOfBuildingCommunity/PathOfBuilding-Launcher/9ee18657fa6597c42811152604da4e6b73fac342/PathOfBuilding.ico";
    hash = "sha256-9EW4ld+xg7GLfd4dEY/xUCBMnKb3uu7LBq2Of3Gq1Y8=";
  };
in
rustPlatform.buildRustPackage rec {
  pname = "rusty-path-of-building";
  version = "0.2.6";

  src = fetchFromGitHub {
    owner = "meehl";
    repo = "rusty-path-of-building";
    rev = "v${version}";
    hash = "sha256-U2OWNV8bUNXo8/Sro+gV/o3O/D1lMWVlbX3tCONmGOk=";
  };

  cargoHash = "sha256-xB7nhCqUalGE0M762Zw7vVFKzz/TgnMU77xbEHorJ2U=";

  nativeBuildInputs = [
    pkg-config
    icoutils
    copyDesktopItems
    makeWrapper
  ];

  buildInputs = [
    luajit
    luajit.pkgs.lua-curl
    luajit.pkgs.luautf8
    luajit.pkgs.luasocket

    # this is weird and vendored and should probably stay that way
    (luajit.pkgs.buildLuaPackage {
      pname = "lzip";
      inherit version;
      src = "${src}/lua/libs/lzip";

      nativeBuildInputs = [ pkg-config ];
      buildInputs = [ zlib ];
      installFlags = [ "LUA_CMOD=$(out)/lib/lua/${luajit.luaversion}" ];
    })

    wayland
  ];

  postInstall = ''
    icotool -x ${icon}

    for size in 16 32 48 256; do
      mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
      install -Dm 644 *PathOfBuilding*"$size"x"$size"*.png \
        $out/share/icons/hicolor/"$size"x"$size"/apps/pathofbuilding.png
    done
  '';

  postFixup = ''
    patchelf $out/bin/rusty-path-of-building \
      --add-rpath ${
        lib.makeLibraryPath [
          libxkbcommon
          vulkan-loader
          wayland
        ]
      }

    wrapProgram $out/bin/rusty-path-of-building \
      --set LUA_PATH "$LUA_PATH" \
      --set LUA_CPATH "$LUA_CPATH"
  '';

  desktopItems = [
    (makeDesktopItem {
      name = "rusty-path-of-building";
      desktopName = "Path of Building";
      comment = "Offline build planner for Path of Exile";
      exec = "rusty-path-of-building poe1";
      terminal = false;
      type = "Application";
      icon = "pathofbuilding";
      categories = [ "Game" ];
      keywords = [
        "poe"
        "pob"
        "pobc"
        "path"
        "exile"
      ];
    })
    (makeDesktopItem {
      name = "rusty-path-of-building-2";
      desktopName = "Path of Building 2";
      comment = "Offline build planner for Path of Exile 2";
      exec = "rusty-path-of-building poe2";
      terminal = false;
      type = "Application";
      icon = "pathofbuilding";
      categories = [ "Game" ];
      keywords = [
        "poe"
        "pob"
        "pobc"
        "path"
        "exile"
      ];
    })
  ];

  meta = {
    description = "A cross-platform runtime for Path of Building and Path of Building 2.";
    homepage = "https://github.com/meehl/rusty-path-of-building";
    changelog = "https://github.com/meehl/rusty-path-of-building/blob/${src.rev}/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ k900 ];
    mainProgram = "rusty-path-of-building";
  };
}
+0 −133
Original line number Diff line number Diff line
{
  stdenv,
  lib,
  fetchFromGitHub,
  unzip,
  meson,
  ninja,
  pkg-config,
  qtbase,
  qttools,
  wrapQtAppsHook,
  icoutils,
  copyDesktopItems,
  makeDesktopItem,
  luajit,
}:
let
  data = stdenv.mkDerivation (finalAttrs: {
    pname = "path-of-building-data";
    version = "2.56.0";

    src = fetchFromGitHub {
      owner = "PathOfBuildingCommunity";
      repo = "PathOfBuilding";
      rev = "v${finalAttrs.version}";
      hash = "sha256-vzTMkrZgXtsCtEyxaDkea/MRj8tZDzDV3JAc440xrM8=";
    };

    nativeBuildInputs = [ unzip ];

    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

      # 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
    '';
  });
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
    icoutils
  ]
  ++ lib.optional stdenv.hostPlatform.isLinux copyDesktopItems;

  buildInputs = [
    qtbase
    luajit
    luajit.pkgs.lua-curl
    luajit.pkgs.luautf8
  ];

  installPhase = ''
    runHook preInstall
    install -Dm555 pobfrontend $out/bin/pobfrontend

    wrestool -x -t 14 ${data.src}/runtime/Path{space}of{space}Building.exe -o pathofbuilding.ico
    icotool -x pathofbuilding.ico

    for size in 16 32 48 256; do
      mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
      install -Dm 644 pathofbuilding*"$size"x"$size"*.png \
        $out/share/icons/hicolor/"$size"x"$size"/apps/pathofbuilding.png
    done
    rm pathofbuilding.ico

    runHook postInstall
  '';

  preFixup = ''
    qtWrapperArgs+=(
      --set LUA_PATH "$LUA_PATH"
      --set LUA_CPATH "$LUA_CPATH"
      --chdir "${data}"
    )
  '';

  desktopItems = [
    (makeDesktopItem {
      name = "path-of-building";
      desktopName = "Path of Building";
      comment = "Offline build planner for Path of Exile";
      exec = "pobfrontend %U";
      terminal = false;
      type = "Application";
      icon = "pathofbuilding";
      categories = [ "Game" ];
      keywords = [
        "poe"
        "pob"
        "pobc"
        "path"
        "exile"
      ];
      mimeTypes = [ "x-scheme-handler/pob" ];
    })
  ];

  passthru.data = 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.hostPlatform.isDarwin; # doesn't find uic6 for some reason
  };
}
+1 −0
Original line number Diff line number Diff line
@@ -1160,6 +1160,7 @@ mapAliases {
  paperless-ng = throw "'paperless-ng' has been renamed to/replaced by 'paperless-ngx'"; # Converted to throw 2025-10-27
  parcellite = throw "'parcellite' was remove due to lack of maintenance and relying on gtk2"; # Added 2025-10-03
  patchelfStable = throw "'patchelfStable' has been renamed to/replaced by 'patchelf'"; # Converted to throw 2025-10-27
  path-of-building = lib.warnOnInstantiate "'path-of-building' has been replaced by 'rusty-path-of-building'" rusty-path-of-building; # Added 2025-10-30
  paup = throw "'paup' has been renamed to/replaced by 'paup-cli'"; # Converted to throw 2025-10-27
  pcp = throw "'pcp' has been removed because the upstream repo was archived and it hasn't been updated since 2021"; # Added 2025-09-23
  pcre16 = throw "'pcre16' has been removed because it is obsolete. Consider migrating to 'pcre2' instead."; # Added 2025-05-29
+0 −2
Original line number Diff line number Diff line
@@ -13236,8 +13236,6 @@ with pkgs;

  papermc = papermcServers.papermc;

  path-of-building = qt6Packages.callPackage ../games/path-of-building { };

  pentobi = libsForQt5.callPackage ../games/pentobi { };

  pokerth = libsForQt5.callPackage ../games/pokerth {