From 1a86120babab1bbf135821aa4469ee95188656d3 Mon Sep 17 00:00:00 2001 From: nixos Date: Sun, 10 Sep 2023 14:17:39 +0200 Subject: [PATCH] add custom firefox addon derivations --- README.md | 9 ----- configuration.nix | 4 +- firefox-addons/addons.json | 12 ++++++ firefox-addons/default.nix | 22 ++++++++++ firefox-addons/derivations.nix | 74 ++++++++++++++++++++++++++++++++++ home.nix | 17 +------- 6 files changed, 112 insertions(+), 26 deletions(-) create mode 100644 firefox-addons/addons.json create mode 100644 firefox-addons/default.nix create mode 100644 firefox-addons/derivations.nix diff --git a/README.md b/README.md index 7ad6269..0221c6a 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,3 @@ - neovim - nixos-rebuild without root - alacritty settings - - theme - -## Firefox extensions not available in NUR - -- bypass paywalls clean -- http version indicator -- indicate tls -- sci-hub x now -- sixindicator diff --git a/configuration.nix b/configuration.nix index 206f5bf..9660ffa 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, ... }@args: let stateVersion = "23.05"; @@ -41,7 +41,7 @@ in excludePackages = with pkgs; [ xterm ]; }; - home-manager.users.pim = import ./home.nix {inherit pkgs stateVersion; }; + home-manager.users.pim = import ./home.nix (args // { inherit stateVersion; }); users.users.pim = { isNormalUser = true; extraGroups = [ "wheel" ]; diff --git a/firefox-addons/addons.json b/firefox-addons/addons.json new file mode 100644 index 0000000..4a11eba --- /dev/null +++ b/firefox-addons/addons.json @@ -0,0 +1,12 @@ +[ + { + "slug": "sixindicator" + }, + { + "slug": "indicatetls" + }, + { + "pname": "http-version-indicator", + "slug": "http2-indicator" + } +] diff --git a/firefox-addons/default.nix b/firefox-addons/default.nix new file mode 100644 index 0000000..f11a808 --- /dev/null +++ b/firefox-addons/default.nix @@ -0,0 +1,22 @@ +{pkgs, ...}@args: +let +rycee-addons = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + clearurls + cookie-autodelete + istilldontcareaboutcookies + keepassxc-browser + redirector + ublacklist + umatrix + violentmonkey + boring-rss + bypass-paywalls-clean +]; +own-addons = with import ./derivations.nix args; [ + http-version-indicator + indicatetls + sixindicator +]; +in +rycee-addons ++ own-addons diff --git a/firefox-addons/derivations.nix b/firefox-addons/derivations.nix new file mode 100644 index 0000000..915cfc7 --- /dev/null +++ b/firefox-addons/derivations.nix @@ -0,0 +1,74 @@ +{ pkgs, lib, ... }: +let + # Stolen from: https://github.com/nix-community/nur-combined/blob/master/repos/rycee/pkgs/firefox-addons/default.nix + buildFirefoxXpiAddon = lib.makeOverridable ({ stdenv ? pkgs.stdenv, fetchurl ? pkgs.fetchurl, + pname, version, addonId, url, sha256, meta, ... }: stdenv.mkDerivation { + name = "${pname}-${version}"; + + inherit meta; + + src = fetchurl { inherit url sha256; }; + + preferLocalBuild = true; + allowSubstitutes = true; + + buildCommand = '' + dst="$out/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" + mkdir -p "$dst" + install -v -m644 "$src" "$dst/${addonId}.xpi" + ''; + }); +in + { + "http-version-indicator" = buildFirefoxXpiAddon { + pname = "http-version-indicator"; + version = "3.2.1"; + addonId = "spdyindicator@chengsun.github.com"; + url = "https://addons.mozilla.org/firefox/downloads/file/3767224/http2_indicator-3.2.1.xpi"; + sha256 = "be9518017334ce502a1da514542c2ca4f974217d0c8e6c7c31d518aba57c09a8"; + meta = with lib; + { + homepage = "https://github.com/bsiegel/http-version-indicator"; + description = "An indicator showing the HTTP version used to load the page in the address bar."; + mozPermissions = [ "" "tabs" "webNavigation" "webRequest" ]; + platforms = platforms.all; + }; + }; + "indicatetls" = buildFirefoxXpiAddon { + pname = "indicatetls"; + version = "0.3.0"; + addonId = "{252ee273-8c8d-4609-b54d-62ae345be0a1}"; + url = "https://addons.mozilla.org/firefox/downloads/file/3608595/indicatetls-0.3.0.xpi"; + sha256 = "7a3b7edb1085f7b15d279c1013fac1d68f5247cfd6312d5275cb053e24a79465"; + meta = with lib; + { + homepage = "https://github.com/jannispinter/indicatetls"; + description = "Displays negotiated SSL/TLS protocol version and additional security information in the address bar"; + license = licenses.mpl20; + mozPermissions = [ + "tabs" + "webNavigation" + "webRequest" + "webRequestBlocking" + "http://*/*" + "https://*/*" + ]; + platforms = platforms.all; + }; + }; + "sixindicator" = buildFirefoxXpiAddon { + pname = "sixindicator"; + version = "1.3.0"; + addonId = "{8c9cad02-c069-4e93-909d-d874da819c49}"; + url = "https://addons.mozilla.org/firefox/downloads/file/3493442/sixindicator-1.3.0.xpi"; + sha256 = "415ab83ed4ac94d1efe114752a09df29536d1bd54cc9b7e5ce5d9ee55a84226d"; + meta = with lib; + { + homepage = "https://github.com/HostedDinner/SixIndicator"; + description = "Shows a simple icon, if IPv6 or IPv4 was used for the request of the site. When clicking on the icon, more information is shown, like the number of requests per domain and if these requests were made via IPv6 or IPv4."; + license = licenses.mit; + mozPermissions = [ "tabs" "webRequest" "" ]; + platforms = platforms.all; + }; + }; + } diff --git a/home.nix b/home.nix index e773ca1..3d1f87b 100644 --- a/home.nix +++ b/home.nix @@ -1,5 +1,4 @@ -{ pkgs, stateVersion, ... }: - +{ pkgs, lib, stateVersion, ... }@args: { home = { username = "pim"; @@ -26,19 +25,7 @@ settings = { "browser.aboutConfig.showWarning" = false; }; - extensions = with pkgs.nur.repos.rycee.firefox-addons; [ - ublock-origin - clearurls - cookie-autodelete - istilldontcareaboutcookies - keepassxc-browser - redirector - ublacklist - umatrix - violentmonkey - boring-rss - bypass-paywalls-clean - ]; + extensions = import ./firefox-addons args; }; };