Skip to content

Commit

Permalink
firefox: move policies to nixos config
Browse files Browse the repository at this point in the history
  • Loading branch information
alyraffauf committed Jun 24, 2024
1 parent 89cfaae commit ab64b44
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 166 deletions.
106 changes: 1 addition & 105 deletions homeManagerModules/apps/firefox/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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];
};
};
}
122 changes: 63 additions & 59 deletions homes/aly.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
home-manager.enable = true;

firefox = {
enable = true;
profiles.work = {
id = 1;

Expand All @@ -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
];

Expand All @@ -75,7 +79,7 @@
default = "DuckDuckGo";
force = true;
engines = {
"Nix Packages" = {
"nixpkgs" = {
urls = [
{
template = "https://search.nixos.org/packages";
Expand Down Expand Up @@ -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
# }
# '';
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion homes/dustin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
};
desktop = {
hyprland = {
randomWallpaper = false;
randomWallpaper = true;
};
};
theme = {
Expand Down
2 changes: 1 addition & 1 deletion nixosModules/apps/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
config,
...
}: {
imports = [./nicotine-plus ./steam ./podman ./virt-manager];
imports = [./firefox ./nicotine-plus ./steam ./podman ./virt-manager];
}
108 changes: 108 additions & 0 deletions nixosModules/apps/firefox/default.nix
Original file line number Diff line number Diff line change
@@ -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;
};
};
};
}
Loading

0 comments on commit ab64b44

Please sign in to comment.