idiosyn/home/config/nil/firefox.nix
Mikael Voss d77c8e70de
Some checks are pending
nix flake check / check (aarch64-linux) (push) Waiting to run
nix flake check / check (x86_64-linux) (push) Waiting to run
home/firefox: Update CSS hacks repository
2024-12-11 14:22:19 +01:00

168 lines
5.2 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ firefox, ... }: { config, lib, pkgs, ... }@args:
let
osConfig = args.osConfig or { };
firefox-csshacks = pkgs.fetchFromGitHub {
owner = "MrOtherGuy";
repo = "firefox-csshacks";
rev = "890a03f4ffd8ba7833a42aaa09d7b40565c04dd4";
sparseCheckout = [ "!/*" "/chrome" "/content" ];
hash = "sha256-qCj5BuRa7eq6uqWdbrD8FwLotuVSXksk1l5j07kWCUk=";
};
in lib.mkIf (osConfig.hardware.graphics.enable or false) {
programs.firefox = {
enable = true;
package = firefox.packages.${pkgs.system}.firefox;
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 = {
inherit settings userChrome search;
isDefault = true;
};
sneaky = {
inherit settings userChrome search;
id = 1;
};
vanilla = {
inherit userChrome search;
id = 2;
};
};
};
xdg.mimeApps.defaultApplications = {
default-web-browser = [ "firefox.desktop" ];
};
}