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,7 +63,8 @@
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 =
let
mono = config.style.font.monospace.name; mono = config.style.font.monospace.name;
sans = config.style.font.sansSerif.name; sans = config.style.font.sansSerif.name;
in in
@ -79,10 +80,10 @@
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,8 +2,14 @@
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 =
{
id,
sha256,
version,
}:
{ {
inherit id version; inherit id version;
crxPath = pkgs.fetchurl { crxPath = pkgs.fetchurl {
@ -12,7 +18,13 @@ let
name = "${id}.crx"; name = "${id}.crx";
}; };
}; };
fetchFromUrl = { id, url, sha256, version }: fetchFromUrl =
{
id,
url,
sha256,
version,
}:
{ {
inherit id version; inherit id version;
crxPath = pkgs.fetchurl { crxPath = pkgs.fetchurl {

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!
]; ];