rose-pine-nix/modules/home-manager/waybar.nix
seth 28e6d8a18d
feat(modules): add catppuccin.sources option (#129)
* feat(modules): add `catppuccin.sources` option

* refactor(modules)!: nvfetcher -> npins

npins gives us a nicer file to import that is a simple name value pair
of the port and the path in the store. this allows for easier overriding
with the catppuccin.sources option

* fix(modules): ensure default sources are applied to `catppuccin.sources`
2024-05-13 16:33:16 -04:00

40 lines
1.1 KiB
Nix

{ config
, lib
, ...
}:
let
inherit (config.catppuccin) sources;
cfg = config.programs.waybar.catppuccin;
enable = cfg.enable && config.programs.waybar.enable;
styleFile = "${sources.waybar}/themes/${cfg.flavour}.css";
in
{
options.programs.waybar.catppuccin = (lib.ctp.mkCatppuccinOpt "waybar") // {
mode = lib.mkOption {
type = lib.types.enum [
"prependImport"
"createLink"
];
default = "prependImport";
description = ''
Defines how to include the catppuccin theme css file:
- `prependImport`: Prepends the import statement, if `programs.waybar.style` is a string (with default override priority).
- `createLink`: Creates a symbolic link `~/.config/waybar/catppuccin.css`, which needs to be included in the waybar stylesheet.
'';
};
};
config = lib.mkIf enable (
lib.mkMerge [
(lib.mkIf (cfg.mode == "prependImport") {
programs.waybar.style = lib.mkBefore ''
@import "${styleFile}";
'';
})
(lib.mkIf (cfg.mode == "createLink") {
xdg.configFile."waybar/catppuccin.css".source = styleFile;
})
]
);
}