Merge pull request #302833 from flokli/brainstem

brainstem: init at 2.10.5

authored by Florian Klink and committed by GitHub 1a948a4f 93afa6f7

+90
+90
pkgs/by-name/br/brainstem/package.nix
··· 1 + { stdenv 2 + , lib 3 + , autoPatchelfHook 4 + , fetchzip 5 + , curl 6 + , systemd 7 + , zlib 8 + , writeText 9 + , withUpdater ? true 10 + , ... 11 + }: 12 + 13 + let 14 + version = "2.10.5"; 15 + # Upstream has a udev.sh script asking for mode and group, but with uaccess we 16 + # don't need any of that and can make it entirely static. 17 + # For any rule adding the uaccess tag to be effective, the name of the file it 18 + # is defined in has to lexically precede 73-seat-late.rules. 19 + udevRule = writeText "60-brainstem.rules" '' 20 + # Acroname Brainstem control devices 21 + SUBSYSTEM=="usb", ATTRS{idVendor}=="24ff", TAG+="uaccess" 22 + 23 + # Acroname recovery devices (pb82, pb242, pb167) 24 + SUBSYSTEM=="tty", ATTRS{idVendor}=="0424", ATTRS{idProduct}=="274e", TAG+="uaccess" 25 + SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", TAG+="uaccess" 26 + KERNEL=="hidraw*", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0130", TAG+="uaccess" 27 + ''; 28 + 29 + src = fetchzip { 30 + url = "https://acroname.com/sites/default/files/software/brainstem_sdk/${version}/brainstem_sdk_${version}_Ubuntu_LTS_22.04_x86_64.tgz"; 31 + hash = "sha256-S6u9goxTMCI12sffP/WKUF7bv0pLeNmNog7Hle+vpR4="; 32 + # There's no "brainstem" parent directory in the archive. 33 + stripRoot = false; 34 + }; 35 + in 36 + 37 + stdenv.mkDerivation { 38 + pname = "brainstem"; 39 + inherit version src; 40 + 41 + nativeBuildInputs = [ autoPatchelfHook ]; 42 + buildInputs = [ 43 + # libudev 44 + (lib.getLib systemd) 45 + # libstdc++.so libgcc_s.so 46 + stdenv.cc.cc.lib 47 + ] ++ lib.optionals withUpdater [ 48 + # libcurl.so.4 49 + curl 50 + # libz.so.1 51 + zlib 52 + ]; 53 + 54 + # Unpack the CLI tools, documentation, library and C headers. 55 + # There's also a python .whl, containing more libraries, which might be used 56 + # to support more architectures, too, but let's only do that if we need it. 57 + installPhase = '' 58 + mkdir -p $out/bin 59 + install -m744 cli/AcronameHubCLI $out/bin 60 + install -m744 cli/Updater $out/bin/AcronameHubUpdater 61 + 62 + mkdir -p $out/lib/udev/rules.d 63 + cp ${udevRule} $out/lib/udev/rules.d/60-brainstem.rules 64 + 65 + mkdir -p $doc 66 + cp docs/* $doc/ 67 + cp {license,version}.txt $doc/ 68 + 69 + mkdir -p $lib/lib 70 + cp api/lib/libBrainStem2.* $lib/lib 71 + 72 + mkdir -p $dev/include 73 + cp -R api/lib/BrainStem2 $dev/include/ 74 + ''; 75 + 76 + outputs = [ "out" "lib" "dev" "doc" ]; 77 + 78 + meta = with lib; { 79 + description = "BrainStem Software Development Kit"; 80 + longDescription = '' 81 + The BrainStem SDK provides a library to access and control Acroname smart 82 + USB switches, as well as a CLI interface, and a firmware updater. 83 + ''; 84 + homepage = "https://acroname.com/software/brainstem-development-kit"; 85 + platforms = [ "x86_64-linux" ]; 86 + license = licenses.unfree; 87 + maintainers = with maintainers; [ flokli ]; 88 + mainProgram = "AcronameHubCLI"; 89 + }; 90 + }