How to configure multiple packages using single home-manager module?

FWIW I was looking to do the same as OP, what I ended up doing is to rely on librewolf: use mkFirefoxModule by chayleaf · Pull Request #5684 · nix-community/home-manager · GitHub. Basically added this as a flake input (for non-flake users should be posible to fetchTarball or whatever):

{
  inputs = {
    # ...
    hm-librewolf-module.url = "github:nix-community/home-manager?ref=pull/5684/head";
    hm-librewolf-module.flake = false;
    # ...
  }

  outputs = ...
}

In my home.nix configuration I disabled the original librewolf module and imported the one from the PR as:

{ inputs, ... }:

{
    imports = [
        "${inputs.hm-librewolf-module.outPath}/modules/programs/librewolf.nix"
    ];

    # disable HM module to avoid conflicting 'programs.librewolf' options     
    disabledModules = [ "programs/librewolf.nix" ];
}

After that programs.librewolf can accept the same options and be configured just as programs.firefox, my use-case was mainly to add extensions declaratively, it even worked with rycee’s firefox-addon.

BTW I might have omitted a few details that might be not obvious for someone who’s getting started with HM and is trying to get this working, if that’s the case don’t just look past this post, feel free to ask!

2 Likes