modules: replace static builtins.hasAttrs instances with '?' operator (#1913)

Fixes: c32c82e460 ("zen-browser: init (#1694)")
Fixes: e594886eb0 ("nixcord: init (#767)")
Link: https://github.com/nix-community/stylix/pull/1913

Reviewed-by: awwpotato <awwpotato@voidq.com>
This commit is contained in:
NAHO 2025-09-28 16:25:46 +02:00 committed by GitHub
parent 5b9710eee9
commit bae3064215
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 41 additions and 43 deletions

View file

@ -32,7 +32,7 @@ mkTarget {
lib.mkIf
(cfg.themeBody != (import ./common/theme-header.nix) || cfg.extraCss != "")
(
lib.optionalAttrs (builtins.hasAttr "nixcord" options.programs) (
lib.optionalAttrs (options.programs ? nixcord) (
lib.mkMerge [
(lib.mkIf nixcord.discord.enable (
lib.mkMerge [

View file

@ -19,48 +19,46 @@ mkTarget {
};
};
configElements =
lib.optionals (builtins.hasAttr "zen-browser" options.programs)
[
(
{ cfg }:
{
warnings =
lib.optional (config.programs.zen-browser.enable && cfg.profileNames == [ ])
''stylix: zen-browser: `config.stylix.targets.zen-browser.profileNames` is not set. Declare profile names with 'config.stylix.targets.zen-browser.profileNames = [ "<PROFILE_NAME>" ];'.'';
}
)
(
{
cfg,
fonts,
}:
{
programs.zen-browser.profiles = lib.genAttrs cfg.profileNames (_: {
settings = {
"font.name.monospace.x-western" = fonts.monospace.name;
"font.name.sans-serif.x-western" = fonts.sansSerif.name;
"font.name.serif.x-western" = fonts.serif.name;
};
});
}
)
(
{
cfg,
colors,
}:
{
programs.zen-browser.profiles = lib.genAttrs cfg.profileNames (_: {
settings = {
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
};
configElements = lib.optionals (options.programs ? zen-browser) [
(
{ cfg }:
{
warnings =
lib.optional (config.programs.zen-browser.enable && cfg.profileNames == [ ])
''stylix: zen-browser: `config.stylix.targets.zen-browser.profileNames` is not set. Declare profile names with 'config.stylix.targets.zen-browser.profileNames = [ "<PROFILE_NAME>" ];'.'';
}
)
(
{
cfg,
fonts,
}:
{
programs.zen-browser.profiles = lib.genAttrs cfg.profileNames (_: {
settings = {
"font.name.monospace.x-western" = fonts.monospace.name;
"font.name.sans-serif.x-western" = fonts.sansSerif.name;
"font.name.serif.x-western" = fonts.serif.name;
};
});
}
)
(
{
cfg,
colors,
}:
{
programs.zen-browser.profiles = lib.genAttrs cfg.profileNames (_: {
settings = {
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
};
userChrome = import ./userChrome.nix { inherit colors; };
userChrome = import ./userChrome.nix { inherit colors; };
userContent = import ./userContent.nix { inherit colors; };
});
}
)
];
userContent = import ./userContent.nix { inherit colors; };
});
}
)
];
}