diff --git a/modules/nixos/all-modules.nix b/modules/nixos/all-modules.nix index e03596ab..fa4eb620 100644 --- a/modules/nixos/all-modules.nix +++ b/modules/nixos/all-modules.nix @@ -7,5 +7,6 @@ ./plymouth.nix ./sddm.nix ./tty.nix + ./where-is-my-sddm-theme.nix # keep-sorted end ] diff --git a/modules/nixos/where-is-my-sddm-theme.nix b/modules/nixos/where-is-my-sddm-theme.nix new file mode 100644 index 00000000..27d2415e --- /dev/null +++ b/modules/nixos/where-is-my-sddm-theme.nix @@ -0,0 +1,74 @@ +{ catppuccinLib }: +{ + config, + lib, + pkgs, + ... +}: + +let + inherit (catppuccinLib) importINI; + inherit (lib) + mkOption + recursiveUpdate + singleton + types + ; + + cfg = config.catppuccin.where-is-my-sddm-theme; + enable = cfg.enable && config.services.displayManager.sddm.enable; +in + +{ + options.catppuccin.where-is-my-sddm-theme = + catppuccinLib.mkCatppuccinOption { + name = "where-is-my-sddm-theme"; + default = config.catppuccin.enable && !config.catppuccin.sddm.enable; + defaultText = "config.catppuccin.enable && !config.catppuccin.sddm.enable"; + } + // { + variant = mkOption { + type = types.enum [ + "qt5" + "qt6" + ]; + default = + if config.services.displayManager.sddm.package == pkgs.libsForQt5.sddm then "qt5" else "qt6"; + defaultText = "Automatically determined based on your SDDM package - `qt6` for `kdePackages.sddm`, `qt5` for `libsForQt5.sddm`, and `qt6` as fallback"; + example = "qt5"; + description = "Which variant will be used for Where is my SDDM theme?"; + }; + + settings = mkOption { + type = lib.types.submodule { freeformType = with types; attrsOf anything; }; + default = { }; + example = { + General.passwordCharacter = "*"; + }; + description = "Additional settings for Where is my SDDM theme?"; + }; + }; + + config = lib.mkIf enable { + assertions = [ + { + assertion = config.catppuccin.sddm.enable -> cfg.enable; + message = "Only one of `catppuccin.sddm` and `catppuccin.where-is-my-sddm-theme` may be set at a time."; + } + ]; + + environment.systemPackages = [ + (pkgs.where-is-my-sddm-theme.override { + variants = singleton cfg.variant; + themeConfig = recursiveUpdate (importINI "${config.catppuccin.sources.where-is-my-sddm-theme}/catppuccin-${cfg.flavor}.conf") cfg.settings; + }) + ]; + + services.displayManager = { + sddm = { + theme = + if cfg.variant == "qt6" then "where_is_my_sddm_theme" else "where_is_my_sddm_theme_qt5"; + }; + }; + }; +} diff --git a/pkgs/sources.json b/pkgs/sources.json index 573d918b..388bd031 100644 --- a/pkgs/sources.json +++ b/pkgs/sources.json @@ -284,6 +284,11 @@ "lastModified": "2023-04-12", "rev": "b1a81bae74d66eaae16457f2d8f151b5bd4fe5da" }, + "where-is-my-sddm-theme": { + "hash": "sha256-f6d7bJoSbFzEhAIfilxNLQGtAMQWTtUTube/pTqP7AY=", + "lastModified": "2024-10-13", + "rev": "82a36df79ab596b9fbe85c86d3c2f3a1e39433af" + }, "wlogout": { "hash": "sha256-0VCk+7t/cSEmcnfvKdxUDwwrtK0VLhZrVpw4enoBEbc=", "lastModified": "2025-08-07",