From 0e044f2daafc892d2f9c5464f7f5725aea7930af Mon Sep 17 00:00:00 2001 From: Nicole Date: Tue, 24 Feb 2026 10:43:32 +0100 Subject: [PATCH] Added anycubic slicer next custom package --- .../pkgs/anycubic-slicer-next/default.nix | 3 + .../pkgs/anycubic-slicer-next/package.nix | 137 ++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 etc/nixos/modules/pkgs/anycubic-slicer-next/default.nix create mode 100644 etc/nixos/modules/pkgs/anycubic-slicer-next/package.nix diff --git a/etc/nixos/modules/pkgs/anycubic-slicer-next/default.nix b/etc/nixos/modules/pkgs/anycubic-slicer-next/default.nix new file mode 100644 index 0000000..a9da50f --- /dev/null +++ b/etc/nixos/modules/pkgs/anycubic-slicer-next/default.nix @@ -0,0 +1,3 @@ +{ pkgs ? import {} }: + +pkgs.callPackage ./package.nix {} diff --git a/etc/nixos/modules/pkgs/anycubic-slicer-next/package.nix b/etc/nixos/modules/pkgs/anycubic-slicer-next/package.nix new file mode 100644 index 0000000..09fb440 --- /dev/null +++ b/etc/nixos/modules/pkgs/anycubic-slicer-next/package.nix @@ -0,0 +1,137 @@ +{ + lib, + stdenv, + fetchurl, + autoPatchelfHook, + dpkg, + buildFHSEnv, + gtk3, + glib, + glibc, + libGL, + mesa, + cairo, + pango, + gdk-pixbuf, + atk, + dbus, + libX11, + libXext, + libXrender, + libXtst, + libXi, + libXfixes, + libxcb, + libXcomposite, + libXcursor, + libXdamage, + libXrandr, + libXScrnSaver, + alsa-lib, + udev, + nspr, + nss, + expat, + cups, + at-spi2-atk, + at-spi2-core, + libdrm, + wayland, + libxkbcommon, + webkitgtk_4_1, + openssl, + zlib, + libpng, + libjpeg, + freetype, + fontconfig, + sqlite, + curl, +}: + +let + unwrapped = stdenv.mkDerivation rec { + pname = "anycubic-slicer-next-unwrapped"; + version = "1.3.7171-20250928"; + + src = fetchurl { + url = "https://cdn-universe-slicer.anycubic.com/prod/dists/noble/main/binary-amd64/AnycubicSlicerNext-1.3.7171_20250928_162543-Ubuntu_24_04_2_LTS.deb"; + hash = "sha256-oB/oY8xO/o+UOXR4K/yy0dAIrjB3ztBl9j24k9ceH5I="; + }; + + nativeBuildInputs = [ autoPatchelfHook dpkg ]; + + buildInputs = [ + gtk3 glib glibc libGL mesa cairo pango gdk-pixbuf atk dbus + libX11 libXext libXrender libXtst libXi libXfixes libxcb + libXcomposite libXcursor libXdamage libXrandr libXScrnSaver + alsa-lib udev nspr nss expat cups at-spi2-atk at-spi2-core + libdrm wayland libxkbcommon webkitgtk_4_1 openssl zlib libpng + libjpeg freetype fontconfig sqlite curl + ]; + + autoPatchelfLibs = [ "lib/anycubic-slicer-next" ]; + + unpackPhase = "dpkg-deb -x $src unpacked"; + + installPhase = '' + runHook preInstall + + install -Dm755 unpacked/usr/bin/AnycubicSlicerNext \ + $out/lib/anycubic-slicer-next/AnycubicSlicerNext + + find unpacked -name '*.so' -o -name '*.so.*' | while read f; do + install -Dm755 "$f" $out/lib/anycubic-slicer-next/$(basename "$f") + done + + mkdir -p $out/share + cp -r unpacked/usr/share/AnycubicSlicerNext $out/share/AnycubicSlicerNext + + runHook postInstall + ''; + }; + + runtimeLibs = [ + gtk3 glib glibc libGL mesa cairo pango gdk-pixbuf atk dbus + libX11 libXext libXrender libXtst libXi libXfixes libxcb + libXcomposite libXcursor libXdamage libXrandr libXScrnSaver + alsa-lib udev nspr nss expat cups at-spi2-atk at-spi2-core + libdrm wayland libxkbcommon webkitgtk_4_1 openssl zlib libpng + libjpeg freetype fontconfig sqlite curl + ]; + +in buildFHSEnv { + name = "AnycubicSlicerNext"; + targetPkgs = _: runtimeLibs ++ [ unwrapped ]; + + extraBwrapArgs = [ + "--ro-bind" "${unwrapped}/share/AnycubicSlicerNext" "/usr/share/AnycubicSlicerNext" + ]; + + runScript = "/lib/anycubic-slicer-next/AnycubicSlicerNext"; + + extraInstallCommands = '' + mkdir -p $out/share/applications + cat > $out/share/applications/AnycubicSlicerNext.desktop << EOF +[Desktop Entry] +Name=Anycubic Slicer Next +Comment=G-code slicer for Anycubic 3D printers +Exec=$out/bin/AnycubicSlicerNext +Icon=AnycubicSlicer +Terminal=false +Type=Application +Categories=Graphics;3DGraphics;Engineering; +StartupNotify=true +EOF + ''; + + meta = with lib; { + description = "G-code slicer for Anycubic 3D printers, based on OrcaSlicer"; + homepage = "https://wiki.anycubic.com/en/software-and-app/anycubic-slicer-next-linux"; + license = licenses.agpl3Only; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + platforms = [ "x86_64-linux" ]; + mainProgram = "AnycubicSlicerNext"; + maintainers = [ ]; + }; +}