CCE

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.

nix:tangle ~/nix/pkgs/drawingbot.nix
{ pkgs,
  name ? "drawingbotv3-free",
  ... }:

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

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

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

    mv opt/drawingbotv3/bin/DrawingBotV3-Premium $out/bin/${name}-unwrapped
    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-unwrapped-wrapped.cfg

    makeWrapper ${steam-run}/bin/steam-run $out/bin/${name} \
    --add-flags "$out/bin/${name}-unwrapped" \
    --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath buildInputs}:${pkgs.jogl}" \
    --prefix JARDIR : "${pkgs.jogl}/share/java/"
  '';

  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 ];
  };
}
nix:tangle ~/nix/hm/drawingbot.nix
{ pkgs, ... }:

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