diff --git a/pkgs/applications/misc/k40-whisperer/default.nix b/pkgs/applications/misc/k40-whisperer/default.nix new file mode 100644 index 00000000000..b50a1751510 --- /dev/null +++ b/pkgs/applications/misc/k40-whisperer/default.nix @@ -0,0 +1,74 @@ +{ stdenv +, makeWrapper +, writeText +, python3 +, fetchzip +, inkscape +, lib +, udevGroup ? "k40" +}: + +let + pythonEnv = python3.withPackages (ps: with ps; [ + lxml + pyusb + pillow + pyclipper + tkinter + ]); + + udevRule = writeText "k40-whisperer.rules" '' + SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5512", ENV{DEVTYPE}=="usb_device", MODE="0664", GROUP="${udevGroup}" + ''; + +in stdenv.mkDerivation rec { + pname = "k40-whisperer"; + version = "0.59"; + + src = fetchzip { + url = "https://www.scorchworks.com/K40whisperer/K40_Whisperer-${version}_src.zip"; + stripRoot = true; + sha256 = "0r8rhaksk87l44pwwpvrfnck2lyic3lgcbh3pi7ib6mrwbsyhlni"; + }; + + nativeBuildInputs = [ makeWrapper ]; + + patchPhase = '' + substituteInPlace svg_reader.py \ + --replace '"/usr/bin/inkscape"' '"${inkscape}/bin/inkscape"' + ''; + + buildPhase = ""; + + installPhase = '' + mkdir -p $out + cp -p * $out + + mkdir -p $out/bin + mkdir -p $out/lib/udev/rules.d + + ln -s ${udevRule} $out/lib/udev/rules.d/97-k40-whisperer.rules + + makeWrapper '${pythonEnv.interpreter}' $out/bin/k40-whisperer \ + --add-flags $out/k40_whisperer.py \ + --prefix PYTHONPATH : $out + ''; + + meta = with lib; { + description = '' + Control software for the stock K40 Laser controller + ''; + mainProgram = "k40-whisperer"; + longDescription = '' + K40 Whisperer is an alternative to the the Laser Draw (LaserDRW) program that comes with the cheap Chinese laser cutters available on E-Bay and Amazon. + K40 Whisperer reads SVG and DXF files, interprets the data and sends commands to the K40 controller to move the laser head and control the laser accordingly. + K40 Whisperer does not require a USB key (dongle) to function. + ''; + homepage = "https://www.scorchworks.com/K40whisperer/k40whisperer.html"; + downloadPage = "https://www.scorchworks.com/K40whisperer/k40whisperer.html#download"; + license = licenses.gpl3; + maintainers = with maintainers; [ fooker ]; + platforms = platforms.all; + }; +} + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 247298df58e..d1c8b688568 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -33175,6 +33175,8 @@ with pkgs; jstest-gtk = callPackage ../tools/misc/jstest-gtk { }; + k40-whisperer = callPackage ../applications/misc/k40-whisperer { }; + keynav = callPackage ../tools/X11/keynav { }; kgx = callPackage ../applications/terminal-emulators/kgx { };