diff --git a/users/infinidoge/default.nix b/users/infinidoge/default.nix index 78d2172..331fe18 100644 --- a/users/infinidoge/default.nix +++ b/users/infinidoge/default.nix @@ -22,22 +22,21 @@ in ./config ]; - programs = { - git = { - userEmail = "infinidoge@inx.moe"; - userName = "Infinidoge"; - extraConfig = { - gpg.format = "ssh"; - commit.gpgsign = true; - user.signingkey = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; - }; - }; - firefox = { - enable = main.info.graphical; - package = pkgs.firefox-devedition; + programs.git = { + userEmail = "infinidoge@inx.moe"; + userName = "Infinidoge"; + extraConfig = { + gpg.format = "ssh"; + commit.gpgsign = true; + user.signingkey = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; }; }; + programs.firefox = { + enable = main.info.graphical; + package = pkgs.firefox-devedition; + }; + services.unison = { enable = true; pairs = { @@ -68,52 +67,6 @@ in POP_SMTP_PASSWORD = "$(cat ${secrets.smtp-personal})"; UNISON = "$HOME/.local/state/unison"; }; - - home.packages = - with pkgs; - flatten [ - bitwarden-cli - bsd-finger - ncdu - peaclock - pop - qrencode - reflex - unison - - (lib.optionals (!main.universe.minimal.enable) [ - gramma - jmtpfs - packwiz - presenterm - toot - ]) - - (ifGraphical [ - speedcrunch - (discord-canary.override { - withVencord = true; - withOpenASAR = true; - withTTS = false; - }) - ]) - - (lib.optionals (!main.universe.minimal.enable && main.info.graphical) [ - (discord.override { - withVencord = true; - withOpenASAR = true; - withTTS = false; - }) - schildichat-desktop - signal-desktop - teams-for-linux - thunderbird - tor-browser - bitwarden - qbittorrent - sqlitebrowser - ]) - ]; }; systemd.user.tmpfiles.users.infinidoge.rules = mkIf config.universe.media.enable [ diff --git a/users/modules/global/programs.nix b/users/modules/global/programs.nix new file mode 100644 index 0000000..749a1db --- /dev/null +++ b/users/modules/global/programs.nix @@ -0,0 +1,110 @@ +{ + config, + main, + lib, + pkgs, + ... +}: + +let + inherit (lib) flip; + inherit (lib.our) mkBoolOpt' packageListOpt; + + packagesOpt = kind: flip mkBoolOpt' "Package Set: ${kind}"; + + full = !main.universe.minimal.enable; + + cfg = config.universe.programs; + + ifGraphical = lib.optionals main.info.graphical; + ifGraphical' = lib.optional main.info.graphical; + + addPackageLists = lib.mapAttrs ( + name: value: + value + // { + minimal = packageListOpt; + full = packageListOpt; + } + ); +in + +{ + options.universe.programs = ( + addPackageLists { + utility.enable = packagesOpt "Utility" true; + writing.enable = packagesOpt "Writing" true; + communication.enable = packagesOpt "Communication" true; + internet.enable = packagesOpt "Internet" true; + } + ); + + config = { + universe.programs = with pkgs; { + utility.minimal = [ + bitwarden-cli + bsd-finger + ncdu + peaclock + pop + qrencode + reflex + unison + (ifGraphical [ + speedcrunch + ]) + ]; + utility.full = [ + jmtpfs + packwiz + presenterm + toot + (ifGraphical [ + bitwarden + qbittorrent + sqlitebrowser + ]) + ]; + + writing.full = [ + gramma + ]; + + communication.minimal = [ + (ifGraphical [ + (discord-canary.override { + withVencord = true; + withOpenASAR = true; + withTTS = false; + }) + thunderbird + ]) + ]; + communication.full = [ + (ifGraphical [ + (discord.override { + withVencord = true; + withOpenASAR = true; + withTTS = false; + }) + schildichat-desktop + signal-desktop + teams-for-linux + ]) + ]; + + internet.full = [ + (ifGraphical [ + tor-browser + ]) + ]; + }; + + home.packages = lib.concatMap ( + v: + (lib.optionals (v ? minimal && v.enable) v.minimal) + ++ (lib.optionals (v ? full && full && v.enable) v.full) + ) (lib.attrValues cfg); + + }; +}