From c825a0a7fd61ad05be4584f537fc5540f20ac86d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Mon, 18 Apr 2022 12:33:07 +0200 Subject: [PATCH] :rocket: add arkenfox-userjs --- flake.lock | 93 ++++++++------------------------ flake.nix | 5 ++ modules/desktop/apps/firefox.nix | 86 ++++++++++++++++------------- 3 files changed, 76 insertions(+), 108 deletions(-) diff --git a/flake.lock b/flake.lock index ee4b1f4..7f5c5be 100644 --- a/flake.lock +++ b/flake.lock @@ -34,6 +34,22 @@ "type": "github" } }, + "arkenfox-userjs": { + "flake": false, + "locked": { + "lastModified": 1649497545, + "narHash": "sha256-ScO19N/EVpmMzdN2kkfjYIJN7c0CQdZJ9qMZReqMpI4=", + "owner": "arkenfox", + "repo": "user.js", + "rev": "4ff931781a1bf012e0e7e2ec89dc5c2a9bedd890", + "type": "github" + }, + "original": { + "owner": "arkenfox", + "repo": "user.js", + "type": "github" + } + }, "dracula-fish": { "flake": false, "locked": { @@ -102,21 +118,6 @@ "type": "github" } }, - "flake-utils_2": { - "locked": { - "lastModified": 1644229661, - "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "forgit-git": { "flake": false, "locked": { @@ -187,26 +188,6 @@ "type": "github" } }, - "nix-flake-tools": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs_3", - "npmlock2nix-repo": "npmlock2nix-repo" - }, - "locked": { - "lastModified": 1648440407, - "narHash": "sha256-CfqLEAaMKYbT4Zozv02egfAQ7eni2yqys6Nm2zszhNM=", - "owner": "rastertail", - "repo": "nix-flake-tools", - "rev": "37512db32ea23fc3f125ab70555af75ad5bb18e9", - "type": "github" - }, - "original": { - "owner": "rastertail", - "repo": "nix-flake-tools", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1638587357, @@ -238,22 +219,6 @@ } }, "nixpkgs_3": { - "locked": { - "lastModified": 1647893727, - "narHash": "sha256-pOi7VdCb+s5Cwh5CS7YEZVRgH9uCmE87J5W7iXv29Ck=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "1ec61dd4167f04be8d05c45780818826132eea0d", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_4": { "locked": { "lastModified": 1647350163, "narHash": "sha256-OcMI+PFEHTONthXuEQNddt16Ml7qGvanL3x8QOl2Aao=", @@ -269,7 +234,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_4": { "locked": { "lastModified": 1645013224, "narHash": "sha256-b7OEC8vwzJv3rsz9pwnTX2LQDkeOWz2DbKypkVvNHXc=", @@ -285,22 +250,6 @@ "type": "github" } }, - "npmlock2nix-repo": { - "flake": false, - "locked": { - "lastModified": 1647281121, - "narHash": "sha256-rYFK7a6jzbuJ3Gq9NTDQXnTYOCed6FrMNwdWYm47pQg=", - "owner": "nix-community", - "repo": "npmlock2nix", - "rev": "30ae63fe48ae066df1c135801b66f50ee3d1a0f2", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "npmlock2nix", - "type": "github" - } - }, "nur": { "locked": { "lastModified": 1648030920, @@ -320,13 +269,13 @@ "inputs": { "agenix": "agenix", "asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver", + "arkenfox-userjs": "arkenfox-userjs", "dracula-fish": "dracula-fish", "emacs-overlay": "emacs-overlay", "forgit-git": "forgit-git", "home-manager": "home-manager", "master": "master", - "nix-flake-tools": "nix-flake-tools", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_3", "nur": "nur", "stable": "stable", "statix": "statix", @@ -370,7 +319,7 @@ "inputs": { "fenix": "fenix", "gitignore": "gitignore", - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_4" }, "locked": { "lastModified": 1645337357, @@ -388,7 +337,7 @@ }, "utils": { "inputs": { - "flake-utils": "flake-utils_2" + "flake-utils": "flake-utils" }, "locked": { "lastModified": 1647259887, diff --git a/flake.nix b/flake.nix index 5ac1ce5..031f98c 100644 --- a/flake.nix +++ b/flake.nix @@ -36,6 +36,11 @@ url = "github:mohamed-badaoui/asus-touchpad-numpad-driver"; flake = false; }; + + arkenfox-userjs = { + url = "github:arkenfox/user.js"; + flake = false; + }; }; outputs = inputs@{ self, agenix, home-manager, nixpkgs, utils, ... }: diff --git a/modules/desktop/apps/firefox.nix b/modules/desktop/apps/firefox.nix index dd9007f..3c99c30 100644 --- a/modules/desktop/apps/firefox.nix +++ b/modules/desktop/apps/firefox.nix @@ -1,41 +1,55 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, inputs, ... }: +let + arkenfox = builtins.readFile (inputs.arkenfox-userjs + "/user.js"); + overrides = { + ## arkenfox overrides + # automatic search + "keyword.enabled" = true; + "browser.search.suggest.enabled" = true; + "browser.urlbar.suggest.searches" = true; -{ + # drm + "media.eme.enabled" = true; + + # sanitisation + "privacy.clearOnShutdown.history" = false; + + ## OTHER + # Dont show warning when accessing about:config + "browser.aboutConfig.showWarning" = false; + + # Hide bookmarks + "browser.toolbars.bookmarks.visibility" = "never"; + + # Smooth scrolling + "general.smoothScroll.lines.durationMaxMS" = 125; + "general.smoothScroll.lines.durationMinMS" = 125; + "general.smoothScroll.mouseWheel.durationMaxMS" = 200; + "general.smoothScroll.mouseWheel.durationMinMS" = 100; + "general.smoothScroll.msdPhysics.enabled" = true; + "general.smoothScroll.other.durationMaxMS" = 125; + "general.smoothScroll.other.durationMinMS" = 125; + "general.smoothScroll.pages.durationMaxMS" = 125; + "general.smoothScroll.pages.durationMinMS" = 125; + "mousewheel.min_line_scroll_amount" = 40; + "mousewheel.system_scroll_override_on_root_content.enabled" = true; + "mousewheel.system_scroll_override_on_root_content.horizontal.factor" = 175; + "mousewheel.system_scroll_override_on_root_content.vertical.factor" = 175; + "toolkit.scrollbox.horizontalScrollDistance" = 6; + "toolkit.scrollbox.verticalScrollDistance" = 2; + }; + + fullUserJs = '' + // Arkenfox user.js + ${arkenfox} + + // Overrides + ${lib.concatStrings (lib.mapAttrsToList (name: value: '' + user_pref("${name}", ${builtins.toJSON value}); + '') overrides)}''; +in { home-manager.users.moritz.programs.firefox = { enable = true; - profiles."default" = { - extraConfig = "\n"; - settings = { - - # Dont show warning when accessing about:config - "browser.aboutConfig.showWarning" = false; - - # Default Privacy Settings - "browser.contentblocking.category" = "strict"; - "privacy.donottrackheader.enabled" = true; - - # Hide bookmarks - "browser.toolbars.bookmarks.visibility" = "never"; - - # Smooth scrolling - "general.smoothScroll.lines.durationMaxMS" = 125; - "general.smoothScroll.lines.durationMinMS" = 125; - "general.smoothScroll.mouseWheel.durationMaxMS" = 200; - "general.smoothScroll.mouseWheel.durationMinMS" = 100; - "general.smoothScroll.msdPhysics.enabled" = true; - "general.smoothScroll.other.durationMaxMS" = 125; - "general.smoothScroll.other.durationMinMS" = 125; - "general.smoothScroll.pages.durationMaxMS" = 125; - "general.smoothScroll.pages.durationMinMS" = 125; - "mousewheel.min_line_scroll_amount" = 40; - "mousewheel.system_scroll_override_on_root_content.enabled" = true; - "mousewheel.system_scroll_override_on_root_content.horizontal.factor" = - 175; - "mousewheel.system_scroll_override_on_root_content.vertical.factor" = - 175; - "toolkit.scrollbox.horizontalScrollDistance" = 6; - "toolkit.scrollbox.verticalScrollDistance" = 2; - }; - }; + profiles."default".extraConfig = fullUserJs; }; }