nixfiles/home-manager/modules/ezchromium.nix
2021-03-29 15:22:47 -07:00

129 lines
4.3 KiB
Nix

{ 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";
}
];
};
}