nixos/hardware.i2c: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-27 20:42:52 +02:00
parent 6d731ad2df
commit 58e31e0c26

View File

@ -1,21 +1,18 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = config.hardware.i2c; cfg = config.hardware.i2c;
in in
{ {
options.hardware.i2c = { options.hardware.i2c = {
enable = mkEnableOption '' enable = lib.mkEnableOption ''
i2c devices support. By default access is granted to users in the "i2c" i2c devices support. By default access is granted to users in the "i2c"
group (will be created if non-existent) and any user with a seat, meaning group (will be created if non-existent) and any user with a seat, meaning
logged on the computer locally logged on the computer locally
''; '';
group = mkOption { group = lib.mkOption {
type = types.str; type = lib.types.str;
default = "i2c"; default = "i2c";
description = '' description = ''
Grant access to i2c devices (/dev/i2c-*) to users in this group. Grant access to i2c devices (/dev/i2c-*) to users in this group.
@ -23,11 +20,11 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
boot.kernelModules = [ "i2c-dev" ]; boot.kernelModules = [ "i2c-dev" ];
users.groups = mkIf (cfg.group == "i2c") { users.groups = lib.mkIf (cfg.group == "i2c") {
i2c = { }; i2c = { };
}; };
@ -42,6 +39,6 @@ in
}; };
meta.maintainers = [ maintainers.rnhmjoj ]; meta.maintainers = [ lib.maintainers.rnhmjoj ];
} }