refactor(repo): reformat to nixfmt; relicense to 0BSD

This commit is contained in:
Artur Manuel 2025-03-06 20:45:49 +00:00
commit db2564d828
Signed by: amadaluzia
SSH key fingerprint: SHA256:Zwg7gBuZyaG48ucAZneJwltiXu0+tJb7c3lYt9AYlLg
39 changed files with 451 additions and 318 deletions

View file

@ -2,27 +2,35 @@
config,
lib,
...
}: let
}:
let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) attrsOf listOf submodule str package;
inherit (lib.types)
attrsOf
listOf
submodule
str
package
;
users = config.alqueva.users;
in {
in
{
options.alqueva.users = mkOption {
type = attrsOf (submodule {
options = {
tmpfiles = mkOption {
description = "tmpfiles";
type = listOf str;
default = [];
default = [ ];
};
packages = mkOption {
type = listOf package;
default = [];
default = [ ];
description = "Packages installed to the the defined user.";
};
groups = mkOption {
type = listOf str;
default = [];
default = [ ];
description = "Groups to add the defined user to.";
};
shell = mkOption {
@ -30,30 +38,30 @@ in {
default = config.programs.bash.package;
description = "Shell the user wants to use.";
};
enable = (mkEnableOption "this user.") // {default = true;};
enable = (mkEnableOption "this user.") // {
default = true;
};
};
});
description = "Users to have on the system.";
default = {};
default = { };
};
config = let
enabledUsers = lib.filterAttrs (_: user: user.enable == true) users;
in {
users.users =
builtins.mapAttrs (un: uc: {
config =
let
enabledUsers = lib.filterAttrs (_: user: user.enable == true) users;
in
{
users.users = builtins.mapAttrs (un: uc: {
description = un;
isNormalUser = true;
extraGroups = uc.groups;
inherit (uc) packages shell;
initialPassword = "password";
})
enabledUsers;
}) enabledUsers;
systemd.user.tmpfiles.users =
builtins.mapAttrs (_: uc: {
systemd.user.tmpfiles.users = builtins.mapAttrs (_: uc: {
rules = uc.tmpfiles;
})
enabledUsers;
};
}) enabledUsers;
};
}