nixos-config/programs/desktop/firefox/default.nix

155 lines
3.6 KiB
Nix
Raw Normal View History

2024-11-06 09:50:59 +00:00
{
pkgs,
2024-11-06 10:38:51 +00:00
lib,
2024-11-16 08:53:35 +00:00
rycee-nur-expressions,
2024-11-06 09:50:59 +00:00
...
2024-11-09 14:02:26 +00:00
}:
let
2024-11-16 08:53:35 +00:00
rycee = import rycee-nur-expressions { inherit pkgs; };
2024-11-06 10:38:51 +00:00
extensions = {
"ublock-origin" = [
"alarms"
"dns"
"menus"
"privacy"
"storage"
"tabs"
"unlimitedStorage"
"webNavigation"
"webRequest"
"webRequestBlocking"
"<all_urls>"
"http://*/*"
"https://*/*"
"file://*/*"
"https://easylist.to/*"
"https://*.fanboy.co.nz/*"
"https://filterlists.com/*"
"https://forums.lanik.us/*"
"https://github.com/*"
"https://*.github.io/*"
"https://github.com/uBlockOrigin/*"
"https://ublockorigin.github.io/*"
"https://*.reddit.com/r/uBlockOrigin/*"
];
"sidebery" = [
"activeTab"
"tabs"
"contextualIdentities"
"cookies"
"storage"
"unlimitedStorage"
"sessions"
"menus"
"menus.overrideContext"
"search"
"theme"
];
2024-11-06 14:19:39 +00:00
"darkreader" = [
"alarms"
"contextMenus"
"storage"
"tabs"
"theme"
"<all_urls>"
];
"plasma-integration" = [
"nativeMessaging"
"notifications"
"storage"
"downloads"
"tabs"
"<all_urls>"
"contextMenus"
"*://*/*"
];
"keepassxc-browser" = [
"activeTab"
"clipboardWrite"
"contextMenus"
"cookies"
"nativeMessaging"
"notifications"
"storage"
"tabs"
"webNavigation"
"webRequest"
"webRequestBlocking"
"https://*/*"
"http://*/*"
"https://api.github.com/"
"<all_urls>"
];
"sponsorblock" = [
"storage"
"scripting"
"https://sponsor.ajay.app/*"
"https://*.youtube.com/*"
"https://www.youtube-nocookie.com/embed/*"
];
"dearrow" = [
"storage"
"unlimitedStorage"
"alarms"
"https://sponsor.ajay.app/*"
"https://dearrow-thumb.ajay.app/*"
"https://*.googlevideo.com/*"
"https://*.youtube.com/*"
"https://www.youtube-nocookie.com/embed/*"
"scripting"
];
2024-11-06 10:38:51 +00:00
};
2024-11-09 14:02:26 +00:00
in
{
2024-11-06 09:50:59 +00:00
programs.firefox = {
enable = true;
2024-11-08 10:18:04 +00:00
nativeMessagingHosts = with pkgs; [
kdePackages.plasma-browser-integration
keepassxc
];
2024-11-06 09:50:59 +00:00
profiles.default = {
containersForce = true;
2024-11-16 08:53:35 +00:00
extensions = map (v: rycee.firefox-addons.${v}) (lib.attrNames extensions);
2024-11-06 09:50:59 +00:00
settings = {
"extensions.autoDisableScopes" = 0;
2024-11-06 14:14:16 +00:00
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
2024-11-07 07:57:31 +00:00
"browser.tabs.inTitlebar" = 0;
2024-11-07 07:59:13 +00:00
"widget.use-xdg-desktop-portal.file-picker" = 1;
"widget.use-xdg-desktop-portal.location" = 1;
"widget.use-xdg-desktop-portal.mime-handler" = 1;
"widget.use-xdg-desktop-portal.open-uri" = 1;
"widget.use-xdg-desktop-portal.settings" = 1;
2024-11-12 13:31:41 +00:00
"extensions.pocket.enabled" = false;
"browser.newtabpage.activity-stream.showSponsored" = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
"browser.newtabpage.activity-stream.default.sites" = "";
2024-11-06 09:50:59 +00:00
};
userChrome = ''
2024-11-06 10:38:51 +00:00
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
2024-11-07 07:57:31 +00:00
#TabsToolbar {
visibility: collapse;
}
#titlebar {
display: none;
}
#sidebar-header {
display: none;
2024-11-06 09:50:59 +00:00
}
'';
};
};
2024-11-09 14:02:26 +00:00
assertions = lib.mapAttrsToList (
k: v:
let
2024-11-16 08:53:35 +00:00
unaccepted = lib.subtractLists v rycee.firefox-addons.${k}.meta.mozPermissions;
2024-11-09 14:02:26 +00:00
in
{
assertion = unaccepted == [ ];
message = ''Extension ${k} has unaccepted permissions: ${builtins.toJSON unaccepted}'';
}
) extensions;
2024-11-06 09:50:59 +00:00
}