Firefox extensions with Home Manager

Hi,

I’m very new to NixOS and trying to figure things out. I like the idea of declaratively configuring every aspect of my installed apps. My config is based on Misterio77’s standard config. I’m trying to set up Firefox extensions using Home Manager. I added

firefox-addons = { url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; inputs.nixpkgs.follows = "nixpkgs"; };

to the inputs of my flake.nix and

extensions = with pkgs.inputs.firefox-addons; [ ublock-origin bitwarden ];

to my Firefox entry in home.nix.
When I run the hm switch command I get this error:

error: attribute 'inputs' missing

Is there something wrong I’m doing?
Thanks!

pkgs doesn’t have the attriubte inputs, but that’s expected. you want something like:

{ inputs, pkgs, config, ... }:
...
extensions = with inputs.firefox-addons; [ ublock-origin bitwarden ];

It get’s defined here: https://github.com/Misterio77/nix-starter-configs/blob/fe21fa16704972126a9660622b8464bd215c7894/standard/flake.nix#L29 and you can access it at the start of the config file because of: https://github.com/Misterio77/nix-starter-configs/blob/fe21fa16704972126a9660622b8464bd215c7894/standard/flake.nix#L64C15-L64C15

Thanks for your answer. So I changed pkgs.inputs.firefox-addons to inputs.firefox-addons and now I get the following error:

error: undefined variable 'ublock-origin'

You want:

extensions = with inputs.firefox-addons.packages.${pkgs.system}; [ ublock-origin bitwarden ];
2 Likes

Thanks a lot for your help, now it’s working. Do you mind explaining how you came up with this solution?

1 Like

Sure, I copied it from replace inputs.x.packages.${sys}.y pkgs.inputs.x.y · Misterio77/nix-config@4e3f0fc · GitHub :smiley:

the explanation is that:
inputs gets you your flake inputs because they are bound with @inputs in your flake.nix, then you want the firefox flake which is firefox-addons it exposes packages which are in the packages output and ${pkgs.system} evaluates to your architecture, you can do nix eval nixpkgs#system to get the value.
You can see the output definition of the flake here: pkgs/firefox-addons/flake.nix · master · Robert Helgesson / NUR Expressions · GitLab

Misterio updated there config because they now use a overlay which is a way of merging package sets, you can read more about overlays here: Overlays | NixOS & Flakes Book

I hope this helps ^^

2 Likes

Thanks a lot for your explanation, it’s very helpful :slight_smile:

1 Like