From bae30642153f6153d771c10f31e2e665c1a3b8fb Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sun, 28 Sep 2025 16:25:46 +0200 Subject: [PATCH] modules: replace static builtins.hasAttrs instances with '?' operator (#1913) Fixes: c32c82e460b9 ("zen-browser: init (#1694)") Fixes: e594886eb095 ("nixcord: init (#767)") Link: https://github.com/nix-community/stylix/pull/1913 Reviewed-by: awwpotato --- modules/discord/nixcord.nix | 2 +- modules/zen-browser/hm.nix | 82 ++++++++++++++++++------------------- 2 files changed, 41 insertions(+), 43 deletions(-) diff --git a/modules/discord/nixcord.nix b/modules/discord/nixcord.nix index b7409bce..3aeb621c 100644 --- a/modules/discord/nixcord.nix +++ b/modules/discord/nixcord.nix @@ -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 [ diff --git a/modules/zen-browser/hm.nix b/modules/zen-browser/hm.nix index 9945e4f3..71c6f190 100644 --- a/modules/zen-browser/hm.nix +++ b/modules/zen-browser/hm.nix @@ -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 = [ "" ];'.''; - } - ) - ( - { - 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 = [ "" ];'.''; + } + ) + ( + { + 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; }; + }); + } + ) + ]; }