diff --git a/pkgs/applications/graphics/blockbench-electron/default.nix b/pkgs/applications/graphics/blockbench-electron/default.nix deleted file mode 100644 index 50a10310546d..000000000000 --- a/pkgs/applications/graphics/blockbench-electron/default.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ lib, stdenv, fetchurl, appimageTools, makeWrapper, electron_25 }: - -stdenv.mkDerivation rec { - pname = "blockbench-electron"; - version = "4.8.1"; - - src = fetchurl { - url = "https://github.com/JannisX11/blockbench/releases/download/v${version}/Blockbench_${version}.AppImage"; - sha256 = "sha256-CE2wDOt1WBcYmPs4sEyZ3LYvKLequFZH0B3huMYHlwA="; - name = "${pname}-${version}.AppImage"; - }; - - appimageContents = appimageTools.extractType2 { - name = "${pname}-${version}"; - inherit src; - }; - - dontUnpack = true; - dontConfigure = true; - dontBuild = true; - - nativeBuildInputs = [ makeWrapper ]; - - installPhase = '' - runHook preInstall - mkdir -p $out/bin $out/share/${pname} $out/share/applications - cp -a ${appimageContents}/{locales,resources} $out/share/${pname} - cp -a ${appimageContents}/blockbench.desktop $out/share/applications/${pname}.desktop - cp -a ${appimageContents}/usr/share/icons $out/share - substituteInPlace $out/share/applications/${pname}.desktop \ - --replace 'Exec=AppRun' 'Exec=${pname}' - runHook postInstall - ''; - - postFixup = '' - makeWrapper ${electron_25}/bin/electron $out/bin/${pname} \ - --add-flags $out/share/${pname}/resources/app.asar \ - --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc ]}" - ''; - - meta = with lib; { - description = "A boxy 3D model editor powered by Electron"; - homepage = "https://blockbench.net/"; - license = licenses.gpl3Only; - maintainers = with maintainers; [ ckie ]; - platforms = [ "x86_64-linux" ]; - }; -} diff --git a/pkgs/by-name/bl/blockbench/package.nix b/pkgs/by-name/bl/blockbench/package.nix new file mode 100644 index 000000000000..fb19793583c4 --- /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; + }; +} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index def4ad4e0bd3..bf48bcda641c 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -111,6 +111,7 @@ mapAliases ({ lib.warn "blender-with-packages is deprecated in favor of blender.withPackages, e.g. `blender.withPackages(ps: [ ps.foobar ])`" (blender.withPackages (_: args.packages)).overrideAttrs (lib.optionalAttrs (args ? name) { pname = "blender-" + args.name; }); # Added 2023-10-30 + blockbench-electron = blockbench; # Added 2024-03-16 bluezFull = throw "'bluezFull' has been renamed to/replaced by 'bluez'"; # Converted to throw 2023-09-10 bookletimposer = throw "bookletimposer has been removed from nixpkgs; upstream unmaintained and broke with pypdf3"; # Added 2024-01-01 boost168 = throw "boost168 has been deprecated in favor of the latest version"; # Added 2023-06-08 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 750265b61931..583c03370fb0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3555,8 +3555,6 @@ with pkgs; blackmagic-desktop-video = callPackage ../tools/video/blackmagic-desktop-video { }; - blockbench-electron = callPackage ../applications/graphics/blockbench-electron { }; - blocksat-cli = with python3Packages; toPythonApplication blocksat-cli; bmap-tools = callPackage ../tools/misc/bmap-tools { };