{ lib, stdenv, fetchgit, fetchFromGitHub, cmake, openssl, qt6, zlib-ng, bzip2, xz, zstd, cryptopp, pkg-config, makeWrapper, versionCheckHook, }: stdenv.mkDerivation (finalAttrs: { pname = "vpkedit"; version = "5.0.0-beta.1"; # FIXME: when updating, see if versions match again & we can get rid of this. # pls dont let it last longer than it needs to kthx passthru.tmpVerMismatch = assert finalAttrs.version == "5.0.0-beta.1"; "5.0.0.1"; src = fetchFromGitHub { owner = "craftablescience"; repo = finalAttrs.pname; tag = "v${finalAttrs.passthru.tmpVerMismatch}"; fetchSubmodules = true; hash = "sha256-CPL+pPVrkbTIktskRsgHHgarg4edf0s3U2pnJ5/6h8E="; }; /* The following sources should be updated to what was available at the time of VPKEdit's release, according to the vendored submodules and their nested submodules. These need to exist to avoid CMake's FetchContent trying to pull stuff over the network. v5.0.0.1 - src/thirdparty/sourcepp @ 6ba306ad - ext/cryptopp (which is actually cryptopp-cmake) @ gedb9a71 - sources cryptopp (the actual one) from latest release tag of https://github.com/weidai11/cryptopp - ext/minizip-ng @ heads/develop which at time of v5.0.0.1 commit was 2c0dc5d8 - sources zlib from stable branch of https://github.com/zlib-ng/zlib-ng (pinned to latest release tag) - sources bzip2 from master branch of https://gitlab.com/bzip2/bzip2 (seemingly assuming - sources xz from master branch of https://github.com/tukaani-project/xz - sources zstd from release branch of https://github.com/facebook/zstd (pinned to latest release tag) */ cryptopp-src = fetchgit { url = "https://github.com/weidai11/cryptopp"; tag = "CRYPTOPP_8_9_0"; hash = "sha256-HV+afSFkiXdy840JbHBTR8lLL0GMwsN3QdwaoQmicpQ="; }; zlib-src = fetchgit { url = "https://github.com/zlib-ng/zlib-ng"; tag = "2.2.5"; hash = "sha256-VB4aegnZCZut9H/Hu2PBwwldpbM7E67D5QFYCKgq3mg="; }; bzip2-src = fetchgit { url = "https://gitlab.com/bzip2/bzip2"; rev = "66c46b8c9436613fd81bc5d03f63a61933a4dcc3"; hash = "sha256-JuwmLBwtUPW9Wt31wIX5NMCu0VTxt16XaBQ2c5rFTY4="; }; xz-src = fetchgit { url = "https://github.com/tukaani-project/xz"; tag = "v5.8.1"; hash = "sha256-29w1K3zC58oFkBvSdwpKu694S+42FxzqOtWBpS7iJ+A="; }; zstd-src = fetchgit { url = "https://github.com/facebook/zstd"; tag = "v1.5.7"; hash = "sha256-tNFWIT9ydfozB8dWcmTMuZLCQmQudTFJIkSr0aG7S44="; }; nativeBuildInputs = [ cmake makeWrapper qt6.wrapQtAppsHook ]; buildInputs = [ bzip2 cryptopp openssl pkg-config qt6.qtbase qt6.qttools xz zlib-ng zstd ]; cmakeFlags = with finalAttrs; [ (lib.cmakeFeature "CRYPTOPP_SOURCES" "${cryptopp-src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_ZLIB" "${zlib-src}") # it wants write access now. wowee. (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_BZIP2" "/build/bzip2tmp") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_LIBLZMA" "${xz-src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_ZSTD" "${zstd-src}") (lib.cmakeFeature "CPACK_GENERATOR" "DEB") (lib.cmakeBool "MZ_OPENSSL" true) ]; patches = [ ./0001-nix-translation-base-fixup.patch ./fix-miniz-cmake-dirs.patch ]; postInstall = '' mkdir -p $out/lib/vpkedit/i18n mv *.qm $out/lib/vpkedit/i18n ''; postUnpack = '' cp -r ${finalAttrs.bzip2-src} /build/bzip2tmp chmod -R +w /build/bzip2tmp ''; # doesnt seem to make any real difference but it complained and i listened LANG = "C.UTF-8"; nativeInstallCheckInputs = [ versionCheckHook ]; versionCheckProgram = "${placeholder "out"}/bin/vpkeditcli"; doInstallCheck = true; meta = { description = "CLI/GUI tool to create, read, and write several pack file formats"; homepage = "https://github.com/craftablescience/VPKEdit"; mainProgram = "vpkeditcli"; license = lib.licenses.mit; platforms = [ "x86_64-linux" ]; changelog = "https://github.com/craftablescience/VPKEdit/releases/tag/v${finalAttrs.passthru.tmpVerMismatch}"; }; })