51 lines
966 B
Nix
51 lines
966 B
Nix
{ lib, config, ... }:
|
|
with lib;
|
|
let
|
|
userModule = types.submodule {
|
|
options = {
|
|
description = mkOption {
|
|
type = types.str;
|
|
};
|
|
|
|
groups = mkOption {
|
|
type = types.listOf types.str;
|
|
};
|
|
|
|
uid = mkOption {
|
|
type = types.nullOr types.int;
|
|
};
|
|
|
|
shell = mkOption {
|
|
type = types.package;
|
|
};
|
|
|
|
enableHomeManagerProfile = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
|
|
homeManagerConfig = mkOption {
|
|
default = { };
|
|
};
|
|
};
|
|
};
|
|
in
|
|
{
|
|
options.machineUsers = mkOption {
|
|
type = types.attrsOf userModule;
|
|
};
|
|
|
|
config = {
|
|
users.users = builtins.mapAttrs
|
|
(name: value: {
|
|
isNormalUser = true;
|
|
home = "/home/${name}";
|
|
description = value.description;
|
|
extraGroups = value.groups;
|
|
shell = value.shell;
|
|
uid = mkIf (value.uid != null) value.uid;
|
|
})
|
|
config.machineUsers;
|
|
};
|
|
}
|