diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index b7fc737a9cd49..10188d6d32ef1 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -11860,6 +11860,12 @@ githubId = 148352; name = "Jim Fowler"; }; + Kitt3120 = { + email = "nixpkgs@schweren.dev"; + github = "Kitt3120"; + githubId = 10689811; + name = "Torben Schweren"; + }; kittywitch = { email = "kat@inskip.me"; github = "kittywitch"; diff --git a/nixos/modules/hardware/inputmodule.nix b/nixos/modules/hardware/inputmodule.nix new file mode 100644 index 0000000000000..a563de4006dd0 --- /dev/null +++ b/nixos/modules/hardware/inputmodule.nix @@ -0,0 +1,15 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + options.hardware.inputmodule.enable = lib.mkEnableOption ''Support for Framework input modules''; + + config = lib.mkIf config.hardware.inputmodule.enable { + environment.systemPackages = [ pkgs.inputmodule-control ]; + services.udev.packages = [ pkgs.inputmodule-control ]; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 2f0e4fe6fbcad..8a3e8b898a9af 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -71,6 +71,7 @@ ./hardware/hackrf.nix ./hardware/i2c.nix ./hardware/infiniband.nix + ./hardware/inputmodule.nix ./hardware/keyboard/qmk.nix ./hardware/keyboard/teck.nix ./hardware/keyboard/uhk.nix diff --git a/pkgs/by-name/in/inputmodule-control/package.nix b/pkgs/by-name/in/inputmodule-control/package.nix new file mode 100644 index 0000000000000..0133a868ad8b8 --- /dev/null +++ b/pkgs/by-name/in/inputmodule-control/package.nix @@ -0,0 +1,49 @@ +{ + lib, + stdenv, + testers, + rustPlatform, + fetchFromGitHub, + inputmodule-control, + pkg-config, + libudev-zero, +}: + +rustPlatform.buildRustPackage rec { + pname = "inputmodule-control"; + version = "0.2.0"; + + src = fetchFromGitHub { + owner = "FrameworkComputer"; + repo = "inputmodule-rs"; + rev = "v${version}"; + hash = "sha256-5sqTkaGqmKDDH7byDZ84rzB3FTu9AKsWxA6EIvUrLCU="; + }; + + useFetchCargoVendor = true; + cargoHash = "sha256-s5k23p0Fo+DQvGpDvy/VmGNFK7ZysqLIyDPuUn6n724="; + + buildAndTestSubdir = "inputmodule-control"; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ libudev-zero ]; + + postInstall = '' + install -Dm644 release/50-framework-inputmodule.rules $out/etc/udev/rules.d/50-framework-inputmodule.rules + ''; + + passthru.tests.version = testers.testVersion { + package = inputmodule-control; + }; + + meta = { + description = "CLI tool to control Framework input modules like the LED matrix"; + license = lib.licenses.mit; + platforms = lib.platforms.linux; + mainProgram = "inputmodule-control"; + homepage = "https://github.com/FrameworkComputer/inputmodule-rs"; + downloadPage = "https://github.com/FrameworkComputer/inputmodule-rs/releases/tag/${src.rev}"; + changelog = "https://github.com/FrameworkComputer/inputmodule-rs/releases/tag/${src.rev}"; + maintainers = with lib.maintainers; [ Kitt3120 ]; + }; +}