Skip to content

Commit 54c06b3

Browse files
committed
vtfedit: init at 1.3.3
1 parent f0b484f commit 54c06b3

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
3+
<mime-type type="application/x-vtfedit">
4+
<comment xml:lang="en">Valve Texture Format</comment>
5+
<glob pattern="*.vtf"/>
6+
</mime-type>
7+
</mime-info>
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
lib,
3+
stdenv,
4+
fetchzip,
5+
fetchurl,
6+
makeDesktopItem,
7+
8+
copyDesktopItems,
9+
makeWrapper,
10+
wine,
11+
winetricks,
12+
}:
13+
14+
stdenv.mkDerivation rec {
15+
pname = "vtfedit";
16+
version = "1.3.3";
17+
18+
src = fetchzip {
19+
url = "https://nemstools.github.io/files/vtfedit${lib.replaceStrings [ "." ] [ "" ] version}.zip";
20+
hash = "sha256-6a8YuxgYm7FB+2pFcZAMtE1db4hqpEk0z5gv2wHl9bI=";
21+
stripRoot = false;
22+
};
23+
24+
icon = fetchurl {
25+
url = "https://web.archive.org/web/20230906220249im_/https://valvedev.info/tools/vtfedit/thumb.png";
26+
hash = "sha256-Jpqo/s1wO2U5Z1DSZvADTfdH+8ycr0KF6otQbAE+jts=";
27+
};
28+
29+
nativeBuildInputs = [
30+
copyDesktopItems
31+
makeWrapper
32+
];
33+
34+
nativeRuntimeInputs = lib.makeBinPath [
35+
wine
36+
winetricks
37+
];
38+
39+
installPhase = ''
40+
runHook preInstall
41+
42+
mkdir -p $out/bin
43+
mkdir -p $out/share/icons/hicolor/256x256/apps
44+
mkdir -p $out/share/lib
45+
mkdir -p $out/share/mime/packages
46+
47+
substitute ${./vtfedit.bash} $out/bin/vtfedit \
48+
--replace-fail "@out@" "${placeholder "out"}" \
49+
--replace-fail "@path@" "${nativeRuntimeInputs}"
50+
chmod +x $out/bin/vtfedit
51+
52+
cp ${icon} $out/share/icons/hicolor/256x256/apps/vtfedit.png
53+
cp -r ${if wine.meta.mainProgram == "wine64" then "x64" else "x86"}/* $out/share/lib
54+
cp ${./mimetype.xml} $out/share/mime/packages/vtfedit.xml
55+
56+
runHook postInstall
57+
'';
58+
59+
desktopItems = [
60+
(makeDesktopItem {
61+
name = pname;
62+
desktopName = "VTFEdit";
63+
exec = "vtfedit %f";
64+
icon = "vtfedit";
65+
terminal = false;
66+
categories = [ "Graphics" ];
67+
comment = meta.description;
68+
mimeTypes = [ "application/x-vtfedit" ];
69+
})
70+
];
71+
72+
meta = {
73+
description = "VTF file viewer/editor";
74+
homepage = "https://nemstools.github.io/pages/VTFLib.html";
75+
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
76+
license = lib.licenses.lgpl21Plus;
77+
inherit (wine.meta) platforms;
78+
maintainers = with lib.maintainers; [ paveloom ];
79+
};
80+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
OUT="@out@"
6+
PATH="@path@:$PATH"
7+
8+
PKGNAME="vtfedit"
9+
PKGBIN="$OUT/share/lib/VTFEdit.exe"
10+
11+
export WINEDEBUG="-all"
12+
export WINEPREFIX="$HOME/.local/share/$PKGNAME/wine"
13+
14+
if [[ ! -d "$WINEPREFIX" ]]; then
15+
echo "Initialising the Wine prefix..."
16+
WINEDLLOVERRIDES="mscoree=" winetricks -q winxp
17+
echo "Installing DLLs..."
18+
winetricks -q dlls dotnet20 vcrun2005
19+
fi
20+
21+
wine "$PKGBIN" "$@"

pkgs/top-level/all-packages.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11027,6 +11027,10 @@ with pkgs;
1102711027
gtkVersion = "4";
1102811028
};
1102911029

11030+
vtfedit = callPackage ../by-name/vt/vtfedit/package.nix {
11031+
wine = wineWowPackages.staging;
11032+
};
11033+
1103011034
vtk_9 = libsForQt5.callPackage ../development/libraries/vtk/9.x.nix { };
1103111035

1103211036
vtk_9_withQt5 = vtk_9.override { enableQt = true; };

0 commit comments

Comments
 (0)