86 lines
2.1 KiB
Nix
86 lines
2.1 KiB
Nix
|
|
{
|
||
|
|
stdenv,
|
||
|
|
makeWrapper,
|
||
|
|
makeDesktopItem,
|
||
|
|
copyDesktopItems,
|
||
|
|
icoutils,
|
||
|
|
wine,
|
||
|
|
mfc42,
|
||
|
|
# The Paint binary lifted out of a Windows XP install.
|
||
|
|
exe,
|
||
|
|
}:
|
||
|
|
|
||
|
|
stdenv.mkDerivation {
|
||
|
|
pname = "mspaintxp";
|
||
|
|
version = "xp";
|
||
|
|
|
||
|
|
src = exe;
|
||
|
|
dontUnpack = true;
|
||
|
|
|
||
|
|
nativeBuildInputs = [
|
||
|
|
makeWrapper
|
||
|
|
copyDesktopItems
|
||
|
|
icoutils
|
||
|
|
];
|
||
|
|
|
||
|
|
desktopItems = [
|
||
|
|
(makeDesktopItem {
|
||
|
|
name = "mspaintxp";
|
||
|
|
desktopName = "Paint (Windows XP)";
|
||
|
|
genericName = "Image Editor";
|
||
|
|
exec = "mspaintxp %f";
|
||
|
|
icon = "mspaintxp";
|
||
|
|
categories = [
|
||
|
|
"Graphics"
|
||
|
|
"2DGraphics"
|
||
|
|
"RasterGraphics"
|
||
|
|
];
|
||
|
|
mimeTypes = [
|
||
|
|
"image/bmp"
|
||
|
|
"image/gif"
|
||
|
|
"image/jpeg"
|
||
|
|
"image/png"
|
||
|
|
"image/tiff"
|
||
|
|
];
|
||
|
|
# Wine names the window class after the .exe; this lets the taskbar
|
||
|
|
# match the running window back to this entry.
|
||
|
|
startupWMClass = "mspaint.exe";
|
||
|
|
})
|
||
|
|
];
|
||
|
|
|
||
|
|
# Windows DLLs this .exe needs at runtime. Works like buildInputs: Nix hands
|
||
|
|
# the list to the builder as a space-separated string of store paths, and
|
||
|
|
# installPhase pulls $dep/windll out of each one. Add a dependency by adding
|
||
|
|
# a package here.
|
||
|
|
winDlls = [ mfc42 ];
|
||
|
|
|
||
|
|
installPhase = ''
|
||
|
|
runHook preInstall
|
||
|
|
|
||
|
|
app=$out/share/mspaintxp
|
||
|
|
install -Dm644 $src $app/mspaint.exe
|
||
|
|
|
||
|
|
# Wine resolves imports from the .exe's own directory first, so the
|
||
|
|
# dependencies only have to land next to it.
|
||
|
|
for dep in $winDlls; do
|
||
|
|
install -Dm644 $dep/windll/*.dll -t $app
|
||
|
|
done
|
||
|
|
|
||
|
|
makeWrapper ${wine}/bin/wine $out/bin/mspaintxp \
|
||
|
|
--add-flags $app/mspaint.exe
|
||
|
|
|
||
|
|
# Resource group 2 is Paint's own application icon (the pencil cup);
|
||
|
|
# it ships 16/32/48px variants, of which the 32-bit ones look best.
|
||
|
|
wrestool -x -t 14 -n 2 $src -o app.ico
|
||
|
|
for size in 16 32 48; do
|
||
|
|
icons=$out/share/icons/hicolor/''${size}x''${size}/apps
|
||
|
|
mkdir -p $icons
|
||
|
|
icotool -x --bit-depth=32 --width=$size --height=$size \
|
||
|
|
-o $icons/mspaintxp.png app.ico
|
||
|
|
done
|
||
|
|
|
||
|
|
runHook postInstall
|
||
|
|
'';
|
||
|
|
|
||
|
|
meta.mainProgram = "mspaintxp";
|
||
|
|
}
|