A NixOS module/config that sets up some stuff on ungoogled-chromium, hope this can help somebody:)
Important
If you want to just include this module in this config into your system make sure to update the hash path to some persistent location on your computer: CHROMIUM_HASH_FILE="/persist/chromium-config.hash"
The most important takeaways from this config are the following
Currently it is not possible to automatically put extensions into some directory and have them be loaded by ungoogled-chromium. You might say that this is already possible using the home manager module. I don't use it, that's why I went with this solution, if you use home manager it's better to just use it for installing extensions.
There is a PR that wants to patch in this functionality: NixOS/nixpkgs#188086, tho unfortunately it hasn't been very active recently.
That's why I made this NixOS module with a workaround, it works by removing the First Run
file from chromium directories and placing direct download links to the crx extension files in first_run_tabs
:
# The user has to confirm the installation of extensions on the first run
initialPrefs = {
"first_run_tabs" = (map chromeWebstoreCrxUrl config.programs.chromium.extensions) ++ [
"https://github.com/NeverDecaf/chromium-web-store/releases/latest/download/Chromium.Web.Store.crx"
"https://github.com/libredirect/browser_extension/releases/download/v3.1.0/libredirect-3.1.0.crx"
];
};
Important
All extensions need to be approved manually during startup after each chromium config update
To enable/disable/change certain Flags you can change them once in chrome://flags then copy the cli arguments from chrome://version and place them in here:
nixpkgs.overlays = [
(self: super: {
ungoogled-chromium = (
super.ungoogled-chromium.override {
commandLineArgs = [
It is necessary to convert the adminSettings to json and place them in as a string instead of an object, this differs from the firefox implementation.
"3rdparty" = {
"extensions" = {
"cjpalhdlnbpafiamejdnhcphjbkeiagm" = {
adminSettings = builtins.toJSON ublockPolicies;
};
};
};