complete-computing-environment/drawingbot-v3.org

2.9 KiB

DrawingBot

DrawingBotV3 is a software for converting images to line drawings for Plotters / Drawing Machines / 3D printers. It also serves as an application for visual artists to create stylised line drawings from images / video

DrawingBot V3 on NixOS

DrawingBot uses JavaFX and is distributed as a rpm, deb, or windows MSI… The Premium version is just shoved in to my Syncthing directory and is provided in an override in rixpkgs. It should work just fine with the free/libre version which is lib.license.gplv3, but I use the proprietary version and so this is actually untested. This package declaration takes a deb file and extracts it and repackages it.

{ pkgs,
  name ? "drawingbotv3-free",
  ... }:

with pkgs;
let
  jdkWithJavaFX = jdk.override { enableJavaFX = true; };
in
stdenv.mkDerivation rec {
  inherit name;
  version = "1.6.9-beta";

  src = fetchurl {
    url = "https://github.com/SonarSonic/DrawingBotV3/releases/download/v${version}-free/DrawingBotV3-Free-${version}-linux.deb";
    sha256 = lib.fakeSha256;
  };
  nativeBuildInputs = [ dpkg wrapGAppsHook autoPatchelfHook makeWrapper ];
  buildInputs = [ xorg.libXtst alsa-lib opencv gtk2 ];

  unpackPhase = "dpkg -x $src ./";
  installPhase = ''
    mkdir -p $out/lib/ $out/bin/ $out/share/icons

    mv opt/drawingbotv3/bin/DrawingBotV3-Premium $out/bin/${name}
    mv opt/drawingbotv3/lib/{app,libapplauncher.so} $out/lib/
    # mv opt/drawingbotv3/lib/runtime $out/lib/
    ln -s ${jdkWithJavaFX}/lib/openjdk $out/lib/runtime
    mv opt/drawingbotv3/lib/DrawingBotV3-Premium.png $out/share/icons

    ln -s $out/lib/app/DrawingBotV3-Premium.cfg $out/lib/app/..drawingbotv3-premium-wrapped-wrapped.cfg

    wrapProgram "$out/bin/${name}" \
      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath buildInputs}" 
  '';

  desktopItems = [
    (makeDesktopItem {
      name = "drawingbotv3-premium";
      desktopName = "DrawingBotV3-Premium";
      type = "Application";
      exec = name;
      icon = "DrawingBotV3-Premium.png";
      categories = ["Graphics"];
    })
  ];

  meta = {
    homepage = "https://github.com/SonarSonic/DrawingBotV3";
    description = "DrawingBotV3 is a software for converting images to line drawings";
    license = lib.licenses.gplv3;
    maintainers = with lib.maintainers; [ rrix ];
  };
}
{ pkgs, ... }:

{ 
  home.packages =  [ pkgs.drawingbot-premium ];
}