nix/home/program/firefox/default.nix

187 lines
8 KiB
Nix
Raw Normal View History

{ pkgs, config, ... }:
let
2024-10-19 03:30:02 +03:00
bookmarks = [
(mkBookmark "Dashboard" "https://home.voronind.com")
(mkBookmark "Watch" "https://watch.voronind.com")
(mkBookmark "Telegram" "https://web.telegram.org/a")
2024-10-21 14:04:36 +03:00
(mkBookmark "WorkChat" "https://fsmm.fsight.ru/fmp")
2024-10-19 03:30:02 +03:00
(mkBookmark "Mail" "https://mail.voronind.com")
(mkBookmark "WorkMail" "https://mail.fsight.ru")
(mkBookmark "Git" "https://git.voronind.com")
(mkBookmark "WorkGit" "https://git.fmp.fsight.world")
(mkBookmark "WorkBoard" "https://support.fsight.ru")
(mkBookmark "Hass" "https://iot.voronind.com")
(mkBookmark "Cloud" "https://cloud.voronind.com")
];
2024-10-23 08:48:44 +03:00
searchEngines = [
(mkSearchEngine "s" "SearX" "https://search.voronind.com/search?q={searchTerms}")
2024-10-24 09:54:56 +03:00
(mkSearchEngine "gh" "GitHub" "https://github.com/search?q={searchTerms}")
(mkSearchEngine "ghc" "GitHub Code" "https://github.com/search?q={searchTerms}&type=code")
2024-10-24 09:30:46 +03:00
(mkSearchEngine "hm" "Home Manager"
"https://home-manager-options.extranix.com/?query={searchTerms}"
)
2024-10-24 09:54:56 +03:00
(mkSearchEngine "no" "NixOS Options" "https://search.nixos.org/options?query={searchTerms}")
(mkSearchEngine "np" "NixOS Packages" "https://search.nixos.org/packages?query={searchTerms}")
(mkSearchEngine "re" "Reddit" "https://www.reddit.com/search/?q={searchTerms}")
(mkSearchEngine "ru" "RuTracker" "https://rutracker.org/forum/tracker.php?nm={searchTerms}")
(mkSearchEngine "so" "Stack Overflow" "https://stackoverflow.com/search?tab=votes&q={searchTerms}")
2024-10-23 08:48:44 +03:00
];
2024-10-19 03:30:02 +03:00
extensions = {
"addon@darkreader.org" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi";
"cliget@zaidabdulla.com" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/cliget/latest.xpi";
"foxyproxy@eric.h.jung" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/foxyproxy-standard/latest.xpi";
"uBlock0@raymondhill.net" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
"{446900e4-71c2-419f-a6a7-df9c091e268b}" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi";
"{a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7}" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/user-agent-string-switcher/latest.xpi";
"{d7742d87-e61d-4b78-b8a1-b469842139fa}" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/vimium-ff/latest.xpi";
"{e7625f06-e252-479d-ac7a-db68aeaff2cb}" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/togglefonts/latest.xpi";
# NOTE: This extension is helpful to find the required parameters for this config.
# Or find them yourself inside the `about:support`.
# "queryamoid@kaply.com" = mkExtension "https://github.com/mkaply/queryamoid/releases/download/v0.1/query_amo_addon_id-0.1-fx.xpi";
};
extraConfig = ''
// Bookmarks.
user_pref("browser.microsummary.enabled", true);
user_pref("browser.places.importBookmarksHTML", true);
user_pref("browser.toolbars.bookmarks.visibility", "never");
// Fonts.
user_pref("browser.display.use_document_fonts", 0);
user_pref("font.minimum-size.x-cyrillic", ${toString config.style.font.size.application});
user_pref("font.minimum-size.x-unicode", ${toString config.style.font.size.application});
user_pref("font.minimum-size.x-western", ${toString config.style.font.size.application});
user_pref("font.name.monospace.x-cyrillic", "${config.style.font.monospace.name}");
user_pref("font.name.monospace.x-unicode", "${config.style.font.monospace.name}");
user_pref("font.name.monospace.x-western", "${config.style.font.monospace.name}");
user_pref("font.name.sans-serif.x-cyrillic", "${config.style.font.sansSerif.name}");
user_pref("font.name.sans-serif.x-unicode", "${config.style.font.sansSerif.name}");
user_pref("font.name.sans-serif.x-western", "${config.style.font.sansSerif.name}");
user_pref("font.name.serif.x-cyrillic", "${config.style.font.serif.name}");
user_pref("font.name.serif.x-unicode", "${config.style.font.serif.name}");
user_pref("font.name.serif.x-western", "${config.style.font.serif.name}");
// Animations.
user_pref("browser.fullscreen.animateUp", 0);
user_pref("browser.fullscreen.autohide", true);
// Homepage.
user_pref("browser.newtabpage.enabled", false);
user_pref("browser.startup.homepage", "https://home.voronind.com/");
user_pref("browser.startup.page", 3);
// Passwords.
user_pref("signon.prefillForms", false);
user_pref("signon.rememberSignons", false);
// Formats.
user_pref("image.jxl.enabled", true);
// User agent.
// user_pref("general.useragent.override", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36");
2024-08-21 11:47:22 +03:00
// Disable HTTP3.
user_pref("network.http.http3.enable", false);
2024-08-21 11:47:22 +03:00
// Disable built-in DoH.
user_pref("doh-rollout.disable-heuristics", true);
user_pref("network.trr.mode", 5);
2024-08-21 11:49:33 +03:00
// HTTPS only mode.
user_pref("dom.security.https_only_mode", true);
user_pref("dom.security.https_only_mode_ever_enabled", true);
// Style.
user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true);
2024-10-19 03:55:36 +03:00
// Disable auto gain for the mic.
// user_pref("media.getusermedia.audio.processing.aec", 0);
// user_pref("media.getusermedia.audio.processing.aec.enabled", false);
// user_pref("media.getusermedia.audio.processing.agc", 0);
// user_pref("media.getusermedia.audio.processing.agc.enabled", false);
// user_pref("media.getusermedia.audio.processing.agc2.forced", false)
// user_pref("media.getusermedia.audio.processing.hpf.enabled", false);
// user_pref("media.getusermedia.audio.processing.noise", 0);
// user_pref("media.getusermedia.audio.processing.noise.enabled", false);
// user_pref("media.getusermedia.audio.processing.platform.enabled", false);
// user_pref("media.getusermedia.audio.processing.transient.enabled", false);
'';
userChrome = ''
* {
font-family: "${config.style.font.serif.name}" !important;
font-size: ${toString config.style.font.size.application}pt !important;
}
'';
userContent = ''
@-moz-document url(about:home), url(about:newtab), url(about:privatebrowsing), url(about:blank) {
.click-target-container *, .top-sites-list * {
color: #fff !important ;
text-shadow: 2px 2px 2px #222 !important ;
}
body::before {
content: "" ;
z-index: -1 ;
position: fixed ;
top: 0 ;
left: 0 ;
background: #f9a no-repeat url("${config.module.wallpaper.path}?raw=true") center ;
background-color: #222;
background-size: cover ;
/* filter: blur(4px) ; */
width: 100vw ;
height: 100vh ;
}
/* .logo { background-image: url("{repo}/logo.png?raw=true") !important; } */
/* .logo { background-image: none !important; } */
}
'';
mkExtension = install_url: {
inherit install_url;
installation_mode = "force_installed";
};
mkBookmark = name: url: { inherit name url; };
mkSearchEngine = Alias: Description: URLTemplate: {
inherit Alias Description URLTemplate;
Method = "GET";
Name = Description;
};
in
{
enable = true;
package = pkgs.firefox-esr;
# languagePacks = [ "en-US" "ru" ];
profiles.default = {
inherit extraConfig userChrome userContent;
};
policies = {
2024-10-19 03:30:02 +03:00
ManagedBookmarks = [ { toplevel_name = "Pin"; } ] ++ bookmarks;
ExtensionUpdate = true;
ExtensionSettings = {
# Block extension installation outside of this config.
"*" = {
install_sources = [ "*" ];
installation_mode = "blocked";
};
2024-10-19 03:30:02 +03:00
} // extensions;
2024-10-22 02:30:03 +03:00
# NOTE: `firefox-esr` edition is required to change search engines.
SearchEngines = {
Add = searchEngines;
2024-10-23 07:24:10 +03:00
Default = "SearX";
2024-10-22 02:30:03 +03:00
PreventInstalls = true;
Remove = [
"Bing"
"DuckDuckGo"
"Google"
"Wikipedia (en)"
];
};
};
}