From 0121b7a6368520f5fa8e06388bd9bbe27daeddc6 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 6 Jun 2024 18:53:22 +0100 Subject: [PATCH] added nur as overlay & refactored firefox --- flake.lock | 76 +++++++----- flake.nix | 3 + .../optional/desktop/common/default.nix | 6 +- .../optional/desktop/common/firefox.nix | 114 +++++++----------- hosts/common/core/default.nix | 33 ++--- 5 files changed, 115 insertions(+), 117 deletions(-) diff --git a/flake.lock b/flake.lock index b32a886..848c7a8 100644 --- a/flake.lock +++ b/flake.lock @@ -25,11 +25,11 @@ ] }, "locked": { - "lastModified": 1713532798, - "narHash": "sha256-wtBhsdMJA3Wa32Wtm1eeo84GejtI43pMrFrmwLXrsEc=", + "lastModified": 1717408969, + "narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=", "owner": "numtide", "repo": "devshell", - "rev": "12e914740a25ea1891ec619bb53cf5e6ca922e40", + "rev": "1ebbe68d57457c8cae98145410b164b5477761f4", "type": "github" }, "original": { @@ -45,11 +45,11 @@ ] }, "locked": { - "lastModified": 1717574802, - "narHash": "sha256-TprJdvfwdjj3co7CGZ4jPIlAdZPFwYrQjamvt2B2L4g=", + "lastModified": 1717637172, + "narHash": "sha256-geTO9YL1V9zYGxupuZvKFWxh6II9sH2bjI1dmEVhVYQ=", "owner": "nix-community", "repo": "disko", - "rev": "7fc7009c892509b9bf81cb73c6575f3f9e6321f5", + "rev": "713aa3df481782719aed4d8c20ad31a9effe3564", "type": "github" }, "original": { @@ -96,11 +96,11 @@ ] }, "locked": { - "lastModified": 1715865404, - "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", "type": "github" }, "original": { @@ -177,11 +177,11 @@ ] }, "locked": { - "lastModified": 1716213921, - "narHash": "sha256-xrsYFST8ij4QWaV6HEokCUNIZLjjLP1bYC60K8XiBVA=", + "lastModified": 1717664902, + "narHash": "sha256-7XfBuLULizXjXfBYy/VV+SpYMHreNRHk9nKMsm1bgb4=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "0e8fcc54b842ad8428c9e705cb5994eaf05c26a0", + "rev": "cc4d466cb1254af050ff7bdf47f6d404a7c646d1", "type": "github" }, "original": { @@ -240,11 +240,11 @@ ] }, "locked": { - "lastModified": 1717052710, - "narHash": "sha256-LRhOxzXmOza5SymhOgnEzA8EAQp+94kkeUYWKKpLJ/U=", + "lastModified": 1717525419, + "narHash": "sha256-5z2422pzWnPXHgq2ms8lcCfttM0dz+hg+x1pCcNkAws=", "owner": "nix-community", "repo": "home-manager", - "rev": "29c69d9a466e41d46fd3a7a9d0591ef9c113c2ae", + "rev": "a7117efb3725e6197dd95424136f79147aa35e5b", "type": "github" }, "original": { @@ -391,11 +391,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1717196966, - "narHash": "sha256-yZKhxVIKd2lsbOqYd5iDoUIwsRZFqE87smE2Vzf6Ck0=", + "lastModified": 1717602782, + "narHash": "sha256-pL9jeus5QpX5R+9rsp3hhZ+uplVHscNJh8n8VpqscM0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "57610d2f8f0937f39dbd72251e9614b1561942d8", + "rev": "e8057b67ebf307f01bdcc8fba94d94f75039d1f6", "type": "github" }, "original": { @@ -407,11 +407,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1717503908, - "narHash": "sha256-hsxbTeO6Dhobc2kELDwCgRJT9J5TotL6fS8z5P+OskI=", + "lastModified": 1717653235, + "narHash": "sha256-wODpVx0FtLHnyKIOnm4V7fE9P8Pg12u/8ytY++VYMK0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "50a127f8fccd0d24712c8ab146ca251f27cc4cb0", + "rev": "844ccd07fb2aa17250952aee34a6fefd914b4638", "type": "github" }, "original": { @@ -435,11 +435,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1717574948, - "narHash": "sha256-8C2S1WWC4ty1LePzFWp+D6re/pggCJj9tWslddJ/wUw=", + "lastModified": 1717681257, + "narHash": "sha256-0PhFvfc4wDjba1cus2ALsfn0wVizeKkcuF+aqvDJivg=", "owner": "nix-community", "repo": "nixvim", - "rev": "a54ee8ad64c91b587c3460126bad25a441c1118c", + "rev": "36f2e51b28ee3389a67ed5e9ed5c4bd388b06918", "type": "github" }, "original": { @@ -448,6 +448,21 @@ "type": "github" } }, + "nur": { + "locked": { + "lastModified": 1717691888, + "narHash": "sha256-YbIJbbPrKWhjM+ZvPelG/iDfSU3/qwPOI3vAIi+lFYI=", + "owner": "nix-community", + "repo": "NUR", + "rev": "4266b44cd241e3d2baf38bdbe8ce1254defcee6f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, "poetry2nix": { "inputs": { "flake-utils": "flake-utils_3", @@ -460,11 +475,11 @@ "treefmt-nix": "treefmt-nix_2" }, "locked": { - "lastModified": 1717250109, - "narHash": "sha256-MTivB5fsfaPtWwcibBhs20hHYEUe9o9bTRXsGJjQRso=", + "lastModified": 1717602370, + "narHash": "sha256-qS/7is9JbnnycR6QmndsuTQfifWzjhgxObnXw+iHdP8=", "owner": "nix-community", "repo": "poetry2nix", - "rev": "11e97e742da5b4e43c27cfe13fca904e82fd4e56", + "rev": "81662ae1ad31491eae3bb1d976fb74c71853bc63", "type": "github" }, "original": { @@ -483,6 +498,7 @@ "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable", "nixvim": "nixvim", + "nur": "nur", "sops-nix": "sops-nix", "sqlfmt": "sqlfmt" } @@ -597,11 +613,11 @@ ] }, "locked": { - "lastModified": 1715940852, - "narHash": "sha256-wJqHMg/K6X3JGAE9YLM0LsuKrKb4XiBeVaoeMNlReZg=", + "lastModified": 1717278143, + "narHash": "sha256-u10aDdYrpiGOLoxzY/mJ9llST9yO8Q7K/UlROoNxzDw=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "2fba33a182602b9d49f0b2440513e5ee091d838b", + "rev": "3eb96ca1ae9edf792a8e0963cc92fddfa5a87706", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e528699..e5bfa0c 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,9 @@ # Nixpkgs nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + # NUR + nur.url = "github:nix-community/NUR"; + # Import personal packages repo sqlfmt.url = "git+https://git.bitlab21.com/sam/flake-packages?dir=sqlfmt"; diff --git a/home/common/optional/desktop/common/default.nix b/home/common/optional/desktop/common/default.nix index 15bf3dc..d507708 100644 --- a/home/common/optional/desktop/common/default.nix +++ b/home/common/optional/desktop/common/default.nix @@ -1,9 +1,13 @@ -{ pkgs, ... }: { +{ pkgs, inputs, ... }: { imports = [ ./firefox.nix ./alacritty.nix ]; + nixpkgs.overlays = [ + inputs.nur.overlay + ]; + # Global packages for desktop environments home.packages = [ pkgs.alacritty diff --git a/home/common/optional/desktop/common/firefox.nix b/home/common/optional/desktop/common/firefox.nix index 5d58021..df8a275 100644 --- a/home/common/optional/desktop/common/firefox.nix +++ b/home/common/optional/desktop/common/firefox.nix @@ -1,82 +1,43 @@ -{ pkgs, inputs, config, ... }: +{ pkgs, config, ... }: let user = config.home.username; in { programs.firefox = { enable = true; - policies = { - DisableTelemetry = true; - DisableFirefoxStudies = true; - EnableTrackingProtection = { - Value= true; - Locked = true; - Cryptomining = true; - Fingerprinting = true; - }; - DisablePocket = true; - DisableFirefoxAccounts = true; - DisableAccounts = true; - DisableFirefoxScreenshots = true; - OverrideFirstRunPage = ""; - OverridePostUpdatePage = ""; - DontCheckDefaultBrowser = true; - DisplayBookmarksToolbar = "never"; # alternatives: "always" or "newtab" - DisplayMenuBar = "default-off"; # alternatives: "always", "never" or "default-on" - SearchBar = "unified"; # alternative: "separate" - SearchEngines = { - Default = "DuckDuckGo"; - PreventInstalls = true; - }; - /* ---- EXTENSIONS ---- */ - # Check about:support for extension/add-on ID strings. - # Valid strings for installation_mode are "allowed", "blocked", - # "force_installed" and "normal_installed". - ExtensionSettings = { - "*".installation_mode = "blocked"; # blocks all addons except the ones specified below - # uBlock Origin: - "uBlock0@raymondhill.net" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; - installation_mode = "force_installed"; - }; - # Privacy Badger: - "jid1-MnnxcxisBPnSXQ@jetpack" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17/latest.xpi"; - installation_mode = "force_installed"; - }; - # Bitwarden - "{446900e4-71c2-419f-a6a7-df9c091e268b}" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi"; - installation_mode = "force_installed"; - }; - # Dark Reader - "addon@darkreader.org" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi"; - installation_mode = "force_installed"; - }; - # Sponser Block - "sponsorBlocker@ajay.app" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi"; - installation_mode = "force_installed"; - }; - # Return Youtube Dislike - "{762f9885-5a13-4abd-9c77-433dcd38b8fd}" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/return-youtube-dislikes/latest.xpi"; - installation_mode = "force_installed"; - }; - }; - }; profiles.${user} = { - - search.engines = { - "Searxng" = { - urls = [{ - template = "http://10.0.10.35:8855"; - }]; - + search = { + force = true; + default = "Searx"; + order = [ "Searx" "DuckDuckGo" ]; + engines = { + "Nix Packages" = { + urls = [{ + template = "https://search.nixos.org/packages"; + params = [ + { name = "type"; value = "packages"; } + { name = "query"; value = "{searchTerms}"; } + ]; + }]; + icon = "''${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@np" ]; + }; + "NixOS Wiki" = { + urls = [{ template = "https://nixos.wiki/index.php?search={searchTerms}"; }]; + iconUpdateURL = "https://nixos.wiki/favicon.png"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = [ "@nw" ]; + }; + "Searx" = { + urls = [{ template = "http://10.0.10.35:8855/?q={searchTerms}"; }]; + iconUpdateURL = "https://docs.searxng.org/_static/searxng-wordmark.svg"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = [ "@searx" ]; + }; + "Bing".metaData.hidden = true; + "Google".metaData.alias = "@g"; # builtin engines only support specifying one additional alias }; }; - search.force = true; bookmarks = [ { @@ -99,8 +60,21 @@ in "identity.fxaccounts.enabled" = false; "signon.rememberSignons" = false; "browser.compactmode.show" = true; + "browser.startup.homepage" = "http://10.0.10.35:8855"; + "browser.search.defaultenginename" = "Searx"; + "browser.search.order.1" = "Searx"; }; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + return-youtube-dislikes + bitwarden + sponsorblock + darkreader + vimium + privacy-badger + ]; + }; }; } diff --git a/hosts/common/core/default.nix b/hosts/common/core/default.nix index 7b62e43..1cfd3a6 100644 --- a/hosts/common/core/default.nix +++ b/hosts/common/core/default.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, inputs, config, outputs, ...}: +{ pkgs, lib, inputs, config, outputs, ... }: let sopsHashedPasswordFile = lib.optionalString (lib.hasAttr "sops-nix" inputs) config.sops.secrets."passwords/root".path; in @@ -9,15 +9,16 @@ in ]; nixpkgs = { - overlays = [ - outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.unstable-packages - ]; - config = { - allowUnfree = true; - }; + overlays = [ + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + inputs.nur.overlay + ]; + config = { + allowUnfree = true; }; + }; programs.gnupg.agent = { enable = true; @@ -32,16 +33,16 @@ in root = { hashedPasswordFile = sopsHashedPasswordFile; }; - }; + }; }; environment.systemPackages = [ - pkgs.rsync - pkgs.curl - pkgs.just - pkgs.git - pkgs.vim - ]; + pkgs.rsync + pkgs.curl + pkgs.just + pkgs.git + pkgs.vim + ]; system.stateVersion = "23.11"; }