diff options
author | TomaSajt <62384384+TomaSajt@users.noreply.github.com> | 2024-01-09 14:16:41 +0100 |
---|---|---|
committer | ckie <git-525ff67@ckie.dev> | 2024-03-16 05:47:48 +0200 |
commit | a391b6ba1449e338e2c95ff5e92e21ed3c661de0 (patch) | |
tree | 46f8726263ac3e30fcdafe8c38350a36fdfa1f0e /pkgs/by-name | |
parent | fc405ec2d865736e49f747699f21e0eacdf5ea7d (diff) |
blockbench: 4.8.1 -> 4.9.4, refactor
Diffstat (limited to 'pkgs/by-name')
-rw-r--r-- | pkgs/by-name/bl/blockbench/package.nix | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/pkgs/by-name/bl/blockbench/package.nix b/pkgs/by-name/bl/blockbench/package.nix new file mode 100644 index 0000000000000..fb19793583c43 --- /dev/null +++ b/pkgs/by-name/bl/blockbench/package.nix @@ -0,0 +1,87 @@ +{ lib +, stdenv +, buildNpmPackage +, fetchFromGitHub +, imagemagick +, makeWrapper +, makeDesktopItem +, copyDesktopItems +, electron_28 +}: + +let + electron = electron_28; +in +buildNpmPackage rec { + pname = "blockbench"; + version = "4.9.4"; + + src = fetchFromGitHub { + owner = "JannisX11"; + repo = "blockbench"; + rev = "v${version}"; + hash = "sha256-z4hr1pQh7Jp/DB8+pxwuHvi4gvTHHVn0yrruwnXm2iM="; + }; + + nativeBuildInputs = [ + imagemagick # for icon resizing + makeWrapper + copyDesktopItems + ]; + + npmDepsHash = "sha256-onfz+J77jNIgdc7ALiyoXt1CdTyX/C7+bKwtpJm+H+I="; + + env.ELECTRON_SKIP_BINARY_DOWNLOAD = 1; + + npmBuildScript = "bundle"; + + postBuild = '' + npm exec electron-builder -- \ + --dir \ + -c.electronDist=${electron}/libexec/electron \ + -c.electronVersion=${electron.version} + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/blockbench + cp -r dist/*-unpacked/{locales,resources{,.pak}} $out/share/blockbench + + for size in 16 32 48 64 128 256 512; do + mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps + convert -resize "$size"x"$size" icon.png $out/share/icons/hicolor/"$size"x"$size"/apps/blockbench.png + done + + makeWrapper ${lib.getExe electron} $out/bin/blockbench \ + --add-flags $out/share/blockbench/resources/app.asar \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \ + --inherit-argv0 + + runHook postInstall + ''; + + # based on desktop file found in the published AppImage archive + desktopItems = [ + (makeDesktopItem { + name = "blockbench"; + exec = "blockbench %U"; + icon = "blockbench"; + desktopName = "Blockbench"; + comment = meta.description; + categories = [ "3DGraphics" ]; + startupWMClass = "Blockbench"; + terminal = false; + }) + ]; + + meta = { + changelog = "https://github.com/JannisX11/blockbench/releases/tag/${src.rev}"; + description = "Low-poly 3D modeling and animation software"; + homepage = "https://blockbench.net/"; + license = lib.licenses.gpl3Only; + mainProgram = "blockbench"; + maintainers = with lib.maintainers; [ ckie tomasajt ]; + broken = stdenv.isDarwin; + }; +} |