Add helper functions for multi-user toggle support

Introduced a new file `lib.nix` containing helper functions to streamline user package management and attributes for multi-user configurations. Updated various modules to utilize these functions, enhancing code maintainability and readability.
This commit is contained in:
Danilo Reyes
2026-01-16 10:36:02 -06:00
parent 4e835aca1b
commit b89d193445
30 changed files with 196 additions and 213 deletions

View File

@@ -15,10 +15,10 @@
};
config = {
users.users = let
users = if lib.isString config.my.toggleUsers.shell then [ config.my.toggleUsers.shell ] else config.my.toggleUsers.shell;
userLib = import ../lib.nix { inherit lib; };
in lib.mkMerge (map (user: {
${user}.shell = pkgs.${config.my.shell.type};
}) users);
}) (userLib.normalizeUsers config.my.toggleUsers.shell));
programs.zsh.enable = config.my.shell.type == "zsh";
};
}