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
|
config = lib.mkIf enable
|
||||||
{
|
{
|
||||||
xdg = {
|
assertions = [
|
||||||
# xdg is required for this to work
|
(lib.ctp.assertXdgEnabled "btop")
|
||||||
enable = lib.mkForce true;
|
];
|
||||||
configFile."btop${themePath}".source = theme;
|
|
||||||
};
|
xdg.configFile."btop${themePath}".source = theme;
|
||||||
|
|
||||||
programs.btop.settings.color_theme = themeFile;
|
programs.btop.settings.color_theme = themeFile;
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,13 +14,12 @@ in
|
||||||
{
|
{
|
||||||
options.programs.fish.catppuccin = lib.ctp.mkCatppuccinOpt "fish";
|
options.programs.fish.catppuccin = lib.ctp.mkCatppuccinOpt "fish";
|
||||||
|
|
||||||
# xdg is required for this to work
|
|
||||||
config = mkIf enable {
|
config = mkIf enable {
|
||||||
xdg = {
|
assertions = [
|
||||||
enable = lib.mkForce true;
|
(lib.ctp.assertXdgEnabled "fish")
|
||||||
|
];
|
||||||
|
|
||||||
configFile."fish${themePath}".source = "${sources.fish}${themePath}";
|
xdg.configFile."fish${themePath}".source = "${sources.fish}${themePath}";
|
||||||
};
|
|
||||||
|
|
||||||
programs.fish.shellInit = ''
|
programs.fish.shellInit = ''
|
||||||
fish_config theme choose "${themeName}"
|
fish_config theme choose "${themeName}"
|
||||||
|
|
|
@ -14,12 +14,12 @@ in
|
||||||
lib.ctp.mkCatppuccinOpt "micro";
|
lib.ctp.mkCatppuccinOpt "micro";
|
||||||
|
|
||||||
config = lib.mkIf enable {
|
config = lib.mkIf enable {
|
||||||
|
assertions = [
|
||||||
|
(lib.ctp.assertXdgEnabled "micro")
|
||||||
|
];
|
||||||
|
|
||||||
programs.micro.settings.colorscheme = lib.removeSuffix ".micro" themePath;
|
programs.micro.settings.colorscheme = lib.removeSuffix ".micro" themePath;
|
||||||
|
|
||||||
xdg = {
|
xdg.configFile."micro/colorschemes/${themePath}".source = "${sources.micro}/src/${themePath}";
|
||||||
# xdg is required for this to work
|
|
||||||
enable = lib.mkForce true;
|
|
||||||
configFile."micro/colorschemes/${themePath}".source = "${sources.micro}/src/${themePath}";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,4 +105,9 @@ in
|
||||||
# the first string should be the name of the module,
|
# the first string should be the name of the module,
|
||||||
# followed by the local config attrset
|
# followed by the local config attrset
|
||||||
mkAccentOpt = mkBasicOpt "accent" types.accentOption;
|
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;
|
inherit (common) catppuccin;
|
||||||
|
|
||||||
|
xdg.enable = true;
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
username = "test";
|
username = "test";
|
||||||
stateVersion = lib.mkDefault "23.11";
|
stateVersion = lib.mkDefault "23.11";
|
||||||
|
|
Loading…
Reference in a new issue