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, ... }:
with lib;
let
cfg = config.hardware.i2c;
in
{
options.hardware.i2c = {
enable = mkEnableOption ''
enable = lib.mkEnableOption ''
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
logged on the computer locally
'';
group = mkOption {
type = types.str;
group = lib.mkOption {
type = lib.types.str;
default = "i2c";
description = ''
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" ];
users.groups = mkIf (cfg.group == "i2c") {
users.groups = lib.mkIf (cfg.group == "i2c") {
i2c = { };
};
@ -42,6 +39,6 @@ in
};
meta.maintainers = [ maintainers.rnhmjoj ];
meta.maintainers = [ lib.maintainers.rnhmjoj ];
}