274 lines
9.9 KiB
Nix
274 lines
9.9 KiB
Nix
{ lib, inputs, ... }: {
|
|
flake-file.inputs.catppuccin-userstyles-nix = {
|
|
url = "git+https://git.bug.tools/bug/userstyles";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
flake-file.inputs.bugpass = {
|
|
url = "git+https://git.bug.tools/bug/bugpass";
|
|
flake = false;
|
|
};
|
|
|
|
den.aspects.software.browsers = {
|
|
homeManager = { host, pkgs, config, ... }: let
|
|
mkExtension = src: vars: extra: rec {
|
|
id = (builtins.fromJSON (builtins.readFile "${src}/manifest.json")).browser_specific_settings.gecko.id;
|
|
xpi = pkgs.runCommand "${lib.head (lib.splitString "@" id)}.xpi" { nativeBuildInputs = [ pkgs.zip ]; } ''
|
|
cp -r ${src} src && chmod -R u+w src && cd src
|
|
for f in $(find . -type f); do
|
|
substituteInPlace "$f" ${lib.concatStringsSep " " (lib.mapAttrsToList (k: v: "--replace-quiet @${k}@ ${lib.escapeShellArg v}") vars)}
|
|
done
|
|
${lib.optionalString (extra != null) "cp -r ${extra}/. ."}
|
|
zip -r -X $out .
|
|
'';
|
|
};
|
|
|
|
bugpass = import "${inputs.bugpass}/build" { inherit pkgs; };
|
|
|
|
localExtensions = [
|
|
(mkExtension ./_extensions/redirect { domain = "tube.${host.domain}"; } null)
|
|
(mkExtension "${inputs.bugpass}/extension" { } bugpass.lib)
|
|
];
|
|
in {
|
|
programs.librewolf = {
|
|
enable = true;
|
|
|
|
nativeMessagingHosts = [ bugpass.host ];
|
|
|
|
profiles.default = {
|
|
settings = {
|
|
"browser.startup.homepage" = "https://search.${host.domain}";
|
|
"browser.startup.page" = 3;
|
|
|
|
"datareporting.healthreport.uploadEnabled" = false;
|
|
"datareporting.policy.dataSubmissionEnabled" = false;
|
|
"toolkit.telemetry.enabled" = false;
|
|
"toolkit.telemetry.unified" = false;
|
|
"toolkit.telemetry.archive.enabled" = false;
|
|
"toolkit.telemetry.newProfilePing.enabled" = false;
|
|
"toolkit.telemetry.shutdownPingSender.enabled" = false;
|
|
"toolkit.telemetry.updatePing.enabled" = false;
|
|
"toolkit.telemetry.bhrPing.enabled" = false;
|
|
"toolkit.telemetry.firstShutdownPing.enabled" = false;
|
|
"toolkit.telemetry.coverage.opt-out" = true;
|
|
"toolkit.coverage.opt-out" = true;
|
|
"app.shield.optoutstudies.enabled" = false;
|
|
"app.normandy.enabled" = false;
|
|
"app.normandy.api_url" = "";
|
|
"breakpad.reportURL" = "";
|
|
"browser.tabs.crashReporting.sendReport" = false;
|
|
"browser.crashReports.unsubmittedCheck.enabled" = false;
|
|
"browser.crashReports.unsubmittedCheck.autoSubmit2" = false;
|
|
|
|
"privacy.resistFingerprinting.letterboxing" = false;
|
|
"privacy.donottrackheader.enabled" = true;
|
|
"privacy.globalprivacycontrol.enabled" = true;
|
|
"privacy.resistFingerprinting" = false;
|
|
"privacy.fingerprintingProtection" = true;
|
|
"privacy.fingerprintingProtection.overrides" = "+AllTargets,-CSSPrefersColorScheme,-WebGLRenderInfo,-WebGLRenderCapability";
|
|
|
|
"browser.search.separatePrivateDefault" = false;
|
|
|
|
"browser.download.autohideButton" = true;
|
|
# save straight to ~/down (janitor sorts it) instead of asking
|
|
"browser.download.folderList" = 2;
|
|
"browser.download.dir" = "${config.home.homeDirectory}/down";
|
|
"browser.download.useDownloadDir" = true;
|
|
"browser.download.always_ask_before_handling_new_types" = false;
|
|
"browser.quitShortcut.disabled" = true;
|
|
"browser.sessionstore.resume_session_once" = true;
|
|
|
|
"browser.cache.memory.capacity" = 65536;
|
|
"browser.sessionstore.interval" = 60000;
|
|
"browser.sessionstore.max_tabs_undo" = 10;
|
|
"browser.sessionstore.max_windows_undo" = 1;
|
|
"browser.tabs.unloadOnLowMemory" = true;
|
|
|
|
"gfx.webrender.all" = true;
|
|
"gfx.canvas.accelerated" = true;
|
|
"media.hardware-video-decoding.force-enabled" = true;
|
|
|
|
"network.http.max-connections" = 1500;
|
|
"network.http.max-persistent-connections-per-server" = 10;
|
|
"network.prefetch-next" = false;
|
|
|
|
"browser.tabs.animate" = false;
|
|
"browser.fullscreen.animate" = false;
|
|
|
|
"ui.systemUsesDarkTheme" = 1;
|
|
"browser.theme.content-theme" = 0;
|
|
|
|
"layout.css.prefers-color-scheme.content-override" = 0;
|
|
|
|
"xpinstall.signatures.required" = false;
|
|
|
|
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
|
|
|
"librewolf.webgl.prompt.hide" = false;
|
|
|
|
"webgl.disabled" = false;
|
|
"webgl.force-enabled" = true;
|
|
"webgl2.enable-webgl2" = true;
|
|
|
|
"privacy.clearOnShutdown_v2.cookiesAndStorage" = false;
|
|
"privacy.clearOnShutdown.cookies" = false;
|
|
"privacy.clearOnShutdown.offlineApps" = false;
|
|
"privacy.clearOnShutdown.sessions" = false;
|
|
};
|
|
|
|
userChrome = builtins.readFile ./userChrome.css;
|
|
userContent = builtins.readFile ./userContent.css;
|
|
|
|
search = {
|
|
force = true;
|
|
|
|
default = "search.${host.domain}";
|
|
|
|
engines = {
|
|
"search.${host.domain}" = {
|
|
urls = [
|
|
{
|
|
template = "https://search.${host.domain}/search";
|
|
params = [
|
|
{ name = "q"; value = "{searchTerms}"; }
|
|
];
|
|
}
|
|
];
|
|
|
|
icon = "https://search.${host.domain}/favicon.ico";
|
|
definedAliases = [ "@s" "@sq" ];
|
|
};
|
|
|
|
"NixOS Packages" = {
|
|
urls = [
|
|
{
|
|
template = "https://search.nixos.org/packages";
|
|
params = [
|
|
{ name = "channel"; value = "unstable"; }
|
|
{ name = "query"; value = "{searchTerms}"; }
|
|
];
|
|
}
|
|
];
|
|
icon = "https://search.nixos.org/favicon.png";
|
|
definedAliases = [ "@np" ];
|
|
};
|
|
|
|
"NixOS Options" = {
|
|
urls = [
|
|
{
|
|
template = "https://search.nixos.org/options";
|
|
params = [
|
|
{ name = "channel"; value = "unstable"; }
|
|
{ name = "query"; value = "{searchTerms}"; }
|
|
];
|
|
}
|
|
];
|
|
icon = "https://search.nixos.org/favicon.png";
|
|
definedAliases = [ "@no" ];
|
|
};
|
|
|
|
"Home Manager Options" = {
|
|
urls = [
|
|
{
|
|
template = "https://home-manager-options.extranix.com/";
|
|
params = [
|
|
{ name = "query"; value = "{searchTerms}"; }
|
|
{ name = "release"; value = "master"; }
|
|
];
|
|
}
|
|
];
|
|
icon = "https://home-manager-options.extranix.com/images/favicon.png";
|
|
definedAliases = [ "@hm" ];
|
|
};
|
|
|
|
google.metaData.hidden = true;
|
|
bing.metaData.hidden = true;
|
|
amazondotcom-us.metaData.hidden = true;
|
|
ebay.metaData.hidden = true;
|
|
|
|
wikipedia.metaData = {
|
|
hidden = false;
|
|
alias = "@w";
|
|
};
|
|
};
|
|
};
|
|
|
|
extensions = {
|
|
force = true;
|
|
settings = {
|
|
"{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}" = {
|
|
force = true;
|
|
settings = inputs.catppuccin-userstyles-nix.stylusSettings.${pkgs.stdenv.hostPlatform.system} {
|
|
global = {
|
|
lightFlavor = "mocha";
|
|
darkFlavor = "mocha";
|
|
accentColor = "mauve";
|
|
};
|
|
};
|
|
};
|
|
|
|
"{3c078156-979c-498b-8990-85f7987dd929}" = {
|
|
force = true;
|
|
settings.sidebarCSS = builtins.readFile ./sidebery.css;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
policies = {
|
|
OverrideFirstRunPage = "";
|
|
OverridePostUpdatePage = "";
|
|
|
|
BlockAboutConfig = true;
|
|
|
|
DisableTelemetry = true;
|
|
DisableFirefoxStudies = true;
|
|
DisableFeedbackCommands = true;
|
|
DisableCrashReporter = true;
|
|
|
|
DisablePocket = true;
|
|
|
|
DisableFirefoxAccounts = false;
|
|
|
|
ExtensionSettings = let
|
|
mkExtensions = ids: lib.genAttrs ids (id: {
|
|
install_url = "https://addons.mozilla.org/firefox/downloads/latest/${id}/latest.xpi";
|
|
installation_mode = "force_installed";
|
|
private_browsing = true;
|
|
});
|
|
in {
|
|
"*".installation_mode = "blocked";
|
|
} // (mkExtensions [
|
|
# "{cb31ec5d-c49a-4e5a-b240-16c767444f62}" # indie-wiki-buddy
|
|
|
|
"{1b66b5ad-408f-4300-aac6-55a68b2b24ff}" # catppuccin-mocha-no-borders
|
|
|
|
"{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}" # styl-us
|
|
|
|
"{3c078156-979c-498b-8990-85f7987dd929}" # sidebery
|
|
|
|
"{60f82f00-9ad5-4de5-b31c-b16a47c51558}" # cookie-quick-manager
|
|
|
|
# "{88ebde3a-4581-4c6b-8019-2a05a9e3e938}" # hide-youtube-shorts
|
|
|
|
# "[email protected]" # tampermonkey
|
|
|
|
"[email protected]" # dearrow
|
|
|
|
"[email protected]" # sponsorblock
|
|
|
|
"[email protected]" # ublock-origin
|
|
|
|
# "{a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7}" # user-agent-string-switcher
|
|
|
|
# "{762f9885-5a13-4abd-9c77-433dcd38b8fd}" # return-youtube-dislikes
|
|
]) // lib.listToAttrs (map (e: lib.nameValuePair e.id {
|
|
install_url = "file://${e.xpi}";
|
|
installation_mode = "force_installed";
|
|
}) localExtensions);
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|