refactor(home-manager): ensure xdg.enable using assertion (#59)
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
5cb3e83bdd
commit
a0e508260c
5 changed files with 21 additions and 15 deletions
|
@ -17,11 +17,11 @@ in
|
|||
|
||||
config = lib.mkIf enable
|
||||
{
|
||||
xdg = {
|
||||
# xdg is required for this to work
|
||||
enable = lib.mkForce true;
|
||||
configFile."btop${themePath}".source = theme;
|
||||
};
|
||||
assertions = [
|
||||
(lib.ctp.assertXdgEnabled "btop")
|
||||
];
|
||||
|
||||
xdg.configFile."btop${themePath}".source = theme;
|
||||
|
||||
programs.btop.settings.color_theme = themeFile;
|
||||
};
|
||||
|
|
|
@ -14,13 +14,12 @@ in
|
|||
{
|
||||
options.programs.fish.catppuccin = lib.ctp.mkCatppuccinOpt "fish";
|
||||
|
||||
# xdg is required for this to work
|
||||
config = mkIf enable {
|
||||
xdg = {
|
||||
enable = lib.mkForce true;
|
||||
assertions = [
|
||||
(lib.ctp.assertXdgEnabled "fish")
|
||||
];
|
||||
|
||||
configFile."fish${themePath}".source = "${sources.fish}${themePath}";
|
||||
};
|
||||
xdg.configFile."fish${themePath}".source = "${sources.fish}${themePath}";
|
||||
|
||||
programs.fish.shellInit = ''
|
||||
fish_config theme choose "${themeName}"
|
||||
|
|
|
@ -14,12 +14,12 @@ in
|
|||
lib.ctp.mkCatppuccinOpt "micro";
|
||||
|
||||
config = lib.mkIf enable {
|
||||
assertions = [
|
||||
(lib.ctp.assertXdgEnabled "micro")
|
||||
];
|
||||
|
||||
programs.micro.settings.colorscheme = lib.removeSuffix ".micro" themePath;
|
||||
|
||||
xdg = {
|
||||
# xdg is required for this to work
|
||||
enable = lib.mkForce true;
|
||||
configFile."micro/colorschemes/${themePath}".source = "${sources.micro}/src/${themePath}";
|
||||
};
|
||||
xdg.configFile."micro/colorschemes/${themePath}".source = "${sources.micro}/src/${themePath}";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -105,4 +105,9 @@ in
|
|||
# the first string should be the name of the module,
|
||||
# followed by the local config attrset
|
||||
mkAccentOpt = mkBasicOpt "accent" types.accentOption;
|
||||
|
||||
assertXdgEnabled = name: {
|
||||
assertion = config.xdg.enable;
|
||||
message = "Option xdg.enable must be enabled to apply Catppuccin theming for ${name}";
|
||||
};
|
||||
}
|
||||
|
|
2
test.nix
2
test.nix
|
@ -42,6 +42,8 @@ in
|
|||
|
||||
inherit (common) catppuccin;
|
||||
|
||||
xdg.enable = true;
|
||||
|
||||
home = {
|
||||
username = "test";
|
||||
stateVersion = lib.mkDefault "23.11";
|
||||
|
|
Loading…
Reference in a new issue