{ lib, stdenv, fetchFromGitHub, fetchgit , cmake, pkg-config, makeWrapper , bzip2, xz, zstd, zlib-ng , openssl, cryptopp }: stdenv.mkDerivation (self: { pname = "vtf-thumbnailer"; version = "0.2.0"; src = fetchFromGitHub { owner = "craftablescience"; repo = self.pname; tag = "v${self.version}"; fetchSubmodules = true; hash = "sha256-cK8S9ozZXCzo8WWWazafyiPi+7YHWd950xODPd9x/aE="; }; 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 ]; buildInputs = [ bzip2 cryptopp openssl pkg-config xz zlib-ng zstd ]; patches = [ ./fix-miniz-cmake-dirs.patch ./fix-cmake-outputs.patch ]; cmakeFlags = with self; [ (lib.cmakeFeature "CRYPTOPP_SOURCES" "${cryptopp-src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_ZLIB" "${zlib-src}") (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.cmakeBool "MZ_OPENSSL" true) (lib.cmakeBool "MARETF_BUILD_INSTALLER" true) (lib.cmakeFeature "CPACK_GENERATOR" "DEB") ]; postUnpack = '' cp -r ${self.bzip2-src} /build/bzip2tmp chmod -R +w /build/bzip2tmp ''; postFixup = '' substituteInPlace $out/share/thumbnailers/vtf-thumbnailer.thumbnailer \ --replace "/opt/vtf-thumbnailer" "$out/bin" \ --replace "image/x-vtf;" "image/x-vtf;image/vnd.valve.source.texture;" ''; LANG = "C.UTF-8"; meta = { description = "Adds previews for VTF files in your file explorer of choice on Windows and Linux"; homepage = "https://github.com/craftablescience/vtf-thumbnailer"; license = lib.licenses.mit; platforms = [ "x86_64-linux" ]; changelog = "https://github.com/craftablescience/vtf-thumbnailer/releases/tag/v${self.version}"; }; })