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

@@ -9,19 +9,17 @@
config = lib.mkIf config.my.apps.office.enable {
environment.variables.CALIBRE_USE_SYSTEM_THEME = "1";
users.users = let
users = if lib.isString config.my.toggleUsers.apps then [ config.my.toggleUsers.apps ] else config.my.toggleUsers.apps;
userLib = import ../lib.nix { inherit lib; };
packages = builtins.attrValues {
inherit (pkgs)
jre17_minimal # for libreoffice extensions
libreoffice # office, but based & european
calibre # ugly af eBook library manager
newsflash # feed reader, syncs with nextcloud
furtherance # I packaged this one tehee track time utility
# planify # let's pretend I will organize my tasks
;
inherit (pkgs)
jre17_minimal # for libreoffice extensions
libreoffice # office, but based & european
calibre # ugly af eBook library manager
newsflash # feed reader, syncs with nextcloud
furtherance # I packaged this one tehee track time utility
# planify # let's pretend I will organize my tasks
;
};
in lib.mkMerge (map (user: {
${user}.packages = packages;
}) users);
in userLib.mkUserPackages config.my.toggleUsers.apps packages;
};
}