414 lines
12 KiB
Nix
414 lines
12 KiB
Nix
{
|
|
repoFlake,
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
# Search extension names with below command:
|
|
# nix flake show --json "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons" --all-systems | jq -r '.packages."x86_64-linux" | keys[]' | rg QUERY
|
|
ryceeAddons = with pkgs.nur.repos.rycee.firefox-addons; [
|
|
ublock-origin
|
|
|
|
# bypass-paywalls-clean (can't use, was creating popups)
|
|
consent-o-matic
|
|
terms-of-service-didnt-read
|
|
|
|
auto-tab-discard
|
|
|
|
# redirector # For nixos wiki
|
|
# darkreader
|
|
|
|
facebook-container
|
|
control-panel-for-twitter
|
|
# containerise
|
|
facebook-tracking-removal
|
|
vimium
|
|
cookie-autodelete
|
|
auto-tab-discard
|
|
|
|
youtube-recommended-videos
|
|
];
|
|
|
|
customAddons = [
|
|
|
|
];
|
|
|
|
search = {
|
|
force = true;
|
|
default = "DuckDuckGo";
|
|
privateDefault = "DuckDuckGo";
|
|
};
|
|
|
|
mkProfile =
|
|
override:
|
|
lib.recursiveUpdate {
|
|
extensions = ryceeAddons ++ customAddons;
|
|
inherit search;
|
|
|
|
settings = {
|
|
# automatically enable extensions
|
|
"extensions.autoDisableScopes" = 0;
|
|
|
|
"middlemouse.paste" = false;
|
|
|
|
"browser.download.useDownloadDir" = false;
|
|
"browser.tabs.insertAfterCurrent" = true;
|
|
"browser.tabs.warnOnClose" = true;
|
|
"browser.toolbars.bookmarks.visibility" = "never";
|
|
"browser.quitShortcut.disabled" = false;
|
|
|
|
# restore the previous session automatically
|
|
"browser.startup.page" = 3;
|
|
"browser.sessionstore.resume_from_crash" = true;
|
|
"browser.sessionstore.restore_pinned_tabs_on_demand" = true;
|
|
"browser.sessionstore.restore_on_demand" = true;
|
|
|
|
"browser.urlbar.suggest.bookmark" = true;
|
|
"browser.urlbar.suggest.engines" = true;
|
|
"browser.urlbar.suggest.history" = true;
|
|
"browser.urlbar.suggest.openpage" = true;
|
|
"browser.urlbar.suggest.topsites" = false;
|
|
"browser.urlbar.trimHttps" = true;
|
|
|
|
"sidebar.position_start" = false;
|
|
"findbar.highlightAll" = true;
|
|
|
|
"browser.tabs.hoverPreview.enabled" = true;
|
|
|
|
# Disable fx accounts
|
|
"identity.fxaccounts.enabled" = false;
|
|
# Disable "save password" prompt
|
|
"signon.rememberSignons" = false;
|
|
# Harden
|
|
"privacy.trackingprotection.enabled" = true;
|
|
"dom.security.https_only_mode" = true;
|
|
|
|
# Disable irritating first-run stuff
|
|
"browser.disableResetPrompt" = true;
|
|
"browser.download.panel.shown" = true;
|
|
"browser.feeds.showFirstRunUI" = false;
|
|
"browser.messaging-system.whatsNewPanel.enabled" = false;
|
|
"browser.rights.3.shown" = true;
|
|
"browser.shell.checkDefaultBrowser" = false;
|
|
"browser.shell.defaultBrowserCheckCount" = 1;
|
|
"browser.startup.homepage_override.mstone" = "ignore";
|
|
"browser.uitour.enabled" = false;
|
|
"startup.homepage_override_url" = "";
|
|
"trailhead.firstrun.didSeeAboutWelcome" = true;
|
|
"browser.bookmarks.restore_default_bookmarks" = false;
|
|
"browser.bookmarks.addedImportButton" = true;
|
|
|
|
# Disable "Save to Pocket" or Pocket entirely
|
|
"extensions.pocket.enabled" = false;
|
|
|
|
# Disable telemetry
|
|
"toolkit.telemetry.enabled" = false;
|
|
"toolkit.telemetry.unified" = false;
|
|
"toolkit.telemetry.archive.enabled" = false;
|
|
"datareporting.healthreport.uploadEnabled" = false;
|
|
"app.shield.optoutstudies.enabled" = false;
|
|
"browser.discovery.enabled" = false;
|
|
"browser.newtabpage.activity-stream.feeds.telemetry" = false;
|
|
"browser.newtabpage.activity-stream.telemetry" = false;
|
|
"browser.ping-centre.telemetry" = false;
|
|
"datareporting.healthreport.service.enabled" = false;
|
|
"datareporting.policy.dataSubmissionEnabled" = false;
|
|
"datareporting.sessions.current.clean" = true;
|
|
"devtools.onboarding.telemetry.logged" = false;
|
|
"toolkit.telemetry.bhrPing.enabled" = false;
|
|
"toolkit.telemetry.firstShutdownPing.enabled" = false;
|
|
"toolkit.telemetry.hybridContent.enabled" = false;
|
|
"toolkit.telemetry.newProfilePing.enabled" = false;
|
|
"toolkit.telemetry.prompted" = 2;
|
|
"toolkit.telemetry.rejected" = true;
|
|
"toolkit.telemetry.reportingpolicy.firstRun" = false;
|
|
"toolkit.telemetry.server" = "";
|
|
"toolkit.telemetry.shutdownPingSender.enabled" = false;
|
|
"toolkit.telemetry.unifiedIsOptIn" = false;
|
|
"toolkit.telemetry.updatePing.enabled" = false;
|
|
|
|
# Disable any feeds on the new tab page
|
|
"browser.newtabpage.activity-stream.showTopSites" = false;
|
|
"browser.newtabpage.activity-stream.default.sites" = lib.mkForce [ ];
|
|
"browser.newtabpage.activity-stream.discoverystream.enabled" = false;
|
|
"browser.newtabpage.activity-stream.feeds.topsites" = false;
|
|
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
|
|
"browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts" = false;
|
|
"browser.newtabpage.blocked" = lib.genAttrs [
|
|
# Youtube
|
|
"26UbzFJ7qT9/4DhodHKA1Q=="
|
|
# Facebook
|
|
"4gPpjkxgZzXPVtuEoAL9Ig=="
|
|
# Wikipedia
|
|
"eV8/WsSLxHadrTL1gAxhug=="
|
|
# Reddit
|
|
"gLv0ja2RYVgxKdp0I5qwvA=="
|
|
# Amazon
|
|
"K00ILysCaEq8+bEqV/3nuw=="
|
|
# Twitter
|
|
"T9nJot5PurhJSy8n038xGA=="
|
|
] (_: 1);
|
|
"browser.topsites.blockedSponsors" = [
|
|
"adidas"
|
|
"temuaffiliateprogram.pxf"
|
|
"s.click.aliexpress"
|
|
];
|
|
|
|
# enable userChrome
|
|
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
|
"devtools.chrome.enabled" = true;
|
|
"devtools.debugger.remote-enabled" = true;
|
|
|
|
# disable translations for some languages
|
|
"browser.translations.neverTranslateLanguages" = [
|
|
"en"
|
|
"de"
|
|
];
|
|
"browser.translations.automaticallyPopup" = false;
|
|
|
|
# enable pipewire (and libcamera) sources
|
|
"media.webrtc.camera.allow-pipewire" = true;
|
|
};
|
|
|
|
userChrome =
|
|
let
|
|
name = override.color or colors.grey;
|
|
value = colorValues."${name}".normal;
|
|
valueBright = colorValues."${name}".highlight;
|
|
valueDark = colorValues."${name}".inactive;
|
|
in
|
|
''
|
|
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
|
|
|
|
#nav-bar {
|
|
background-color: ${value} !important;
|
|
color: black !important;
|
|
}
|
|
|
|
/* don't show close button on background tabs */
|
|
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected]):not([pinned]):not([hover]) .tab-close-button {
|
|
display: none !important;
|
|
}
|
|
|
|
/* show close button on hover */
|
|
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected]):not([pinned]):hover .tab-close-button {
|
|
display: -moz-inline-box !important;
|
|
}
|
|
|
|
|
|
/* default */
|
|
#TabsToolbar {
|
|
background: ${valueDark} !important;
|
|
}
|
|
|
|
/* default tab */
|
|
#TabsToolbar #tabbrowser-tabs .tabbrowser-tab .tab-content {
|
|
background: ${value} !important;
|
|
opacity: 0.8
|
|
}
|
|
|
|
/* selected tab */
|
|
#TabsToolbar #tabbrowser-tabs .tabbrowser-tab[selected] .tab-content {
|
|
background: ${valueBright} !important;
|
|
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
|
|
}
|
|
|
|
/* hovered tab */
|
|
#TabsToolbar #tabbrowser-tabs .tabbrowser-tab:hover:not([selected]) .tab-content {
|
|
background: ${valueBright} !important;
|
|
}
|
|
|
|
/* unloaded/pending tab */
|
|
#TabsToolbar #tabbrowser-tabs .tabbrowser-tab[pending] .tab-content {
|
|
background: ${valueDark} !important;
|
|
}
|
|
'';
|
|
|
|
# /* new tab */
|
|
# #TabsToolbar #tabbrowser-tabs #tabs-newtab-button .toolbarbutton-icon {
|
|
# background: unset !important;
|
|
# }
|
|
|
|
# #TabsToolbar #tabbrowser-tabs #tabs-newtab-button {
|
|
# /* background: var(--default_tabs_bg_newtab) !important;
|
|
# }
|
|
|
|
# /* hovered new tab */
|
|
# #TabsToolbar #tabbrowser-tabs #tabs-newtab-button:hover {
|
|
# background: var(--default_tabs_bg_newtab_hovered) !important;
|
|
# }
|
|
|
|
} (builtins.removeAttrs override [ "color" ]);
|
|
|
|
# TODO: insert the id automatically
|
|
mkProfiles = attrs: builtins.mapAttrs (_k: v: v) attrs;
|
|
|
|
colors = builtins.mapAttrs (name: _: name) colorValues;
|
|
|
|
colorValues = {
|
|
blue = {
|
|
normal = "#49b1fc";
|
|
highlight = "#05a9fc"; # Brighter blue
|
|
inactive = "#1f81c6"; # Darker blue
|
|
};
|
|
green = {
|
|
normal = "#51cd00";
|
|
highlight = "#5ae200"; # Brighter green
|
|
inactive = "#45ad00"; # Darker green
|
|
};
|
|
orange = {
|
|
normal = "#ff9800";
|
|
highlight = "#ffb74d"; # Brighter orange
|
|
inactive = "#c76a00"; # Darker orange
|
|
};
|
|
red = {
|
|
normal = "#f6685e";
|
|
highlight = "#ff4336"; # Brighter red
|
|
inactive = "#aa463f"; # Darker red
|
|
};
|
|
yellow = {
|
|
normal = "#fced4b";
|
|
highlight = "#fce705"; # Brighter yellow
|
|
inactive = "#dbbe00"; # Darker yellow
|
|
};
|
|
purple = {
|
|
normal = "#9c27b0";
|
|
highlight = "#ab47bc"; # Brighter purple
|
|
inactive = "#7b1fa2"; # Darker purple
|
|
};
|
|
pink = {
|
|
normal = "#e91e63";
|
|
highlight = "#ff6090"; # Brighter pink
|
|
inactive = "#c2185b"; # Darker pink
|
|
};
|
|
brown = {
|
|
normal = "#795548";
|
|
highlight = "#a88b6f"; # Brighter brown
|
|
inactive = "#4e3b30"; # Darker brown
|
|
};
|
|
grey = {
|
|
normal = "#9e9e9e";
|
|
highlight = "#bdbdbd"; # Brighter grey
|
|
inactive = "#757575"; # Darker grey
|
|
};
|
|
teal = {
|
|
normal = "#009688";
|
|
highlight = "#26c6da"; # Brighter teal
|
|
inactive = "#00796b"; # Darker teal
|
|
};
|
|
};
|
|
|
|
in
|
|
{
|
|
nixpkgs.overlays = [
|
|
repoFlake.inputs.nur.overlay
|
|
];
|
|
|
|
nixpkgs.config.allowUnfreePredicate =
|
|
pkg:
|
|
builtins.elem (lib.getName pkg) [
|
|
"youtube-recommended-videos"
|
|
];
|
|
|
|
programs.librewolf = {
|
|
enable = false;
|
|
};
|
|
programs.firefox = {
|
|
enable = true;
|
|
package = pkgs.firefox-esr-128;
|
|
|
|
profiles = mkProfiles {
|
|
"personal" = mkProfile {
|
|
id = 0;
|
|
isDefault = true;
|
|
color = colors.blue;
|
|
};
|
|
"comms" = mkProfile {
|
|
id = 1;
|
|
color = colors.blue;
|
|
};
|
|
"admin" = mkProfile {
|
|
id = 2;
|
|
color = colors.blue;
|
|
};
|
|
"infra" = mkProfile {
|
|
id = 3;
|
|
color = colors.blue;
|
|
};
|
|
"finance" = mkProfile {
|
|
id = 4;
|
|
color = colors.yellow;
|
|
};
|
|
"business-admin" = mkProfile {
|
|
id = 5;
|
|
color = colors.teal;
|
|
};
|
|
"business-comms" = mkProfile {
|
|
id = 6;
|
|
color = colors.teal;
|
|
};
|
|
"business-dev" = mkProfile {
|
|
id = 7;
|
|
color = colors.teal;
|
|
};
|
|
"holo-dev" = mkProfile {
|
|
id = 8;
|
|
color = colors.green;
|
|
};
|
|
"holo-infra" = mkProfile {
|
|
id = 9;
|
|
color = colors.green;
|
|
};
|
|
"holo-comms" = mkProfile {
|
|
id = 10;
|
|
color = colors.green;
|
|
};
|
|
"justyna" = mkProfile {
|
|
id = 11;
|
|
color = colors.pink;
|
|
};
|
|
"justyna-office" = mkProfile {
|
|
id = 12;
|
|
color = colors.pink;
|
|
};
|
|
};
|
|
|
|
};
|
|
|
|
# create one desktop entry for each profile
|
|
xdg.desktopEntries = lib.mapAttrs' (
|
|
k: _v:
|
|
lib.nameValuePair "firefox-profile-${k}" {
|
|
categories = [
|
|
"Network"
|
|
"WebBrowser"
|
|
];
|
|
exec = "${lib.getExe config.programs.firefox.package} -P ${k}";
|
|
genericName = "Web Browser";
|
|
icon =
|
|
builtins.replaceStrings [ ".desktop" ] [ "" ]
|
|
config.programs.firefox.package.desktopItem.name;
|
|
mimeType = [
|
|
"text/html"
|
|
"text/xml"
|
|
"application/xhtml+xml"
|
|
"application/vnd.mozilla.xul+xml"
|
|
"x-scheme-handler/http"
|
|
"x-scheme-handler/https"
|
|
];
|
|
name = "Firefox: ${k}";
|
|
startupNotify = true;
|
|
settings.StartupWMClass =
|
|
# To group windows of different profiles.
|
|
# Set WM_CLASS on Xorg using --class, set app-id on Wayland using --name.
|
|
#if profile.name == "default"
|
|
#then "firefox"
|
|
#else "firefox-${profile.name}";
|
|
"firefox";
|
|
terminal = false;
|
|
type = "Application";
|
|
}
|
|
) config.programs.firefox.profiles;
|
|
}
|