nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 82 lines 2.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchzip, 5 fetchurl, 6 makeDesktopItem, 7 8 copyDesktopItems, 9 makeWrapper, 10 wineWowPackages, 11 winetricks, 12}: 13let 14 wine = wineWowPackages.staging; 15in 16stdenv.mkDerivation rec { 17 pname = "vtfedit"; 18 version = "1.3.3"; 19 20 src = fetchzip { 21 url = "https://nemstools.github.io/files/vtfedit${lib.replaceStrings [ "." ] [ "" ] version}.zip"; 22 hash = "sha256-6a8YuxgYm7FB+2pFcZAMtE1db4hqpEk0z5gv2wHl9bI="; 23 stripRoot = false; 24 }; 25 26 icon = fetchurl { 27 url = "https://web.archive.org/web/20230906220249im_/https://valvedev.info/tools/vtfedit/thumb.png"; 28 hash = "sha256-Jpqo/s1wO2U5Z1DSZvADTfdH+8ycr0KF6otQbAE+jts="; 29 }; 30 31 nativeBuildInputs = [ 32 copyDesktopItems 33 makeWrapper 34 ]; 35 36 nativeRuntimeInputs = lib.makeBinPath [ 37 wine 38 winetricks 39 ]; 40 41 installPhase = '' 42 runHook preInstall 43 44 mkdir -p $out/bin 45 mkdir -p $out/share/icons/hicolor/256x256/apps 46 mkdir -p $out/share/lib 47 mkdir -p $out/share/mime/packages 48 49 substitute ${./vtfedit.bash} $out/bin/vtfedit \ 50 --replace-fail "@out@" "${placeholder "out"}" \ 51 --replace-fail "@path@" "${nativeRuntimeInputs}" 52 chmod +x $out/bin/vtfedit 53 54 cp ${icon} $out/share/icons/hicolor/256x256/apps/vtfedit.png 55 cp -r ${if wine.meta.mainProgram == "wine64" then "x64" else "x86"}/* $out/share/lib 56 cp ${./mimetype.xml} $out/share/mime/packages/vtfedit.xml 57 58 runHook postInstall 59 ''; 60 61 desktopItems = [ 62 (makeDesktopItem { 63 name = pname; 64 desktopName = "VTFEdit"; 65 exec = "vtfedit %f"; 66 icon = "vtfedit"; 67 terminal = false; 68 categories = [ "Graphics" ]; 69 comment = meta.description; 70 mimeTypes = [ "application/x-vtfedit" ]; 71 }) 72 ]; 73 74 meta = { 75 description = "VTF file viewer/editor"; 76 homepage = "https://nemstools.github.io/pages/VTFLib.html"; 77 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 78 license = lib.licenses.lgpl21Plus; 79 inherit (wine.meta) platforms; 80 maintainers = [ ]; 81 }; 82}