1{
2 lib,
3 stdenv,
4 testers,
5 rustPlatform,
6 fetchFromGitHub,
7 inputmodule-control,
8 pkg-config,
9 libudev-zero,
10 udevCheckHook,
11}:
12
13rustPlatform.buildRustPackage rec {
14 pname = "inputmodule-control";
15 version = "0.2.0";
16
17 src = fetchFromGitHub {
18 owner = "FrameworkComputer";
19 repo = "inputmodule-rs";
20 rev = "v${version}";
21 hash = "sha256-5sqTkaGqmKDDH7byDZ84rzB3FTu9AKsWxA6EIvUrLCU=";
22 };
23
24 cargoHash = "sha256-s5k23p0Fo+DQvGpDvy/VmGNFK7ZysqLIyDPuUn6n724=";
25
26 buildAndTestSubdir = "inputmodule-control";
27
28 nativeBuildInputs = [
29 pkg-config
30 udevCheckHook
31 ];
32 buildInputs = [ libudev-zero ];
33
34 doInstallCheck = true;
35
36 postInstall = ''
37 install -Dm644 release/50-framework-inputmodule.rules $out/etc/udev/rules.d/50-framework-inputmodule.rules
38 '';
39
40 passthru.tests.version = testers.testVersion {
41 package = inputmodule-control;
42 };
43
44 meta = {
45 description = "CLI tool to control Framework input modules like the LED matrix";
46 license = lib.licenses.mit;
47 platforms = lib.platforms.linux;
48 mainProgram = "inputmodule-control";
49 homepage = "https://github.com/FrameworkComputer/inputmodule-rs";
50 downloadPage = "https://github.com/FrameworkComputer/inputmodule-rs/releases/tag/${src.rev}";
51 changelog = "https://github.com/FrameworkComputer/inputmodule-rs/releases/tag/${src.rev}";
52 maintainers = with lib.maintainers; [ Kitt3120 ];
53 };
54}