From 2bc59a74381926d43566fe955dcf8b727f32a1f5 Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Thu, 12 Mar 2026 16:16:15 +0100 Subject: [PATCH] firefox: Make options `homepage` and `searchEngine` nullable --- modules/home/programs/firefox.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/home/programs/firefox.nix b/modules/home/programs/firefox.nix index a342511..0e63a87 100644 --- a/modules/home/programs/firefox.nix +++ b/modules/home/programs/firefox.nix @@ -31,24 +31,24 @@ in options.custom.programs.firefox = { enable = lib.mkEnableOption ""; homepage = lib.mkOption { - type = lib.types.nonEmptyStr; + type = lib.types.nullOr lib.types.nonEmptyStr; default = allHosts |> lib.attrValues |> lib.map (host: host.config.custom.web-services.glance) |> lib.filter (glance: glance.enable) |> lib.map (glance: glance.domain) - |> lib.head; + |> (domains: if (lib.length domains != 0) then domains |> lib.head else null); }; searchEngine = lib.mkOption { - type = lib.types.nonEmptyStr; + type = lib.types.nullOr lib.types.nonEmptyStr; default = allHosts |> lib.attrValues |> lib.map (host: host.config.custom.web-services.searxng) |> lib.filter (searxng: searxng.enable) |> lib.map (searxng: searxng.domain) - |> lib.head; + |> (domains: if (lib.length domains != 0) then domains |> lib.head else null); }; extensions = lib.mkOption { type = lib.types.attrsOf ( @@ -107,7 +107,7 @@ in { "intl.accept_languages" = "en-us,en,de-de,de"; "browser.uiCustomization.state" = uiState; - "browser.startup.homepage" = cfg.homepage; + "browser.startup.homepage" = lib.mkIf (cfg.homepage != null) cfg.homepage; "sidebar.position_start" = false; "browser.toolbars.bookmarks.visibility" = "always"; "browser.bookmarks.restore_default_bookmarks" = false; @@ -126,7 +126,7 @@ in extraConfig = lib.readFile "${inputs.betterfox}/user.js"; - search = { + search = lib.mkIf (cfg.searchEngine != null) { force = true; default = "searxng"; privateDefault = "searxng";