idiosyn/home/config/nil/firefox.nix

169 lines
5.2 KiB
Nix
Raw Normal View History

2024-12-10 21:04:25 +01:00
{ firefox, ... }: { config, lib, pkgs, ... }@args:
2024-08-18 13:47:18 +02:00
let
osConfig = args.osConfig or { };
firefox-csshacks = pkgs.fetchFromGitHub {
owner = "MrOtherGuy";
repo = "firefox-csshacks";
rev = "890a03f4ffd8ba7833a42aaa09d7b40565c04dd4";
2024-08-18 13:47:18 +02:00
sparseCheckout = [ "!/*" "/chrome" "/content" ];
hash = "sha256-qCj5BuRa7eq6uqWdbrD8FwLotuVSXksk1l5j07kWCUk=";
2024-08-18 13:47:18 +02:00
};
in lib.mkIf (osConfig.hardware.graphics.enable or false) {
programs.firefox = {
enable = true;
2024-12-10 21:04:25 +01:00
package = firefox.packages.${pkgs.system}.firefox;
2024-08-18 13:47:18 +02:00
profiles = let
settings = {
# use OS locale
"intl.regional_prefs.use_os_locales" = true;
# localisation
"intl.accept_languages" = "en-gb,en,de,fr,es-es,es,pt,ja";
"intl.locale.requested" = "en-GB,en,de,fr,es-ES,es,pt,ja";
# founts
"font.default.x-unicode" = "sans-serif";
"font.default.x-western" = "sans-serif";
"font.name.sans-serif.x-unicode" = "Lato";
"font.name.sans-serif.x-western" = "Lato";
"font.name.monospace.x-unicode" = "Fira Code";
"font.name.monospace.x-western" = "Fira Code";
# hardware acceleration
"layers.acceleration.force-enabled" = true;
# always ask for download location
"browser.download.useDownloadDir" = false;
# private containor for new tab page thumbnails
"privacy.usercontext.about_newtab_segregation.enabled" = true;
# disable access to device sensors
"device.sensors.enabled" = false;
"dom.battery.enabled" = false;
# disable media autoplay
"media.autoplay.enabled" = false;
# disable password autofill
"signon.autofillForms" = false;
# enable user profile customisation
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
};
userChrome = lib.concatMapStrings (css:
"@import url('${firefox-csshacks}/chrome/${css}.css');\n"
) [
"hide_tabs_with_one_tab"
"autohide_bookmarks_and_main_toolbars"
];
search = {
default = "Google Search";
force = true;
engines = {
"Google Search" = {
urls = [{ template = "https://www.google.com/search?q={searchTerms}"; }];
definedAliases = [ "g" ];
};
"Nix Packages" = {
urls = [{
template = "https://search.nixos.org/packages";
params = [
{ name = "channel"; value = "unstable"; }
{ name = "type"; value = "packages"; }
{ name = "query"; value = "{searchTerms}"; }
];
}];
definedAliases = [ "np" ];
};
"Gentoo Packages" = {
urls = [{ template = "https://packages.gentoo.org/packages/search?q={searchTerms}"; }];
definedAliases = [ "gp" ];
};
"Alpine Packages" = {
urls = [{ template = "https://pkgs.alpinelinux.org/packages?name={searchTerms}"; }];
definedAliases = [ "ap" ];
};
"NixOS Wiki" = {
urls = [{ template = "https://nixos.wiki/index.php?search={searchTerms}"; }];
definedAliases = [ "nw" ];
};
"Wikipedia (eng)" = {
urls = [{ template = "https://en.wikipedia.org/wiki/Special:Search?search={searchTerms}"; }];
definedAliases = [ "w" ];
};
"Wikipedia (deu)" = {
urls = [{ template = "https://de.wikipedia.org/wiki/Spezial:Suche?search={searchTerms}"; }];
definedAliases = [ "wd" ];
};
"Wiktionary (eng)" = {
urls = [{ template = "https://en.wiktionary.org/wiki/Special:Search?search={searchTerms}"; }];
definedAliases = [ "k" ];
};
"Wiktionary (deu)" = {
urls = [{ template = "https://de.wiktionary.org/wiki/Spezial:Suche?search={searchTerms}"; }];
definedAliases = [ "kd" ];
};
"Linguee (ende)" = {
urls = [{ template = "https://www.linguee.com/english-german/search?query={searchTerms}"; }];
definedAliases = [ "en" ];
};
"Linguee (enfr)" = {
urls = [{ template = "https://www.linguee.com/english-french/search?query={searchTerms}"; }];
definedAliases = [ "fr" ];
};
"Linguee (enes)" = {
urls = [{ template = "https://www.linguee.com/english-spanish/search?query={searchTerms}"; }];
definedAliases = [ "es" ];
};
"Linguee (enpt)" = {
urls = [{ template = "https://www.linguee.com/english-portuguese/search?query={searchTerms}"; }];
definedAliases = [ "pt" ];
};
"Jisho" = {
urls = [{ template = "https://jisho.org/search/{searchTerms}"; }];
definedAliases = [ "ja" ];
};
"DeepL" = {
urls = [{ template = "https://www.deepl.com/translator#en//{searchTerms}"; }];
definedAliases = [ "dpl" ];
};
};
};
in {
default = {
2024-12-10 21:04:25 +01:00
inherit settings userChrome search;
2024-08-18 13:47:18 +02:00
isDefault = true;
};
sneaky = {
2024-12-10 21:04:25 +01:00
inherit settings userChrome search;
2024-08-18 13:47:18 +02:00
id = 1;
};
vanilla = {
inherit userChrome search;
id = 2;
};
};
};
2024-08-25 19:10:52 +02:00
xdg.mimeApps.defaultApplications = {
default-web-browser = [ "firefox.desktop" ];
};
2024-08-18 13:47:18 +02:00
}