Add options to individually enable and disable udev packages

This commit is contained in:
Erwin Boskma 2022-09-27 20:39:25 +02:00
parent a8a6b216b0
commit 5a3849078e
Signed by: erwin
GPG key ID: 270B20D17394F7E5
3 changed files with 54 additions and 7 deletions

View file

@ -18,6 +18,13 @@ in
plymouth.enable = true;
work = false;
kernel = pkgs.linuxKernel.packages.linux_5_19;
udev-rules = {
qmk = true;
solo2 = true;
picotool = true;
blink1 = true;
probe-rs = true;
};
};
bluetooth.enable = true;
desktop = {
@ -53,7 +60,7 @@ in
boot.loader = {
systemd-boot = {
enable = true;
configurationLimit = 25;
configurationLimit = 10;
};
efi.canTouchEfiVariables = true;
};

View file

@ -18,6 +18,10 @@ with lib; let
inherit (pkgs.stdenv) mkDerivation;
inherit lib;
};
solo2Rules = pkgs.callPackage ./solo2 {
inherit (pkgs.stdenv) mkDerivation;
inherit lib;
};
in
{
options.eboskma.base = {
@ -28,7 +32,7 @@ in
};
plymouth = {
enable = mkEnableOption "enable plymouth splash screen";
enable = mkEnableOption "plymouth splash screen";
};
work = mkOption {
@ -36,6 +40,14 @@ in
type = types.bool;
default = false;
};
udev-rules = {
qmk = mkEnableOption "qmk udev rules"; # No-op for now
probe-rs = mkEnableOption "probe.rs udev rules";
blink1 = mkEnableOption "blink(1) udev rules";
picotool = mkEnableOption "picotool udev rules";
solo2 = mkEnableOption "solo2 udev rules";
};
};
config = {
@ -67,11 +79,10 @@ in
services.udev = {
extraRules = qmkUdevRules;
packages = [
probersRules
blink1Rules
picotoolRules
];
packages = [] ++ (optional cfg.udev-rules.probe-rs [ probersRules ])
++ (optional cfg.udev-rules.blink1 [ blink1Rules ])
++ (optional cfg.udev-rules.picotool [ picotoolRules ])
++ (optional cfg.udev-rules.solo2 [ solo2Rules ]);
};
};
}

View file

@ -0,0 +1,29 @@
{ lib, mkDerivation, ... }:
let
pname = "solo2-udev-rules";
version = "20220924";
in
mkDerivation {
inherit pname version;
src = ./.;
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/lib/udev/rules.d
echo 'SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="b000", TAG+="uaccess"' >> $out/lib/udev/rules.d/70-solo2.rules
'';
meta = with lib; {
description = "udev rules for the solo2 key";
homepage = "https://solokeys.com";
license = licenses.mit;
platforms = platforms.linux;
maintainers = [{
email = "erwin@datarift.nl";
github = "eboskma";
name = "Erwin Boskma";
}];
};
}