Skip to content

Commit

Permalink
feat(modules): support nixos & home-manager's stable branches
Browse files Browse the repository at this point in the history
  • Loading branch information
getchoo committed May 21, 2024
1 parent 10cbf90 commit 3276e28
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 34 deletions.
9 changes: 7 additions & 2 deletions modules/home-manager/tofi.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ let
inherit (config.catppuccin) sources;
cfg = config.programs.tofi.catppuccin;
enable = cfg.enable && config.programs.tofi.enable;

# `programs.tofi` was added in 24.05 and not backported
# TODO: remove when 24.05 is stable
minVersion = "24.05";
in
{
options.programs.tofi.catppuccin =
lib.ctp.mkCatppuccinOpt "tofi";
options.programs.tofi = lib.ctp.mkVersionedOpts minVersion {
catppuccin = lib.ctp.mkCatppuccinOpt "tofi";
};

config.programs.tofi = lib.mkIf enable {
settings = lib.ctp.fromINI (sources.tofi + /catppuccin-${cfg.flavour});
Expand Down
70 changes: 38 additions & 32 deletions modules/nixos/sddm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,54 @@
, ...
}:
let
inherit (lib) mkIf ctp types mkOption versionAtLeast;
cfg = config.services.displayManager.sddm.catppuccin;
enable = cfg.enable && config.services.displayManager.sddm.enable;

inherit (lib) mkIf ctp types mkOption;
# versions >= 24.05 renamed `services.xserver.displayManager` to `services.displayManager`
# TODO: remove when 24.05 is stable
minVersion = "24.05";
in
{
options.services.displayManager.sddm.catppuccin =
ctp.mkCatppuccinOpt "sddm"
// {
font = mkOption {
type = types.str;
default = "Noto Sans";
description = "Font to use for the login screen";
};
options.services.displayManager = ctp.mkVersionedOpts minVersion {
sddm.catppuccin =
ctp.mkCatppuccinOpt "sddm"
// {
font = mkOption {
type = types.str;
default = "Noto Sans";
description = "Font to use for the login screen";
};

fontSize = mkOption {
type = types.str;
default = "9";
description = "Font size to use for the login screen";
};
fontSize = mkOption {
type = types.str;
default = "9";
description = "Font size to use for the login screen";
};

background = mkOption {
type = with types; (either path str);
default = "";
description = "Background image to use for the login screen";
};
background = mkOption {
type = with types; (either path str);
default = "";
description = "Background image to use for the login screen";
};

loginBackground = mkOption {
type = types.bool;
default = true;
description = "Add an additonal background layer to the login panel";
loginBackground = mkOption {
type = types.bool;
default = true;
description = "Add an additional background layer to the login panel";
};
};
};
};

config = mkIf enable {
config = mkIf enable
{
environment.systemPackages = [
(pkgs.catppuccin-sddm.override {
flavor = cfg.flavour;
inherit (cfg) font fontSize background loginBackground;
})
];
} // mkIf (enable && versionAtLeast ctp.getModuleRelease minVersion) {
services.displayManager.sddm.theme = "catppuccin-${cfg.flavour}";

environment.systemPackages = [
(pkgs.catppuccin-sddm.override {
flavor = cfg.flavour;
inherit (cfg) font fontSize background loginBackground;
})
];
};
}

0 comments on commit 3276e28

Please sign in to comment.