diff --git a/modules/programs/base_packages.nix b/modules/programs/base_packages.nix index 4172443..4ab9ae1 100644 --- a/modules/programs/base_packages.nix +++ b/modules/programs/base_packages.nix @@ -26,16 +26,30 @@ Note that these are installed even if base packages is disabled, e.g. you can also use this as the only packages to install. ''; }; + special_programs = lib.mkOption { + default = { }; + example = { }; + type = with lib.types; attrsOf anything; + description = '' + special program configuration to be added which require programs.something notation. + ''; + }; + special_services = lib.mkOption { + default = { }; + example = { }; + type = with lib.types; attrsOf anything; + description = '' + special services configuration to be added which require an services.something notation. + ''; + }; }; }; - config = ( - lib.optionalAttrs (options ? environment.systemPackages) { - environment.systemPackages = config.mods.base_packages.additional_packages; - } - // (lib.mkIf config.mods.base_packages.enable ( - lib.optionalAttrs (options ? environment.systemPackages) { - environment.systemPackages = with pkgs; [ + config = lib.optionalAttrs (options ? environment.systemPackages) { + environment.systemPackages = + if config.mods.base_packages.enable then + with pkgs; + [ adwaita-icon-theme dbus dconf @@ -58,10 +72,15 @@ seahorse upower xorg.xkbutils - ]; + ] + ++ config.mods.base_packages.additional_packages + else + config.mods.base_packages.additional_packages; - gtk.iconCache.enable = false; - services = { + gtk.iconCache.enable = false; + services = + if config.mods.base_packages.enable then + { upower.enable = true; dbus = { enable = true; @@ -72,9 +91,14 @@ nssmdns4 = true; openFirewall = true; }; - }; + } + // config.mods.base_packages.special_services + else + config.mods.base_packages.special_services; - programs = { + programs = + if config.mods.base_packages.enable then + { nix-ld = { enable = true; libraries = with pkgs; [ @@ -94,8 +118,10 @@ }; ssh.startAgent = true; gnupg.agent.enable = true; - }; - } - )) - ); + } + // config.mods.base_packages.special_programs + else + config.mods.base_packages.special_programs; + }; + } diff --git a/modules/programs/home_packages.nix b/modules/programs/home_packages.nix index 21858fd..1992028 100644 --- a/modules/programs/home_packages.nix +++ b/modules/programs/home_packages.nix @@ -22,6 +22,22 @@ Will be installed regardless of default home manager packages are installed. ''; }; + special_programs = lib.mkOption { + default = { }; + example = { }; + type = with lib.types; attrsOf anything; + description = '' + special program configuration to be added which require programs.something notation. + ''; + }; + special_services = lib.mkOption { + default = { }; + example = { }; + type = with lib.types; attrsOf anything; + description = '' + special services configuration to be added which require an services.something notation. + ''; + }; matrixClient = lib.mkOption { default = pkgs.nheko; example = null; @@ -59,62 +75,68 @@ description = "Additional browser -> second to firefox, the only installed browser if firefox is disabled"; }; }; - config = - (lib.optionalAttrs (options ? home.packages) { - home.packages = config.mods.home_packages.additional_packages; - }) - // lib.mkIf config.mods.home_packages.useDefaultPackages ( - lib.optionalAttrs (options ? home.packages) { - home.packages = - with pkgs; - [ - # TODO add fcp once fixed.... - (lib.mkIf config.mods.home_packages.ncspot ncspot) - (lib.mkIf config.mods.home_packages.vesktop vesktop) - (lib.mkIf config.mods.home_packages.nextcloudClient nextcloud-client) - (lib.mkIf (!isNull config.mods.home_packages.matrixClient) config.mods.home_packages.matrixClient) - (lib.mkIf (!isNull config.mods.home_packages.mailClient) config.mods.home_packages.mailClient) - (lib.mkIf ( - !isNull config.mods.home_packages.additionalBrowser - ) config.mods.home_packages.additionalBrowser) - adw-gtk3 - bat - brightnessctl - dbus - fastfetch - fd - ffmpeg - flake-checker - gnome-keyring - gnutar - greetd.regreet - killall - kitty - libnotify - lsd - networkmanager - nh - nix-index - playerctl - poppler_utils - pulseaudio - qt5ct - qt6ct - ripgrep - rm-improved - system-config-printer - xournalpp - zenith - zoxide - ] - ++ config.mods.home_packages.additional_packages; + config = lib.optionalAttrs (options ? home.packages) { + home.packages = + if config.mods.home_packages.useDefaultPackages then + with pkgs; + [ + # TODO add fcp once fixed.... + (lib.mkIf config.mods.home_packages.ncspot ncspot) + (lib.mkIf config.mods.home_packages.vesktop vesktop) + (lib.mkIf config.mods.home_packages.nextcloudClient nextcloud-client) + (lib.mkIf (!isNull config.mods.home_packages.matrixClient) config.mods.home_packages.matrixClient) + (lib.mkIf (!isNull config.mods.home_packages.mailClient) config.mods.home_packages.mailClient) + (lib.mkIf ( + !isNull config.mods.home_packages.additionalBrowser + ) config.mods.home_packages.additionalBrowser) + adw-gtk3 + bat + brightnessctl + dbus + fastfetch + fd + ffmpeg + flake-checker + gnome-keyring + gnutar + greetd.regreet + killall + kitty + libnotify + lsd + networkmanager + nh + nix-index + playerctl + poppler_utils + pulseaudio + qt5ct + qt6ct + ripgrep + rm-improved + system-config-printer + xournalpp + zenith + zoxide + ] + ++ config.mods.home_packages.additional_packages + else + config.mods.home_packages.additional_packages; - xdg.configFile."direnv/direnv.toml".source = (pkgs.formats.toml { }).generate "direnv" { - global = { - warn_timeout = "-1s"; - }; - }; - - } - ); + xdg.configFile."direnv/direnv.toml".source = (pkgs.formats.toml { }).generate "direnv" { + global = { + warn_timeout = "-1s"; + }; + }; + programs = + if config.mods.home_packages.useDefaultPackages then + config.mods.home_packages.special_programs + else + config.mods.home_packages.special_programs; + services = + if config.mods.home_packages.useDefaultPackages then + config.mods.home_packages.special_services + else + config.mods.home_packages.special_services; + }; } diff --git a/modules/programs/media.nix b/modules/programs/media.nix index fcb5e10..deb895f 100644 --- a/modules/programs/media.nix +++ b/modules/programs/media.nix @@ -21,14 +21,28 @@ Additional media packages. ''; }; + special_programs = lib.mkOption { + default = { }; + example = { }; + type = with lib.types; attrsOf anything; + description = '' + special program configuration to be added which require programs.something notation. + ''; + }; + special_services = lib.mkOption { + default = { }; + example = { }; + type = with lib.types; attrsOf anything; + description = '' + special services configuration to be added which require an services.something notation. + ''; + }; }; - config = ( - lib.optionalAttrs (options ? home.packages) { - home.packages = config.mods.media.additionalPackages; - } - // (lib.mkIf config.mods.media.useBasePackages ( - lib.optionalAttrs (options ? home.packages) { - home.packages = with pkgs; [ + config = lib.optionalAttrs (options ? home.packages) { + home.packages = + if config.mods.media.useBasePackages then + with pkgs; + [ # base audio pipewire wireplumber @@ -54,10 +68,23 @@ gimp krita yt-dlp - ]; - programs.obs-studio.enable = true; - programs.obs-studio.plugins = with pkgs; [ obs-studio-plugins.obs-vaapi ]; - } - )) - ); + ] + ++ config.mods.media.additionalPackages + else + config.mods.media.additionalPackages; + programs = + if config.mods.media.useBasePackages then + { + obs-studio.enable = true; + obs-studio.plugins = with pkgs; [ obs-studio-plugins.obs-vaapi ]; + } + // config.mods.media.special_programs + else + config.mods.media.special_programs; + services = + if config.mods.media.useBasePackages then + config.mods.media.special_services + else + config.mods.media.special_services; + }; }