inputs@{ machine, ... }: { imports = machine.program { name = "firefox"; inherit inputs; requirements = [ "graphical" ]; home-config = { config, flakes, pkgs, ... }: let ff-pkgs = flakes.firefox-addons.packages.${pkgs.system}; lock-false = { Value = false; Status = "locked"; }; # lock-true = { # Value = true; # Status = "locked"; # }; in { imports = [ flakes.vimium-options.homeManagerModules.vimium-options ]; home.vimiumOptions = { enable = true; outputFilePath = ".cache/vimium-options.json"; keyMappings = { unmapAll = true; map = { "j" = "scrollDown"; "k" = "scrollUp"; "<" = "goBack"; ">" = "goForward"; "gi" = "focusInput"; "gr" = "goToRoot"; "gu" = "goUp"; "g[" = "goNext"; "g]" = "goPrevious"; "gF" = "mainFrame"; "gf" = "nextFrame"; "p" = "openCopiedUrlInCurrentTab"; "P" = "openCopiedUrlInNewTab"; "G" = "scrollToBottom"; "gg" = "scrollToTop"; "C-o" = "visitPreviousTab"; "f" = "LinkHints.activateMode"; "F" = "LinkHints.activateModeToOpenInNewTab"; "" = "LinkHints.activateModeWithQueue"; "yf" = "LinkHints.activateModeToCopyLinkUrl"; }; }; exclusionRules = [ { pattern = "https?://mail.google.com/*"; } { pattern = "https?://squaredle.app/*"; } ]; }; programs.firefox = { enable = true; package = pkgs.wrapFirefox pkgs.firefox-unwrapped { extraPolicies = { DisableFormHistory = true; OfferToSaveLogins = false; PasswordManagerEnabled = false; AppAutoUpdate = false; DisableFirefoxStudies = true; DisablePocket = true; DisableTelemetry = true; UserMessaging = { WhatsNew = true; ExtensionRecommendations = false; FeatureRecommendations = false; UrlbarInterventions = false; SkipOnboarding = true; MoreFromMozilla = false; Locked = true; }; FirefoxHome = { Search = true; TopSites = false; SponsoredTopSites = false; Highlights = false; Pocket = false; SponsoredPocket = false; Snippets = false; Locked = false; }; FirefoxSuggest = { WebSuggestions = false; SponsoredSuggestions = false; ImproveSuggest = false; Locked = true; }; # TODO: https://github.com/TheRealGramdalf/nixos/blob/83f4339b121175f47940314bf5811080ac42c316/users/games/firefox/privacy.nix }; }; profiles.default = { id = 0; name = "profile_0"; isDefault = true; settings = { # specify profile-specific preferences here; check about:config for options "browser.newtabpage.activity-stream.feeds.section.highlights" = false; "browser.startup.page" = 3; # Restore previous tabs "extensions.autoDisableScopes" = 0; "extensions.pocket.enabled" = lock-false; "browser.tabs.closeWindowWithLastTab" = lock-false; "sidebar.position_start" = false; # sidebar on the right "toolkit.legacyUserProfileCustomizations.stylesheets" = true; "browser.toolbars.bookmarks.visibility" = "always"; }; userChrome = builtins.readFile ./userChrome.css; userContent = builtins.readFile ./userChrome.css; extensions.packages = with ff-pkgs; [ bitwarden ublock-origin sidebery sponsorblock vimium ]; bookmarks = { force = true; settings = [ { keyword = "!w"; url = "https://www.wikipedia.org/w/index.php?title=Special:Search&search=%s"; } { keyword = "!m"; url = "https://www.google.com/maps?q=%s"; } { keyword = "!git"; url = "https://github.com/search?q=%s&type=code"; } { keyword = "!std"; url = "https://std.rs%s"; } { keyword = "!rust"; url = "https://docs.rs/releases/search?query=%s"; } { keyword = "!np"; url = "https://search.nixos.org/packages?query=%s"; } { keyword = "!hmo"; url = "https://home-manager-options.extranix.com/?query=%s"; } { keyword = "!no"; url = "https://search.nixos.org/options?query=%s"; } # { # name = "bank"; # toolbar = true; # url = "https://web.bunq.com/user"; # } ]; }; # extensions.settings = { # "${ff-pkgs.sidebery.addonId}".settings = { # sidebar = { # # panels = with builtins; with lib; listToAttrs (map ffContainerToSideberryPanel (attrsToList containers)); # # nav = [ "Personal" "Programming"]; # }; # # https://github.com/Dash-L/nixconfig/blob/c30f6d1486a3fe2b3793ab0cb13a88edefe83b7a/home/firefox.nix#L82 # settings = { # pinnedTabsPosition = "top"; # hideEmptyPanels = false; # activateAfterClosing = "prev"; # activateAfterClosingStayInPanel = true; # newTabCtxReopen = true; # }; # }; # }; }; }; xdg.mimeApps.defaultApplications = { "x-scheme-handler/http" = [ "firefox.desktop" ]; "x-scheme-handler/https" = [ "firefox.desktop" ]; "text/html" = [ "firefox.desktop" ]; "x-scheme-handler/about" = [ "firefox.desktop" ]; "x-scheme-handler/unknown" = [ "firefox.desktop" ]; }; }; }; }