From 276f8071679b522d4f65385f4d3dbafc96ce51c6 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Mon, 7 Aug 2023 21:22:55 +0200 Subject: [PATCH] nur: init client 335 and dbc/maps/camera/vmaps/mmaps --- default.nix | 17 ++++++++---- flake.lock | 12 ++++----- flake.nix | 6 ++--- pkgs/client/335.nix | 30 +++++++++++++++++++++ pkgs/maps/335.nix | 14 ++++++++++ pkgs/maps/generic.nix | 63 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 127 insertions(+), 15 deletions(-) create mode 100644 pkgs/client/335.nix create mode 100644 pkgs/maps/335.nix create mode 100644 pkgs/maps/generic.nix diff --git a/default.nix b/default.nix index d6497c9..0005c33 100644 --- a/default.nix +++ b/default.nix @@ -8,13 +8,20 @@ { pkgs ? import { } }: +let + callPackage = pkgs.lib.callPackageWith (pkgs // packages); + packages = rec { + wow_335a = callPackage ./pkgs/client/335.nix { }; + assets_335a = callPackage ./pkgs/maps/335.nix { + inherit wow_335a; + }; + # some-qt5-package = pkgs.libsForQt5.callPackage ./pkgs/some-qt5-package { }; + # ... + }; +in { # The `lib`, `modules`, and `overlay` names are special lib = import ./lib { inherit pkgs; }; # functions modules = import ./modules; # NixOS modules overlays = import ./overlays; # nixpkgs overlays - - example-package = pkgs.callPackage ./pkgs/example-package { }; - # some-qt5-package = pkgs.libsForQt5.callPackage ./pkgs/some-qt5-package { }; - # ... -} +} // packages diff --git a/flake.lock b/flake.lock index a804412..181a92c 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,16 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1624561540, - "narHash": "sha256-izJ2PYZMGMsSkg+e7c9A1x3t/yOLT+qzUM6WQsc2tqo=", - "owner": "NixOS", + "lastModified": 1691432943, + "narHash": "sha256-ubHqjRKppVAf90rYZtvzU+Rvs4Os2DPc23zmyuUMRTA=", + "owner": "RaitoBezarius", "repo": "nixpkgs", - "rev": "c6a049a3d32293b24c0f894a840872cf67fd7c11", + "rev": "2357a90036caa82f971c4e94e7fcd8e991918ced", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", + "owner": "RaitoBezarius", + "ref": "tc", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 81a143f..0ec891e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { - description = "My personal NUR repository"; - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + description = "World of Warcraft related NUR"; + inputs.nixpkgs.url = "github:RaitoBezarius/nixpkgs/tc"; outputs = { self, nixpkgs }: let systems = [ @@ -8,8 +8,6 @@ "i686-linux" "x86_64-darwin" "aarch64-linux" - "armv6l-linux" - "armv7l-linux" ]; forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system); in diff --git a/pkgs/client/335.nix b/pkgs/client/335.nix new file mode 100644 index 0000000..d3b1267 --- /dev/null +++ b/pkgs/client/335.nix @@ -0,0 +1,30 @@ +{ stdenv, requireFile, lib }: +stdenv.mkDerivation { + pname = "world-of-warcraft-client-en_US"; + version = "3.3.5a-12340"; + + preferLocalBuild = true; + + src = requireFile { + name = "WoW_335a_en_US"; + url = "https://download.wowdl.net/downloadFiles/Clients/World-of-Warcraft-3.3.5a.12340-enUS.zip"; + hash = "sha256-yBPxE/IXRh5nph8VSSwn1GnmjoGaNdI7PTpZ6ngE2H0="; + hashMode = "recursive"; + }; + + phases = [ "unpackPhase" "installPhase" ]; + + installPhase = '' + mkdir -p $out + cp -rv . $out/ + ''; + + passthru = { + locale = "en-US"; + }; + + meta = with lib; { + description = "World Of Warcraft client for 3.3.5a"; + maintainers = with maintainers; [ raitobezarius ]; + }; +} diff --git a/pkgs/maps/335.nix b/pkgs/maps/335.nix new file mode 100644 index 0000000..a83889b --- /dev/null +++ b/pkgs/maps/335.nix @@ -0,0 +1,14 @@ +{ wow_335a, trinitycore_335, callPackage, lib }: +let + extractors = callPackage ./generic.nix { + wowClient = wow_335a; + trinityCoreTools = trinitycore_335; + }; +in + { + dbc = extractors "dbc"; + maps = extractors "map"; + camera = extractors "camera"; + vmaps = extractors "vmaps"; + mmaps = extractors "mmaps"; +} diff --git a/pkgs/maps/generic.nix b/pkgs/maps/generic.nix new file mode 100644 index 0000000..76858c5 --- /dev/null +++ b/pkgs/maps/generic.nix @@ -0,0 +1,63 @@ +{ wowClient, trinityCoreTools, stdenv, lib, symlinkJoin }: +let + extractor = assetVariant: + let + tool = { + "map" = "mapextractor"; + "dbc" = "mapextractor"; + "camera" = "mapextractor"; + "vmaps" = "vmap4extractor"; + "mmaps" = "mmaps_generator"; + }.${assetVariant}; + toolInvocation = { + "map" = "${tool} -i ${toString wowClient} -o $out -e 1"; + "dbc" = "${tool} -i ${toString wowClient} -o $out -e 2"; + "camera" = "${tool} -i ${toString wowClient} -o $out -e 4"; + "vmaps" = "${tool}"; + "mmaps" = "${tool}"; + }.${assetVariant}; + assembleInvocation = { + "vmaps" = "vmap4assembler Buildings $out/vmaps"; + "mmaps" = "rm -rf $out/mmaps && mv mmaps $out/mmaps"; + }.${assetVariant} or null; + targetDirectory = { + "map" = "maps"; + "dbc" = "dbc"; + "camera" = "Cameras"; + "vmaps" = "vmaps"; + "mmaps" = "mmaps"; + }.${assetVariant}; + in + stdenv.mkDerivation { + pname = "${assetVariant}-${wowClient.passthru.locale}"; + version = wowClient.version; + + src = if assetVariant == "mmaps" + then + symlinkJoin { + name = "${wowClient.name}-with-extracted-maps-and-vmaps-and-dbc"; + paths = [ + wowClient + (extractor "dbc") + (extractor "map") + (extractor "vmaps") + ]; + } else wowClient; + + preferLocalBuild = assetVariant != "mmaps"; + + nativeBuildInputs = [ + trinityCoreTools + ]; + + buildPhase = '' + mkdir -p $out/${targetDirectory} + ${toolInvocation} + ''; + + installPhase = lib.optionalString (assembleInvocation != null) '' + ${assembleInvocation} + ''; + }; +in + extractor