use home-manager's own chromium extension support

This commit is contained in:
notgne2 2021-06-27 23:36:37 -07:00
parent 1da2d8a098
commit c7255a4a26
No known key found for this signature in database
GPG Key ID: BB661E172B42A7F8
3 changed files with 25 additions and 130 deletions

View File

@ -8,7 +8,6 @@ inputs:
(lib.mkAliasOptionModule [ "ezpcusr" "waybarCss" ] [ "programs" "waybar" "style" ]) (lib.mkAliasOptionModule [ "ezpcusr" "waybarCss" ] [ "programs" "waybar" "style" ])
./ezpcusr.nix ./ezpcusr.nix
./ezchromium.nix
./ezcodium.nix ./ezcodium.nix
(import ./colors.nix inputs) (import ./colors.nix inputs)
./fonts.nix ./fonts.nix

View File

@ -1,128 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.ez.chromium;
in
{
options.ez.chromium = {
enable = mkEnableOption "Enable simple Chromium config";
extensions = mkOption {
description = "List of extensions to be automatically installed";
type = types.listOf (types.submodule {
options = {
id = mkOption {
description = "ID of the extension on the store";
type = types.str;
};
hash = mkOption {
description = "Hash of the extension file";
type = types.nullOr types.str;
default = null;
};
name = mkOption {
description = "Name of the extension (in path form)";
type = types.str;
};
url = mkOption {
description = "URL of the extension if not on the chrome store";
type = types.nullOr types.str;
default = null;
};
};
}
);
};
};
config = mkIf cfg.enable {
programs.chromium = {
enable = true;
package = pkgs.ungoogled-chromium.override {
commandLineArgs = "--enable-features=VaapiVideoDecoder";
};
};
home.file =
let
splitVersion = builtins.splitVersion pkgs.ungoogled-chromium.version;
basicVersion = "${elemAt splitVersion 0}.${elemAt splitVersion 1}";
extensionJson = ext: {
name = "${config.xdg.configHome}/chromium/External Extensions/${ext.id}.json";
value.text = builtins.toJSON (({
external_version = "0.420.69";
}) // (if ext.hash == null then {
external_update_url = "https://clients2.google.com/service/update2/crx";
} else {
external_crx = builtins.fetchurl {
name = "${ext.name}";
url = if ext.url != null then ext.url else "https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&prodversion=${basicVersion}&x=id%3D${ext.id}%26installsource%3Dondemand%26uc";
sha256 = ext.hash;
};
}));
};
in
listToAttrs (map extensionJson cfg.extensions);
ez.chromium.extensions = [
{
id = "plfoiobmoplmhebmdiofljgnbekcdjan";
hash = "1ml5f3nc6g07idvj85yk2bgkqpgbgd1a78g2zb0vqrmv211vqnzb";
name = "ruffle";
url = "https://github.com/ruffle-rs/ruffle/releases/download/nightly-2021-02-21/ruffle_nightly_2021_02_21_extension.zip";
}
{
id = "cjpalhdlnbpafiamejdnhcphjbkeiagm";
# hash = "0klh5js0bpf21fqasx56kqipsv6dj29fz1jxjl49pwzk16bz8p1v";
name = "ublock-origin";
}
{
id = "eimadpbcbfnmbkopoojfekhnkhdbieeh";
# hash = "085ysd0xxp1dpw6q4cngplnj51m1l1k3xkbf433hxrpaxlm0vafr";
name = "dark-reader";
}
{
id = "nngceckbapebfimnlniiiahkandclblb";
# hash = "0gi23wy5a1l22hbln4mfvwa6f6c0cbzbaj9nvv8fkv97d1m5nlca";
name = "bitwarden";
}
{
url = "https://github.com/NeverDecaf/chromium-web-store/releases/download/v1.2.3/Chromium.Web.Store.crx";
id = "ocaahdebbfolfmndjeplogmgcagdmblk";
hash = "1v1c8q43y2gmsygacvri0cshfjgybxsasaf0c7cxwgnsx2kf98xh";
name = "chromium-web-store";
}
{
id = "lanfdkkpgfjfdikkncbnojekcppdebfp";
# hash = "02dhazdxl1jm6nx8dkxk9dc0l0kqyfypj3sl1vmic1sqgib0nb5v";
name = "canvas-fingerprint-defend";
}
{
id = "fhkphphbadjkepgfljndicmgdlndmoke";
# hash = "05yf2677s2scr3w8f6x93gv83cssy62h4v18gc2yigpgr2y3df7g";
name = "font-fingerprint-defend";
}
{
id = "olnbjpaejebpnokblkepbphhembdicik";
# hash = "088gc2is92nkn5yrjc65657w0vvkkhks371c92ndz6w5mrc39xmw";
name = "webgl-fingerprint-defend";
}
{
id = "pcbjiidheaempljdefbdplebgdgpjcbe";
# hash = "06rirbbp037yd6d3xsrc383k0n2y5rh7j69zax6mpzjx3zyvzkmn";
name = "audio-fingerprint-defend";
}
# {
# id = "npeicpdbkakmehahjeeohfdhnlpdklia";
# hash = "1sfwfa28lrkq3df3r1645vy1qih9qc8x764bc5x2i2hrmg2vb8wp";
# name = "webrtc-network-limiter";
# }
{
id = "dhdgffkkebhmkfjojejmpbldmpobfkfo";
# hash = "06acbcwwp3l9c6d178rq6my2pspl9gvqgp8l81al8pbbmwkfyjqv";
name = "tampermonkey";
}
];
};
}

View File

@ -416,7 +416,31 @@ let
fonts.enable = true; fonts.enable = true;
ez.codium.enable = true; ez.codium.enable = true;
ez.chromium.enable = true;
programs.chromium = {
enable = true;
package = pkgs.ungoogled-chromium;
extensions = [
{ id = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; } # ublock origin
{ id = "eimadpbcbfnmbkopoojfekhnkhdbieeh"; } # dark reader
{ id = "nngceckbapebfimnlniiiahkandclblb"; } # bitwarden
{
# chromium web store
id = "ocaahdebbfolfmndjeplogmgcagdmblk";
crxPath = builtins.fetchurl {
name = "chromium-web-store.crx";
url = "https://github.com/NeverDecaf/chromium-web-store/releases/download/v1.4.0/Chromium.Web.Store.crx";
sha256 = "1bfzd02a9krkapkbj51kxfp4a1q5x2m2pz5kv98ywfcarbivskgs";
};
version = "1.4.0";
}
{ id = "lanfdkkpgfjfdikkncbnojekcppdebfp"; } # canvas fingerprint defend
{ id = "fhkphphbadjkepgfljndicmgdlndmoke"; } # font fingerprint defend
{ id = "olnbjpaejebpnokblkepbphhembdicik"; } # webgl fingerprint defend
{ id = "pcbjiidheaempljdefbdplebgdgpjcbe"; } # audio fingerprint defend
{ id = "dhdgffkkebhmkfjojejmpbldmpobfkfo"; } # tampermonkey
];
};
services.lorri.enable = true; services.lorri.enable = true;