From ab64b44497910b3a1161c5d6d9e5ac12f98931a0 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Mon, 24 Jun 2024 14:01:07 -0400 Subject: [PATCH] firefox: move policies to nixos config --- homeManagerModules/apps/firefox/default.nix | 106 +---------------- homes/aly.nix | 122 ++++++++++---------- homes/dustin.nix | 2 +- nixosModules/apps/default.nix | 2 +- nixosModules/apps/firefox/default.nix | 108 +++++++++++++++++ nixosModules/options.nix | 5 + 6 files changed, 179 insertions(+), 166 deletions(-) create mode 100644 nixosModules/apps/firefox/default.nix diff --git a/homeManagerModules/apps/firefox/default.nix b/homeManagerModules/apps/firefox/default.nix index de95ef69..86be31c7 100644 --- a/homeManagerModules/apps/firefox/default.nix +++ b/homeManagerModules/apps/firefox/default.nix @@ -7,111 +7,7 @@ config = lib.mkIf config.alyraffauf.apps.firefox.enable { programs.firefox = { enable = true; - nativeMessagingHosts = lib.optionals (config.alyraffauf.apps.keepassxc.enable) [pkgs.keepassxc]; - - policies = { - Cookies.Behavior = "reject-foreign"; - DisableFirefoxStudies = true; - DisableMasterPasswordCreation = true; - DisablePocket = true; - DisableProfileImport = true; - DisableSetDesktopBackground = true; - DisableTelemetry = true; - DisplayBookmarksToolbar = "newtab"; - - DNSOverHTTPS = { - Enabled = true; - Fallback = true; - }; - - DontCheckDefaultBrowser = true; - - EnableTrackingProtection = { - Cryptomining = true; - Fingerprinting = true; - EmailTracking = true; - Locked = false; - Value = true; - }; - - EncryptedMediaExtensions = { - Enabled = true; - Locked = false; - }; - - ExtensionSettings = - { - "uBlock0@raymondhill.net" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; - installation_mode = "normal_installed"; - }; - "jid1-BoFifL9Vbdl2zQ@jetpack" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/decentraleyes/latest.xpi"; - installation_mode = "normal_installed"; - }; - } - // lib.attrsets.optionalAttrs (config.alyraffauf.apps.keepassxc.enable) { - "keepassxc-browser@keepassxc.org" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/keepassxc-browser/latest.xpi"; - installation_mode = "normal_installed"; - }; - }; - - FirefoxHome = { - Highlights = false; - Locked = false; - Pocket = false; - Search = true; - Snippets = false; - SponsoredPocket = false; - SponsoredTopSites = false; - TopSites = false; - }; - - FirefoxSuggest = { - ImproveSuggest = false; - Locked = false; - SponsoredSuggestions = false; - WebSuggestions = false; - }; - - HardwareAcceleration = true; - - Homepage = { - Locked = false; - StartPage = "previous-session"; - }; - - NewTabPage = false; - NoDefaultBookmarks = true; - OfferToSaveLoginsDefault = false; - OverrideFirstRunPage = ""; - OverridePostUpdatePage = ""; - - PDFjs = { - Enabled = true; - EnablePermissions = false; - }; - - Preferences = { - "browser.aboutConfig.showWarning" = false; - "browser.bookmarks.addedImportButton" = false; - "datareporting.healthreport.uploadEnabled" = false; - "datareporting.policy.dataSubmissionPolicyAccepted" = true; - "datareporting.policy.firstRunURL" = ""; - "dom.security.https_only_mode" = true; - "extensions.autoDisableScopes" = 0; - }; - - UserMessaging = { - ExtensionRecommendations = false; - FeatureRecommendations = false; - MoreFromMozilla = false; - SkipOnboarding = true; - }; - - UseSystemPrintDialog = true; - }; + # nativeMessagingHosts = lib.optionals (config.alyraffauf.apps.keepassxc.enable) [pkgs.keepassxc]; }; }; } diff --git a/homes/aly.nix b/homes/aly.nix index bcf9b9c7..a70eee34 100644 --- a/homes/aly.nix +++ b/homes/aly.nix @@ -38,6 +38,7 @@ home-manager.enable = true; firefox = { + enable = true; profiles.work = { id = 1; @@ -63,9 +64,12 @@ profiles.default = { extensions = with pkgs.nur.repos.rycee.firefox-addons; [ augmented-steam + decentraleyes + keepassxc-browser omnivore sidebery sponsorblock + ublock-origin zoom-redirector ]; @@ -75,7 +79,7 @@ default = "DuckDuckGo"; force = true; engines = { - "Nix Packages" = { + "nixpkgs" = { urls = [ { template = "https://search.nixos.org/packages"; @@ -122,64 +126,64 @@ "privacy.trackingprotection.socialtracking.enabled" = true; "services.sync.prefs.sync.browser.uiCustomization.state" = true; - "browser.uiCustomization.state" = '' - { - "placements": { - "widget-overflow-fixed-list": [], - "unified-extensions-area": [ - "ublock0_raymondhill_net-browser-action", - "sponsorblocker_ajay_app-browser-action", - "_019b606a-6f61-4d01-af2a-cea528f606da_-browser-action", - "jid1-bofifl9vbdl2zq_jetpack-browser-action" - ], - "nav-bar": [ - "back-button", - "forward-button", - "stop-reload-button", - "customizableui-special-spring1", - "urlbar-container", - "customizableui-special-spring2", - "downloads-button", - "save-extension_omnivore_app-browser-action", - "keepassxc-browser_keepassxc_org-browser-action", - "_3c078156-979c-498b-8990-85f7987dd929_-browser-action", - "unified-extensions-button", - "fxa-toolbar-menu-button" - ], - "toolbar-menubar": [ - "menubar-items" - ], - "TabsToolbar": [ - "firefox-view-button", - "tabbrowser-tabs", - "new-tab-button", - "alltabs-button" - ], - "PersonalToolbar": [ - "personal-bookmarks" - ] - }, - "seen": [ - "save-extension_omnivore_app-browser-action", - "_019b606a-6f61-4d01-af2a-cea528f606da_-browser-action", - "sponsorblocker_ajay_app-browser-action", - "developer-button", - "keepassxc-browser_keepassxc_org-browser-action", - "ublock0_raymondhill_net-browser-action", - "jid1-bofifl9vbdl2zq_jetpack-browser-action", - "_3c078156-979c-498b-8990-85f7987dd929_-browser-action" - ], - "dirtyAreaCache": [ - "unified-extensions-area", - "nav-bar", - "toolbar-menubar", - "TabsToolbar", - "PersonalToolbar" - ], - "currentVersion": 20, - "newElementCount": 4 - } - ''; + # "browser.uiCustomization.state" = '' + # { + # "placements": { + # "widget-overflow-fixed-list": [], + # "unified-extensions-area": [ + # "ublock0_raymondhill_net-browser-action", + # "sponsorblocker_ajay_app-browser-action", + # "_019b606a-6f61-4d01-af2a-cea528f606da_-browser-action", + # "jid1-bofifl9vbdl2zq_jetpack-browser-action" + # ], + # "nav-bar": [ + # "back-button", + # "forward-button", + # "stop-reload-button", + # "customizableui-special-spring1", + # "urlbar-container", + # "customizableui-special-spring2", + # "downloads-button", + # "save-extension_omnivore_app-browser-action", + # "keepassxc-browser_keepassxc_org-browser-action", + # "_3c078156-979c-498b-8990-85f7987dd929_-browser-action", + # "unified-extensions-button", + # "fxa-toolbar-menu-button" + # ], + # "toolbar-menubar": [ + # "menubar-items" + # ], + # "TabsToolbar": [ + # "firefox-view-button", + # "tabbrowser-tabs", + # "new-tab-button", + # "alltabs-button" + # ], + # "PersonalToolbar": [ + # "personal-bookmarks" + # ] + # }, + # "seen": [ + # "save-extension_omnivore_app-browser-action", + # "_019b606a-6f61-4d01-af2a-cea528f606da_-browser-action", + # "sponsorblocker_ajay_app-browser-action", + # "developer-button", + # "keepassxc-browser_keepassxc_org-browser-action", + # "ublock0_raymondhill_net-browser-action", + # "jid1-bofifl9vbdl2zq_jetpack-browser-action", + # "_3c078156-979c-498b-8990-85f7987dd929_-browser-action" + # ], + # "dirtyAreaCache": [ + # "unified-extensions-area", + # "nav-bar", + # "toolbar-menubar", + # "TabsToolbar", + # "PersonalToolbar" + # ], + # "currentVersion": 20, + # "newElementCount": 4 + # } + # ''; }; }; }; diff --git a/homes/dustin.nix b/homes/dustin.nix index 1e2ac31e..4efe20e4 100644 --- a/homes/dustin.nix +++ b/homes/dustin.nix @@ -42,7 +42,7 @@ }; desktop = { hyprland = { - randomWallpaper = false; + randomWallpaper = true; }; }; theme = { diff --git a/nixosModules/apps/default.nix b/nixosModules/apps/default.nix index 4de03f32..23b15d44 100644 --- a/nixosModules/apps/default.nix +++ b/nixosModules/apps/default.nix @@ -4,5 +4,5 @@ config, ... }: { - imports = [./nicotine-plus ./steam ./podman ./virt-manager]; + imports = [./firefox ./nicotine-plus ./steam ./podman ./virt-manager]; } diff --git a/nixosModules/apps/firefox/default.nix b/nixosModules/apps/firefox/default.nix new file mode 100644 index 00000000..d77ba745 --- /dev/null +++ b/nixosModules/apps/firefox/default.nix @@ -0,0 +1,108 @@ +{ + config, + lib, + pkgs, + ... +}: { + config = lib.mkIf config.alyraffauf.apps.firefox.enable { + programs.firefox = { + enable = true; + policies = { + Cookies.Behavior = "reject-foreign"; + DisableAppUpdate = true; + DisableFirefoxStudies = true; + DisableMasterPasswordCreation = true; + DisablePocket = true; + DisableProfileImport = true; + DisableSetDesktopBackground = true; + DisableTelemetry = true; + DisplayBookmarksToolbar = "newtab"; + + DNSOverHTTPS = { + Enabled = true; + Fallback = true; + }; + + DontCheckDefaultBrowser = true; + + EnableTrackingProtection = { + Cryptomining = true; + Fingerprinting = true; + EmailTracking = true; + Locked = false; + Value = true; + }; + + EncryptedMediaExtensions = { + Enabled = true; + Locked = false; + }; + + ExtensionSettings = { + "uBlock0@raymondhill.net" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + installation_mode = "normal_installed"; + }; + "jid1-BoFifL9Vbdl2zQ@jetpack" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/decentraleyes/latest.xpi"; + installation_mode = "normal_installed"; + }; + }; + + FirefoxHome = { + Highlights = false; + Locked = false; + Pocket = false; + Search = true; + Snippets = false; + SponsoredPocket = false; + SponsoredTopSites = false; + TopSites = false; + }; + + FirefoxSuggest = { + ImproveSuggest = false; + Locked = false; + SponsoredSuggestions = false; + WebSuggestions = false; + }; + + HardwareAcceleration = true; + + Homepage = { + Locked = false; + StartPage = "previous-session"; + }; + + NewTabPage = false; + NoDefaultBookmarks = true; + OfferToSaveLoginsDefault = false; + OverrideFirstRunPage = ""; + OverridePostUpdatePage = ""; + + PDFjs = { + Enabled = true; + EnablePermissions = false; + }; + + Preferences = { + "browser.aboutConfig.showWarning" = false; + "browser.bookmarks.addedImportButton" = false; + "datareporting.healthreport.uploadEnabled" = false; + "datareporting.policy.dataSubmissionPolicyAccepted" = true; + "dom.security.https_only_mode" = true; + "extensions.autoDisableScopes" = 0; + }; + + UserMessaging = { + ExtensionRecommendations = false; + FeatureRecommendations = false; + MoreFromMozilla = false; + SkipOnboarding = true; + }; + + UseSystemPrintDialog = true; + }; + }; + }; +} diff --git a/nixosModules/options.nix b/nixosModules/options.nix index d5829e66..60c0cf5a 100644 --- a/nixosModules/options.nix +++ b/nixosModules/options.nix @@ -9,6 +9,11 @@ options = { alyraffauf = { apps = { + firefox.enable = lib.mkOption { + description = "Firefox Web Browser."; + default = config.alyraffauf.desktop.enable; + type = lib.types.bool; + }; nicotine-plus.enable = lib.mkEnableOption "Nicotine+ Soulseek client."; podman.enable =