Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vtfedit: init at 1.3.3 #258646

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkgs/by-name/vt/vtfedit/mimetype.xml
Original file line number Diff line number Diff line change
@@ -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>
80 changes: 80 additions & 0 deletions pkgs/by-name/vt/vtfedit/package.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
}
21 changes: 21 additions & 0 deletions pkgs/by-name/vt/vtfedit/vtfedit.bash
Original file line number Diff line number Diff line change
@@ -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" "$@"
4 changes: 4 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23317,6 +23317,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 {
inherit (darwin) libobjc;
inherit (darwin.apple_sdk.libs) xpc;
Expand Down