aboutsummaryrefslogtreecommitdiffstats
path: root/modules/web/chromium/default.nix
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar+git@gmail.com>2026-07-27 22:58:52 +0530
committerArpit Chakladar <arpitchakladar+git@gmail.com>2026-07-27 23:04:07 +0530
commitc1daed5370b8ca2555c12cb5f248b5891bc8896a (patch)
tree06c1f13e9b499458ffced4865c4d158fda06df36 /modules/web/chromium/default.nix
parent1079bdef3a4630c915f62c437187a821167e8d7b (diff)
downloadhome-manager-config-c1daed5370b8ca2555c12cb5f248b5891bc8896a.tar.gz
home-manager-config-c1daed5370b8ca2555c12cb5f248b5891bc8896a.zip
feat: using ungoogled-chromium, accelerated graphics for hyprland
- Switch to using ungoogled-chromium package instead of chromium to get away from google tracking - Installing extensions unpacked from their source code/zip downloads for ungoogled-chromium - Using hl.env to pass environment variables to hyprland as home.sessionVariables don't get passed - Fixed the graphics acceleration for hyprland, but passing the environment variables through hl.env
Diffstat (limited to 'modules/web/chromium/default.nix')
-rw-r--r--modules/web/chromium/default.nix141
1 files changed, 80 insertions, 61 deletions
diff --git a/modules/web/chromium/default.nix b/modules/web/chromium/default.nix
index f867e3b..8cf0bea 100644
--- a/modules/web/chromium/default.nix
+++ b/modules/web/chromium/default.nix
@@ -1,7 +1,7 @@
-# Chromium - Web browser configuration
{
config,
lib,
+ pkgs,
...
}:
{
@@ -17,77 +17,96 @@
defaultText = lib.literalExpression "config.programs.chromium.finalPackage";
description = "Package to use for chromium. Defaults to the wrapped finalPackage from programs.chromium.";
};
+ checkForUpdates = lib.mkOption {
+ type = lib.types.bool;
+ default = true;
+ description = ''
+ Check GitHub for newer extension releases before building, and abort
+ with upgrade instructions if the pinned version is stale. Requires
+ network access during evaluation (pass --impure to nix/home-manager).
+ '';
+ };
};
- config = lib.mkIf config.web.chromium.enable {
- programs.chromium = {
- enable = true;
+ config = lib.mkIf config.web.chromium.enable (
+ let
+ exts = import ./extensions {
+ inherit lib pkgs;
+ checkForUpdates = config.web.chromium.checkForUpdates;
+ };
- commandLineArgs = [
- "--force-device-scale-factor=1.15"
+ extensionDirs = [
+ exts.ublockOrigin.drv
+ exts.darkMode.drv
+ exts.browserpass.drv
+ exts.aria2Explorer.drv
];
- extensions = [
- { id = "ddkjiahejlhfcafbddmgiahcphecmpfh"; } # uBlock Origin Lite
- { id = "naepdomgkenhinolocfifgehidddafch"; } # Browserpass
- { id = "faeadnfmdfamenfhaipofoffijhlnkif"; } # True Amoled Black Theme
- { id = "eimadpbcbfnmbkopoojfekhnkhdbieeh"; } # Dark Reader
- { id = "mpkodccbngfoacfalldjimigbofkhgjn"; } # Aria2 Explorer
+ pinnedIds = lib.filter (id: id != null) [
+ exts.browserpass.id
+ exts.darkMode.id
+ exts.ublockOrigin.id
];
- };
+ in
+ {
+ programs.chromium = {
+ enable = true;
+ package = pkgs.ungoogled-chromium;
+ commandLineArgs = [
+ "--force-device-scale-factor=1.15"
+ "--load-extension=${lib.concatStringsSep "," extensionDirs}"
+ ];
+ };
- xdg.mimeApps.defaultApplications = {
- "x-scheme-handler/http" = "chromium-browser.desktop";
- "x-scheme-handler/https" = "chromium-browser.desktop";
- "x-scheme-handler/chrome" = "chromium-browser.desktop";
- "text/html" = "chromium-browser.desktop";
- "application/xhtml+xml" = "chromium-browser.desktop";
- };
+ xdg.mimeApps.defaultApplications = {
+ "x-scheme-handler/http" = "chromium-browser.desktop";
+ "x-scheme-handler/https" = "chromium-browser.desktop";
+ "x-scheme-handler/chrome" = "chromium-browser.desktop";
+ "text/html" = "chromium-browser.desktop";
+ "application/xhtml+xml" = "chromium-browser.desktop";
+ };
- xdg.configFile."chromium/Default/Preferences" = {
- force = true;
- text = builtins.toJSON {
- browser = {
- show_full_urls = true;
- theme = {
- follows_system_colors = true;
+ xdg.configFile."chromium/Default/Preferences" = {
+ force = true;
+ text = builtins.toJSON {
+ browser = {
+ show_full_urls = true;
+ theme = {
+ follows_system_colors = true;
+ };
};
- };
- search = {
- suggest_enabled = false;
- };
- url_handling = {
- show_full_urls = true;
- };
- autofill = {
- profile_enabled = false;
- credit_card_enabled = false;
- };
- vertical_tabs = {
- collapsed_state = true;
- enabled = true;
- enabled_first_time = true;
- uncollapsed_width = 240;
- };
- credentials_enable_service = false;
- credentials_enable_autosignin = false;
- extensions = {
- pinned_extensions = [
- "ddkjiahejlhfcafbddmgiahcphecmpfh"
- "naepdomgkenhinolocfifgehidddafch"
- "eimadpbcbfnmbkopoojfekhnkhdbieeh"
- ];
- ui = {
- developer_mode = true;
+ search = {
+ suggest_enabled = false;
};
- };
- profile = {
- default_content_setting_values = {
- notifications = 2;
+ url_handling = {
+ show_full_urls = true;
+ };
+ autofill = {
+ profile_enabled = false;
+ credit_card_enabled = false;
+ };
+ vertical_tabs = {
+ collapsed_state = true;
+ enabled = true;
+ enabled_first_time = true;
+ uncollapsed_width = 240;
};
+ credentials_enable_service = false;
+ credentials_enable_autosignin = false;
+ extensions = {
+ pinned_extensions = pinnedIds;
+ ui = {
+ developer_mode = true;
+ };
+ };
+ profile = {
+ default_content_setting_values = {
+ notifications = 2;
+ };
+ };
+ high_efficiency_mode_enabled = true;
};
- high_efficiency_mode_enabled = true;
};
- };
- };
+ }
+ );
}