From 5a3849078ec101b12c44685aa40da71ffd32b085 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Tue, 27 Sep 2022 20:39:25 +0200 Subject: [PATCH] Add options to individually enable and disable udev packages --- machines/loki/configuration.nix | 9 ++++++++- modules/base/default.nix | 23 +++++++++++++++++------ modules/base/solo2/default.nix | 29 +++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 modules/base/solo2/default.nix diff --git a/machines/loki/configuration.nix b/machines/loki/configuration.nix index f3f198e..4cf0927 100644 --- a/machines/loki/configuration.nix +++ b/machines/loki/configuration.nix @@ -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; }; diff --git a/modules/base/default.nix b/modules/base/default.nix index 15a7293..c97f676 100644 --- a/modules/base/default.nix +++ b/modules/base/default.nix @@ -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 ]); }; }; } diff --git a/modules/base/solo2/default.nix b/modules/base/solo2/default.nix new file mode 100644 index 0000000..ff7f572 --- /dev/null +++ b/modules/base/solo2/default.nix @@ -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"; + }]; + }; +}