nbdesigner installation

This commit is contained in:
Gregory Bednov 2026-09-11 15:21:02 +03:00
commit 6987545aca
2 changed files with 60 additions and 0 deletions

View file

@ -0,0 +1,55 @@
{
stdenv, makeWrapper, makeDesktopItem, copyDesktopItems,
icoutils, wine, mfc42, src,
}:
stdenv.mkDerivation {
pname = "nbdesigner";
version = "1.36.0";
inherit src;
sourceRoot = "NB-Designer";
nativeBuildInputs = [ makeWrapper copyDesktopItems icoutils ];
desktopItems = [(makeDesktopItem {
name = "nbdesigner";
desktopName = "NB-Designer";
genericName = "HMI Programming";
exec = "nbdesigner";
icon = "nbdesigner";
categories = [ "Development" ];
startupWMClass = "NB-Designer.exe";
})];
winDlls = [ mfc42 ];
installPhase = ''
runHook preInstall
app=$out/share/nbdesigner
install -d $app
cp -r . $app/
for dep in $winDlls; do
install -Dm644 $dep/windll/*.dll -t $app
done
makeWrapper ${wine}/bin/wine $out/bin/nbdesigner \
--run '
PREFIX="$HOME/.local/share/nbdesigner-prefix"
if [ ! -d "$PREFIX" ]; then
WINEPREFIX="$PREFIX" WINEARCH=win32 wine wineboot --init 2>/dev/null
fi
export WINEPREFIX="$PREFIX"
export WINEARCH=win32
' \
--add-flags "$app/NB-Designer.exe"
wrestool -x -t 14 -n 1 NB-Designer.exe -o app.ico 2>/dev/null || true
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/nbdesigner.png app.ico 2>/dev/null || true
done
runHook postInstall
'';
meta.mainProgram = "nbdesigner";
}