Merge pull request #152471 from fooker/pr/k40-whisperer-init

k40-whisperer: init at 0.59

authored by Martin Weinelt and committed by GitHub 3ba9c561 d013bbaa

+128
+9
nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
··· 147 </listitem> 148 <listitem> 149 <para> 150 <link xlink:href="https://github.com/mgumz/mtr-exporter">mtr-exporter</link>, 151 a Prometheus exporter for mtr metrics. Available as 152 <link xlink:href="options.html#opt-services.mtr-exporter.enable">services.mtr-exporter</link>.
··· 147 </listitem> 148 <listitem> 149 <para> 150 + <link xlink:href="https://www.scorchworks.com/K40whisperer/k40whisperer.html">K40-Whisperer</link>, 151 + a program to control cheap Chinese laser cutters. Available as 152 + <link xlink:href="options.html#opt-programs.k4-whisperer.enable">programs.k40-whisperer.enable</link>. 153 + Users must add themselves to the <literal>k40</literal> group 154 + to be able to access the device. 155 + </para> 156 + </listitem> 157 + <listitem> 158 + <para> 159 <link xlink:href="https://github.com/mgumz/mtr-exporter">mtr-exporter</link>, 160 a Prometheus exporter for mtr metrics. Available as 161 <link xlink:href="options.html#opt-services.mtr-exporter.enable">services.mtr-exporter</link>.
+2
nixos/doc/manual/release-notes/rl-2205.section.md
··· 45 46 - [maddy](https://maddy.email), a composable all-in-one mail server. Available as [services.maddy](options.html#opt-services.maddy.enable). 47 48 - [mtr-exporter](https://github.com/mgumz/mtr-exporter), a Prometheus exporter for mtr metrics. Available as [services.mtr-exporter](options.html#opt-services.mtr-exporter.enable). 49 50 - [tetrd](https://tetrd.app), share your internet connection from your device to your PC and vice versa through a USB cable. Available at [services.tetrd](#opt-services.tetrd.enable).
··· 45 46 - [maddy](https://maddy.email), a composable all-in-one mail server. Available as [services.maddy](options.html#opt-services.maddy.enable). 47 48 + - [K40-Whisperer](https://www.scorchworks.com/K40whisperer/k40whisperer.html), a program to control cheap Chinese laser cutters. Available as [programs.k40-whisperer.enable](options.html#opt-programs.k4-whisperer.enable). Users must add themselves to the `k40` group to be able to access the device. 49 + 50 - [mtr-exporter](https://github.com/mgumz/mtr-exporter), a Prometheus exporter for mtr metrics. Available as [services.mtr-exporter](options.html#opt-services.mtr-exporter.enable). 51 52 - [tetrd](https://tetrd.app), share your internet connection from your device to your PC and vice versa through a USB cable. Available at [services.tetrd](#opt-services.tetrd.enable).
+1
nixos/modules/module-list.nix
··· 167 ./programs/iftop.nix 168 ./programs/iotop.nix 169 ./programs/java.nix 170 ./programs/kdeconnect.nix 171 ./programs/kbdlight.nix 172 ./programs/less.nix
··· 167 ./programs/iftop.nix 168 ./programs/iotop.nix 169 ./programs/java.nix 170 + ./programs/k40-whisperer.nix 171 ./programs/kdeconnect.nix 172 ./programs/kbdlight.nix 173 ./programs/less.nix
+40
nixos/modules/programs/k40-whisperer.nix
···
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + with lib; 4 + 5 + let 6 + cfg = config.programs.k40-whisperer; 7 + pkg = cfg.package.override { 8 + udevGroup = cfg.group; 9 + }; 10 + in 11 + { 12 + options.programs.k40-whisperer = { 13 + enable = mkEnableOption "K40-Whisperer"; 14 + 15 + group = mkOption { 16 + type = types.str; 17 + description = '' 18 + Group assigned to the device when connected. 19 + ''; 20 + default = "k40"; 21 + }; 22 + 23 + package = mkOption { 24 + type = types.package; 25 + default = pkgs.k40-whisperer; 26 + defaultText = literalExpression "pkgs.k40-whisperer"; 27 + example = literalExpression "pkgs.k40-whisperer"; 28 + description = '' 29 + K40 Whisperer package to use. 30 + ''; 31 + }; 32 + }; 33 + 34 + config = mkIf cfg.enable { 35 + users.groups.${cfg.group} = {}; 36 + 37 + environment.systemPackages = [ pkg ]; 38 + services.udev.packages = [ pkg ]; 39 + }; 40 + }
+74
pkgs/applications/misc/k40-whisperer/default.nix
···
··· 1 + { stdenv 2 + , makeWrapper 3 + , writeText 4 + , python3 5 + , fetchzip 6 + , inkscape 7 + , lib 8 + , udevGroup ? "k40" 9 + }: 10 + 11 + let 12 + pythonEnv = python3.withPackages (ps: with ps; [ 13 + lxml 14 + pyusb 15 + pillow 16 + pyclipper 17 + tkinter 18 + ]); 19 + 20 + udevRule = writeText "k40-whisperer.rules" '' 21 + SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5512", ENV{DEVTYPE}=="usb_device", MODE="0664", GROUP="${udevGroup}" 22 + ''; 23 + 24 + in stdenv.mkDerivation rec { 25 + pname = "k40-whisperer"; 26 + version = "0.59"; 27 + 28 + src = fetchzip { 29 + url = "https://www.scorchworks.com/K40whisperer/K40_Whisperer-${version}_src.zip"; 30 + stripRoot = true; 31 + sha256 = "0r8rhaksk87l44pwwpvrfnck2lyic3lgcbh3pi7ib6mrwbsyhlni"; 32 + }; 33 + 34 + nativeBuildInputs = [ makeWrapper ]; 35 + 36 + patchPhase = '' 37 + substituteInPlace svg_reader.py \ 38 + --replace '"/usr/bin/inkscape"' '"${inkscape}/bin/inkscape"' 39 + ''; 40 + 41 + buildPhase = ""; 42 + 43 + installPhase = '' 44 + mkdir -p $out 45 + cp -p * $out 46 + 47 + mkdir -p $out/bin 48 + mkdir -p $out/lib/udev/rules.d 49 + 50 + ln -s ${udevRule} $out/lib/udev/rules.d/97-k40-whisperer.rules 51 + 52 + makeWrapper '${pythonEnv.interpreter}' $out/bin/k40-whisperer \ 53 + --add-flags $out/k40_whisperer.py \ 54 + --prefix PYTHONPATH : $out 55 + ''; 56 + 57 + meta = with lib; { 58 + description = '' 59 + Control software for the stock K40 Laser controller 60 + ''; 61 + mainProgram = "k40-whisperer"; 62 + longDescription = '' 63 + 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. 64 + 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. 65 + K40 Whisperer does not require a USB key (dongle) to function. 66 + ''; 67 + homepage = "https://www.scorchworks.com/K40whisperer/k40whisperer.html"; 68 + downloadPage = "https://www.scorchworks.com/K40whisperer/k40whisperer.html#download"; 69 + license = licenses.gpl3; 70 + maintainers = with maintainers; [ fooker ]; 71 + platforms = platforms.all; 72 + }; 73 + } 74 +
+2
pkgs/top-level/all-packages.nix
··· 33175 33176 jstest-gtk = callPackage ../tools/misc/jstest-gtk { }; 33177 33178 keynav = callPackage ../tools/X11/keynav { }; 33179 33180 kgx = callPackage ../applications/terminal-emulators/kgx { };
··· 33175 33176 jstest-gtk = callPackage ../tools/misc/jstest-gtk { }; 33177 33178 + k40-whisperer = callPackage ../applications/misc/k40-whisperer { }; 33179 + 33180 keynav = callPackage ../tools/X11/keynav { }; 33181 33182 kgx = callPackage ../applications/terminal-emulators/kgx { };