How do I decoratively install Firefox extensions, or addons?
I’m sorry to make yet another post on this topic but I’ve been trying all weekend to make this work but coming up empty. Based on posts such as this and example configurations such as this one, I have the following flake.nix
, home.nix
and firefox.nix
files in my /etc/nixos
directory. But even after removing ~/.mozilla/firefox
and ~/.cache/mozilla/
before running sudo nixos-rebuild switch --flake '/etc/nixos#nixos'
, I can’t get uBlock Origin to install, even though the other settings take effect.
Thanks in advance.
# /etc/nixos/flake.nix
{
description = "NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ nixpkgs, home-manager, ... }: {
nixosConfigurations = {
nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.virtsamir = import ./home.nix;
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.backupFileExtension = "backup";
}
];
};
};
};
}
# /etc/nixos/home.nix
{ config, pkgs, inputs, ... }:
{
imports = [ ./firefox.nix ];
home.username = "samir";
home.homeDirectory = "/home/samir";
home.packages = with pkgs; [ ];
home.stateVersion = "24.11";
programs.home-manager.enable = true;
}
# /etc/nixos/firefox.nix
{ inputs, config, pkgs, ... }:
{
programs = {
firefox = {
enable = true;
package = pkgs.firefox;
profiles.default = {
id = 0;
name = "default";
isDefault = true;
settings = {
"browser.aboutConfig.showWarning" = true;
};
};
policies = {
DisableTelemetry = true;
ExtensionSettings = {
"uBlock0@raymondhill.net" = {
installation_mode = "force_installed";
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
};
};
};
};
};
}