2023-12-14 17:23:01 -07:00
|
|
|
{ lib, config, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.main_user;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.main_user = {
|
|
|
|
enable = lib.mkEnableOption "enable user module";
|
|
|
|
|
|
|
|
isDesktopUser = lib.mkOption {
|
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
description = "Add additional user groups for desktop users";
|
|
|
|
};
|
|
|
|
|
|
|
|
userName = lib.mkOption {
|
|
|
|
default = "mainuser";
|
|
|
|
description = "username";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
users.users.${cfg.userName} = lib.mkMerge [
|
|
|
|
{
|
|
|
|
isNormalUser = true;
|
|
|
|
initialPassword = "password";
|
|
|
|
|
|
|
|
description = "main user";
|
|
|
|
shell = pkgs.zsh;
|
|
|
|
}
|
|
|
|
|
|
|
|
(lib.mkIf (!cfg.isDesktopUser) {
|
|
|
|
extraGroups = [
|
|
|
|
"wheel"
|
|
|
|
"networkmanager"
|
|
|
|
cfg.userName
|
|
|
|
];
|
|
|
|
})
|
|
|
|
(lib.mkIf cfg.isDesktopUser {
|
|
|
|
extraGroups = [
|
|
|
|
"wheel"
|
|
|
|
"networkmanager"
|
2023-12-14 21:58:29 -07:00
|
|
|
"corectrl"
|
2023-12-14 17:23:01 -07:00
|
|
|
cfg.userName
|
|
|
|
"video"
|
|
|
|
"audio"
|
2023-12-18 20:12:41 -07:00
|
|
|
# For android
|
|
|
|
"adbusers"
|
2024-04-12 07:08:56 -06:00
|
|
|
# For serial interfaces
|
|
|
|
"dialout"
|
2024-05-15 10:17:27 -06:00
|
|
|
# For docker
|
|
|
|
"docker"
|
2023-12-14 17:23:01 -07:00
|
|
|
];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|