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

@@ -30,32 +30,30 @@ in
options.my.apps.internet.enable = lib.mkEnableOption "internet browsers and communication apps";
config = lib.mkIf config.my.apps.internet.enable {
home-manager.users = let
users = if lib.isString config.my.toggleUsers.apps then [ config.my.toggleUsers.apps ] else config.my.toggleUsers.apps;
in lib.mkMerge (map (user: {
${user}.programs.librewolf = import ./librewolf.nix;
}) users);
userLib = import ../lib.nix { inherit lib; };
in userLib.mkHomeManagerUsers config.my.toggleUsers.apps (user: {
programs.librewolf = import ./librewolf.nix;
});
programs.geary.enable = true;
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 (inputs.zen-browser.packages.x86_64-linux) twilight;
inherit krisp-patcher;
inherit (pkgs)
# thunderbird # email client
warp # transfer files with based ppl
nextcloud-client # self-hosted google-drive alternative
fragments # beautiful torrent client
tor-browser # dark web, so dark!
telegram-desktop # furry chat
nicotine-plus # remember Ares?
discord # :3
vdhcoapp # video download helper assistant
nextcloud-talk-desktop # nextcloud talk client
fractal # matrix client
;
# inherit (inputs.zen-browser.packages.x86_64-linux) twilight;
inherit krisp-patcher;
inherit (pkgs)
# thunderbird # email client
warp # transfer files with based ppl
nextcloud-client # self-hosted google-drive alternative
fragments # beautiful torrent client
tor-browser # dark web, so dark!
telegram-desktop # furry chat
nicotine-plus # remember Ares?
discord # :3
vdhcoapp # video download helper assistant
nextcloud-talk-desktop # nextcloud talk client
fractal # matrix client
;
};
in lib.mkMerge (map (user: {
${user}.packages = packages;
}) users);
in userLib.mkUserPackages config.my.toggleUsers.apps packages;
};
}