Chromium: Use policies.

This commit is contained in:
Dmitry Voronin 2024-10-29 00:15:58 +03:00
parent d3618b3320
commit 3df3e1ebbf
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
4 changed files with 87 additions and 64 deletions

View file

@ -63,26 +63,27 @@
default_fixed_font_size = 14; default_fixed_font_size = 14;
default_font_size = 17; default_font_size = 17;
minimum_font_size = 16; minimum_font_size = 16;
fonts = let fonts =
mono = config.style.font.monospace.name; let
sans = config.style.font.sansSerif.name; mono = config.style.font.monospace.name;
in sans = config.style.font.sansSerif.name;
{ in
fixed.Zyyy = mono; {
sansserif.Zyyy = sans; fixed.Zyyy = mono;
serif.Zyyy = sans; sansserif.Zyyy = sans;
standard.Zyyy = sans; serif.Zyyy = sans;
}; standard.Zyyy = sans;
};
}; };
}; };
}; };
localState = (pkgs.formats.json { }).generate "ChromiumLocalState" { localState = (pkgs.formats.json { }).generate "ChromiumLocalState" {
browser = { browser = {
enabled_labs_experiments = [ enabled_labs_experiments = [ "smooth-scrolling@2" ];
"smooth-scrolling@2"
];
first_run_finished = true; first_run_finished = true;
}; };
}; };
policy = (pkgs.formats.json { }).generate "ChromiumPolicy" { URLBlocklist = [ "darkreader.org" ]; };
} }

View file

@ -2,58 +2,70 @@
let let
package = pkgs.ungoogled-chromium; package = pkgs.ungoogled-chromium;
browserVersion = lib.versions.major package.version; browserVersion = lib.versions.major package.version;
extensions = let extensions =
fetchFromStore = { id, sha256, version }: let
{ fetchFromStore =
inherit id version; {
crxPath = pkgs.fetchurl { id,
inherit sha256; sha256,
url = "https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&prodversion=${browserVersion}&x=id%3D${id}%26installsource%3Dondemand%26uc"; version,
name = "${id}.crx"; }:
{
inherit id version;
crxPath = pkgs.fetchurl {
inherit sha256;
url = "https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&prodversion=${browserVersion}&x=id%3D${id}%26installsource%3Dondemand%26uc";
name = "${id}.crx";
};
}; };
}; fetchFromUrl =
fetchFromUrl = { id, url, sha256, version }: {
{ id,
inherit id version; url,
crxPath = pkgs.fetchurl { sha256,
inherit sha256 url; version,
name = "${id}.crx"; }:
{
inherit id version;
crxPath = pkgs.fetchurl {
inherit sha256 url;
name = "${id}.crx";
};
}; };
}; in
in [
[ (fetchFromStore {
(fetchFromStore { # uBlock Origin dev.
# uBlock Origin dev. id = "cgbcahbpdhpcegmbfconppldiemgcoii";
id = "cgbcahbpdhpcegmbfconppldiemgcoii"; sha256 = "sha256-sTE96l7/B3n4rJHYC0p4hCVmXUMYj/6O6+596DFIK58=";
sha256 = "sha256-sTE96l7/B3n4rJHYC0p4hCVmXUMYj/6O6+596DFIK58="; version = "1.60.1.16";
version = "1.60.1.16"; })
}) (fetchFromStore {
(fetchFromStore { # Dark reader.
# Dark reader. id = "eimadpbcbfnmbkopoojfekhnkhdbieeh";
id = "eimadpbcbfnmbkopoojfekhnkhdbieeh"; sha256 = "sha256-98sGCo2dG+XYMzBeLR+10Ic5DLjDXhSh1DzatLOCyQQ=";
sha256 = "sha256-98sGCo2dG+XYMzBeLR+10Ic5DLjDXhSh1DzatLOCyQQ="; version = "4.9.95";
version = "4.9.95"; })
}) (fetchFromStore {
(fetchFromStore { # Foxy Proxy.
# Foxy Proxy. id = "gcknhkkoolaabfmlnjonogaaifnjlfnp";
id = "gcknhkkoolaabfmlnjonogaaifnjlfnp"; sha256 = "sha256-Zm7x/467CaGcEN+cYwf8XowpaZRJQIzIEY/F6NhJ3pA=";
sha256 = "sha256-Zm7x/467CaGcEN+cYwf8XowpaZRJQIzIEY/F6NhJ3pA="; version = "8.9";
version = "8.9"; })
}) (fetchFromStore {
(fetchFromStore { # Vimium.
# Vimium. id = "dbepggeogbaibhgnhhndojpepiihcmeb";
id = "dbepggeogbaibhgnhhndojpepiihcmeb"; sha256 = "sha256-DaEM1NyMX8RMBvWoIVOhmfY/ae66HCNfRFnwAuLUHVU=";
sha256 = "sha256-DaEM1NyMX8RMBvWoIVOhmfY/ae66HCNfRFnwAuLUHVU="; version = "2.1.2";
version = "2.1.2"; })
}) # (fetchFromUrl rec {
# (fetchFromUrl rec { # # Ext updater.
# # Ext updater. # id = "ocaahdebbfolfmndjeplogmgcagdmblk";
# id = "ocaahdebbfolfmndjeplogmgcagdmblk"; # url = "https://github.com/NeverDecaf/chromium-web-store/releases/download/v${version}/Chromium.Web.Store.crx";
# url = "https://github.com/NeverDecaf/chromium-web-store/releases/download/v${version}/Chromium.Web.Store.crx"; # sha256 = "sha256-gKAcrvnxLh9gMraTFX4zRsUua4OI+lak51gpII29d8g=";
# sha256 = "sha256-gKAcrvnxLh9gMraTFX4zRsUua4OI+lak51gpII29d8g="; # version = "1.5.4.3";
# version = "1.5.4.3"; # })
# }) ];
];
in in
{ {
enable = true; enable = true;

View file

@ -57,6 +57,16 @@ in
}; };
services.gvfs.enable = true; services.gvfs.enable = true;
# Chromium config.
environment.etc =
let
chromium = import <home/config/chromium> args;
in
{
"chromium/initial_preferences".source = lib.mkForce chromium.preferences;
"chromium/policies/managed/extra.json".source = lib.mkForce chromium.policy;
};
}) })
# Desktop apps. # Desktop apps.

View file

@ -123,7 +123,7 @@
]; ];
creative = with pkgs; [ creative = with pkgs; [
aseprite # Pixel Art draw app. WARNING: Always builds from source. libresprite # Pixel Art draw app.
blender-hip # Blender with HiP support. blender-hip # Blender with HiP support.
krita # Draw! krita # Draw!
]; ];