diff --git a/modules/nixos/sddm.nix b/modules/nixos/sddm.nix index f79c9307..13302166 100644 --- a/modules/nixos/sddm.nix +++ b/modules/nixos/sddm.nix @@ -10,6 +10,7 @@ let ctp types mkOption + optionalAttrs versionAtLeast ; cfg = config.services.displayManager.sddm.catppuccin; @@ -19,8 +20,10 @@ let # TODO: remove when 24.05 is stable minVersion = "24.05"; in -{ - options.services.displayManager = ctp.mkVersionedOpts minVersion { + +# turn off this module entirely if less than minVersion +optionalAttrs (versionAtLeast ctp.getModuleRelease minVersion) { + options.services.displayManager = { sddm.catppuccin = ctp.mkCatppuccinOpt "sddm" // { font = mkOption { type = types.str; @@ -48,21 +51,18 @@ in }; }; - config = - mkIf enable { - environment.systemPackages = [ - (pkgs.catppuccin-sddm.override { - inherit (cfg) - flavor - font - fontSize - background - loginBackground - ; - }) - ]; - } - // mkIf (enable && versionAtLeast ctp.getModuleRelease minVersion) { - services.displayManager.sddm.theme = "catppuccin-${cfg.flavor}"; - }; + config = mkIf enable { + services.displayManager.sddm.theme = "catppuccin-${cfg.flavor}"; + environment.systemPackages = [ + (pkgs.catppuccin-sddm.override { + inherit (cfg) + flavor + font + fontSize + background + loginBackground + ; + }) + ]; + }; }