diff options
author | tilpner | 2020-06-15 09:53:06 +0200 |
---|---|---|
committer | tilpner | 2020-06-15 09:53:06 +0200 |
commit | 367b0c114f38d5c332f5ee971ad13dd69e302dec (patch) | |
tree | ec0c5ee3e7e1f0a30517599e51bd0c8172635158 /default.nix | |
parent | 2992d92e6ce0d7c96ccded0747d8815d8cfed956 (diff) | |
download | firefox-profiles-367b0c114f38d5c332f5ee971ad13dd69e302dec.tar.gz firefox-profiles-367b0c114f38d5c332f5ee971ad13dd69e302dec.tar.xz firefox-profiles-367b0c114f38d5c332f5ee971ad13dd69e302dec.zip |
WIP towards module based configuration
Diffstat (limited to 'default.nix')
-rw-r--r-- | default.nix | 120 |
1 files changed, 21 insertions, 99 deletions
diff --git a/default.nix b/default.nix index 57c27c5..fa5420e 100644 --- a/default.nix +++ b/default.nix @@ -1,111 +1,33 @@ -{ pkgs ? import <nixpkgs> {} }: - -with pkgs; - -# Where to find documentation: -# http://kb.mozillazine.org/About:config_entries -# https://www.privacy-handbuch.de/download/moderat/user.js -# https://github.com/mozilla/policy-templates, about:policies#documentation +{ configuration ? import ./firefox-configuration.nix }: let - directory = callPackage nix/directory.nix {}; - ffLib = callPackage nix/lib.nix {}; - search = callPackage nix/search.nix {}; - - callProfile = p: lib.callPackageWith (pkgs // { - inherit ffLib; - }) p {}; -in rec { - profiles = directory.listDirectory callProfile ./profiles; - - disableErrorReporting.preferences = { - breakpad.reportUrl = ""; + pkgs = import (builtins.fetchTarball { + # 2020-06-15 nixos-unstable, pinned to make sure this project still works without maintenance + url = "https://github.com/NixOS/nixpkgs/archive/0a146054bdf6f70f66de4426f84c9358521be31e.tar.gz"; + sha256 = "154ypjfhy9qqa0ww6xi7d8280h85kffqaqf6b6idymizga9ckjcd"; + }) { + config = {}; + overlays = []; }; - activeProfiles = with profiles; [ - defaults - - addons.disableExtensionSignatureChecking - addons.privacybadger - addons.noscriptFork - addons.qwantjuniorSystem - - minimalConnections - minimalHome - noAccounts - noClutter - noMedia - noNormandy - noUpdates - noStudies - noPocket - noTunnels - noLocation - safebrowsing.disableAll - trackingprotection.disableAll - - replaceAllUrls - # restrict - # distrustUser - - ocsp.disabled + ff = pkgs.callPackage nix/lib.nix {}; - forgetActivity - - { policies.RequestedLocales = [ "de-DE" "en-US" ]; } - ]; - - config = ffLib.mergeProfiles activeProfiles; - bundleConfig = { - inherit (config) policies; - preferences = ffLib.flattenAttrs config.preferences; + eval = ff.eval configuration; +in rec { + inherit (eval) options config; + inherit (eval.config) policies preferences; - # This is very hacky, but Firefox really resists setting the default search engine - # by any other means. Only builtin search engines are allowed to make themselves default - # without prompting for user consent. - patchOmniJaCommand = - let searchEnginesInfo = { - default = { - searchDefault = "qwantjunior"; - searchOrder = [ "qwantjunior" "ddg" ]; - visibleDefaultEngines = [ "qwantjunior" "ddg" ]; - }; - regionOverrides = {}; - locales = {}; - }; - in '' - pushd chrome/browser/search-extensions - cp -r ${profiles/addons/qwantjunior} ./qwantjunior - cp ${builtins.toFile "list.json" (builtins.toJSON searchEnginesInfo)} list.json - popd - ''; + bundle = ff.bundle { + inherit policies preferences; + patchOmniJaCommand = config.omnija.browser.patchCommand; }; - bundle = ffLib.bundle bundleConfig; - launcher = ffLib.launcher bundle; + launcher = ff.launcher bundle; - export = ffLib.export { - inherit (bundleConfig) policies preferences; + export = ff.export { + inherit policies preferences; + # feel free to change this selfPath = "/opt/firefox"; }; - -/* - bundle = profiles.bundle { - policies = { - Preferences = profiles.flattenAttrs { - dom.event.contextmenu.enabled = false; - - extensions = { - blocklist.enabled = false; - getAddons.showPane = false; - htmlaboutaddons.recommendations.enabled = false; - }; - - security.ssl.errorReporting.enabled = false; - }; - - SearchBar = "separate"; - }; - }; - */ + manual = ff.docs options; } |