firefox: Make options homepage and searchEngine nullable

This commit is contained in:
SebastianStork 2026-03-12 16:16:15 +01:00
parent a4c6c0424f
commit 2bc59a7438
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q

View file

@ -31,24 +31,24 @@ in
options.custom.programs.firefox = { options.custom.programs.firefox = {
enable = lib.mkEnableOption ""; enable = lib.mkEnableOption "";
homepage = lib.mkOption { homepage = lib.mkOption {
type = lib.types.nonEmptyStr; type = lib.types.nullOr lib.types.nonEmptyStr;
default = default =
allHosts allHosts
|> lib.attrValues |> lib.attrValues
|> lib.map (host: host.config.custom.web-services.glance) |> lib.map (host: host.config.custom.web-services.glance)
|> lib.filter (glance: glance.enable) |> lib.filter (glance: glance.enable)
|> lib.map (glance: glance.domain) |> lib.map (glance: glance.domain)
|> lib.head; |> (domains: if (lib.length domains != 0) then domains |> lib.head else null);
}; };
searchEngine = lib.mkOption { searchEngine = lib.mkOption {
type = lib.types.nonEmptyStr; type = lib.types.nullOr lib.types.nonEmptyStr;
default = default =
allHosts allHosts
|> lib.attrValues |> lib.attrValues
|> lib.map (host: host.config.custom.web-services.searxng) |> lib.map (host: host.config.custom.web-services.searxng)
|> lib.filter (searxng: searxng.enable) |> lib.filter (searxng: searxng.enable)
|> lib.map (searxng: searxng.domain) |> lib.map (searxng: searxng.domain)
|> lib.head; |> (domains: if (lib.length domains != 0) then domains |> lib.head else null);
}; };
extensions = lib.mkOption { extensions = lib.mkOption {
type = lib.types.attrsOf ( type = lib.types.attrsOf (
@ -107,7 +107,7 @@ in
{ {
"intl.accept_languages" = "en-us,en,de-de,de"; "intl.accept_languages" = "en-us,en,de-de,de";
"browser.uiCustomization.state" = uiState; "browser.uiCustomization.state" = uiState;
"browser.startup.homepage" = cfg.homepage; "browser.startup.homepage" = lib.mkIf (cfg.homepage != null) cfg.homepage;
"sidebar.position_start" = false; "sidebar.position_start" = false;
"browser.toolbars.bookmarks.visibility" = "always"; "browser.toolbars.bookmarks.visibility" = "always";
"browser.bookmarks.restore_default_bookmarks" = false; "browser.bookmarks.restore_default_bookmarks" = false;
@ -126,7 +126,7 @@ in
extraConfig = lib.readFile "${inputs.betterfox}/user.js"; extraConfig = lib.readFile "${inputs.betterfox}/user.js";
search = { search = lib.mkIf (cfg.searchEngine != null) {
force = true; force = true;
default = "searxng"; default = "searxng";
privateDefault = "searxng"; privateDefault = "searxng";