1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00

vtfedit: init at 1.3.3 (#258646)

This commit is contained in:
Arne Keller 2024-12-09 16:24:24 +01:00 committed by GitHub
commit 7acb5c5b59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 112 additions and 0 deletions

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-vtfedit">
<comment xml:lang="en">Valve Texture Format</comment>
<glob pattern="*.vtf"/>
</mime-type>
</mime-info>

View file

@ -0,0 +1,80 @@
{
lib,
stdenv,
fetchzip,
fetchurl,
makeDesktopItem,
copyDesktopItems,
makeWrapper,
wine,
winetricks,
}:
stdenv.mkDerivation rec {
pname = "vtfedit";
version = "1.3.3";
src = fetchzip {
url = "https://nemstools.github.io/files/vtfedit${lib.replaceStrings [ "." ] [ "" ] version}.zip";
hash = "sha256-6a8YuxgYm7FB+2pFcZAMtE1db4hqpEk0z5gv2wHl9bI=";
stripRoot = false;
};
icon = fetchurl {
url = "https://web.archive.org/web/20230906220249im_/https://valvedev.info/tools/vtfedit/thumb.png";
hash = "sha256-Jpqo/s1wO2U5Z1DSZvADTfdH+8ycr0KF6otQbAE+jts=";
};
nativeBuildInputs = [
copyDesktopItems
makeWrapper
];
nativeRuntimeInputs = lib.makeBinPath [
wine
winetricks
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mkdir -p $out/share/icons/hicolor/256x256/apps
mkdir -p $out/share/lib
mkdir -p $out/share/mime/packages
substitute ${./vtfedit.bash} $out/bin/vtfedit \
--replace-fail "@out@" "${placeholder "out"}" \
--replace-fail "@path@" "${nativeRuntimeInputs}"
chmod +x $out/bin/vtfedit
cp ${icon} $out/share/icons/hicolor/256x256/apps/vtfedit.png
cp -r ${if wine.meta.mainProgram == "wine64" then "x64" else "x86"}/* $out/share/lib
cp ${./mimetype.xml} $out/share/mime/packages/vtfedit.xml
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
name = pname;
desktopName = "VTFEdit";
exec = "vtfedit %f";
icon = "vtfedit";
terminal = false;
categories = [ "Graphics" ];
comment = meta.description;
mimeTypes = [ "application/x-vtfedit" ];
})
];
meta = {
description = "VTF file viewer/editor";
homepage = "https://nemstools.github.io/pages/VTFLib.html";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.lgpl21Plus;
inherit (wine.meta) platforms;
maintainers = with lib.maintainers; [ paveloom ];
};
}

View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e
OUT="@out@"
PATH="@path@:$PATH"
PKGNAME="vtfedit"
PKGBIN="$OUT/share/lib/VTFEdit.exe"
export WINEDEBUG="-all"
export WINEPREFIX="$HOME/.local/share/$PKGNAME/wine"
if [[ ! -d "$WINEPREFIX" ]]; then
echo "Initialising the Wine prefix..."
WINEDLLOVERRIDES="mscoree=" winetricks -q winxp
echo "Installing DLLs..."
winetricks -q dlls dotnet20 vcrun2005
fi
wine "$PKGBIN" "$@"

View file

@ -11005,6 +11005,10 @@ with pkgs;
gtkVersion = "4";
};
vtfedit = callPackage ../by-name/vt/vtfedit/package.nix {
wine = wineWowPackages.staging;
};
vtk_9 = libsForQt5.callPackage ../development/libraries/vtk/9.x.nix { };
vtk_9_withQt5 = vtk_9.override { enableQt = true; };