rose-pine-nix/modules/nixos/sddm.nix

69 lines
1.6 KiB
Nix
Raw Normal View History

2024-05-21 14:53:46 -07:00
{
lib,
pkgs,
config,
...
}:
let
2024-05-21 14:53:46 -07:00
inherit (lib)
mkIf
ctp
types
mkOption
versionAtLeast
;
cfg = config.services.displayManager.sddm.catppuccin;
enable = cfg.enable && config.services.displayManager.sddm.enable;
# versions >= 24.05 renamed `services.xserver.displayManager` to `services.displayManager`
# TODO: remove when 24.05 is stable
minVersion = "24.05";
in
{
options.services.displayManager = ctp.mkVersionedOpts minVersion {
2024-05-21 14:53:46 -07:00
sddm.catppuccin = ctp.mkCatppuccinOpt "sddm" // {
font = mkOption {
type = types.str;
default = "Noto Sans";
description = "Font to use for the login screen";
};
2024-05-21 14:53:46 -07:00
fontSize = mkOption {
type = types.str;
default = "9";
description = "Font size to use for the login screen";
};
2024-05-21 14:53:46 -07:00
background = mkOption {
type = with types; (either path str);
default = "";
description = "Background image to use for the login screen";
};
2024-05-21 14:53:46 -07:00
loginBackground = mkOption {
type = types.bool;
default = true;
description = "Add an additional background layer to the login panel";
};
2024-05-21 14:53:46 -07:00
};
};
2024-05-21 14:53:46 -07:00
config =
mkIf enable {
environment.systemPackages = [
(pkgs.catppuccin-sddm.override {
2024-05-21 14:53:46 -07:00
inherit (cfg)
flavor
2024-05-21 14:53:46 -07:00
font
fontSize
background
loginBackground
;
})
];
2024-05-21 14:53:46 -07:00
}
// mkIf (enable && versionAtLeast ctp.getModuleRelease minVersion) {
services.displayManager.sddm.theme = "catppuccin-${cfg.flavor}";
2024-05-21 14:53:46 -07:00
};
}