Allow unfree packages in repo from NUR

I’m trying to declare my Firefox config with home-manager using the firefox-addons packages from @rycee. I’m using home-manager as a flake by running nix run.

All of the free Firefox extensions work fine, but Nix refuses to install any extension with an unfree license, even though I’ve got {nixpkgs.config.allowUnfree = true;} included from a different file. I assume I need to override firefox-addons to allow unfree packages, but I have no idea how to do that. Any help would be greatly appreciated.

For reference, my flake.nix (simplified) looks like this:

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
    home-manager = {
      url = "github:nix-community/home-manager/release-23.11";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    firefox-addons = {
      url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {
    nixpkgs,
    home-manager,
    firefox-addons,
    ...
  }: let
    system = "x86_64-linux";
    pkgs = import nixpkgs {
      inherit system;
    };
    extraSpecialArgs = {
      inherit firefox-addons system;
    };
  in {
    packages.${system}.default = home-manager.defaultPackage.${system};

    homeConfigurations = {
      "user@hostname" = home-manager.lib.homeManagerConfiguration {
        inherit pkgs;
        inherit extraSpecialArgs;
        modules = [
          ./modules/firefox.nix
        ];
      };
    };
  };
}

And modules/firefox.nix looks like:

{
  pkgs,
  system,
  firefox-addons,
  ...
}: {
  programs.firefox = {
    enable = true;
    package = pkgs.firefox.override {
      cfg.enableGnomeExtensions = true;
    };
    profiles.main = {
      id = 0;
      extensions = with firefox-addons.packages.${system}; [
        # These are free, and work completely fine
        privacy-badger
        ublock-origin
        darkreader
        wayback-machine

        # These are unfree, and nix refuses to install them
        tampermonkey
        enhancer-for-youtube
        dashlane
      ];
    };
  };
}

I got it from here: GitHub - BirdeeHub/birdeeSystems: my personal nix config (install at your own risk, there are no instructions and the installer alias reformats drives)

Short version:

# flake.nix
  inputs = {
    nur.url = "github:nix-community/nur";
  };
# home.nix
{ inputs, ... }:
{
  nixpkgs = {
    overlays = [
      inputs.nur.overlay
    ];
    config = {
      allowUnfree = true;
    };
  };
}
{ pkgs, ... }:
{
  programs.firefox = {
    enable = true;
    profiles = {
      default = {
        extensions = with pkgs.nur.repos.rycee.firefox-addons; [
          enhancer-for-youtube # non-free
        ];
    };
  };
}

Yeah, that’s exactly what I ended up doing. If you add the NUR as an overlay then you could also use nixpkgs.config.allowUnfreePredicate to only allow specific unfree packages.