allowUnfreePredicate for NUR package


I would like to be able to install some unfree firefox extensions, but without allowing any unfree package. I saw that the global allowUnfree seems to work (Allow unfree packages in repo from NUR), but I would like to be able to specify packages I allow.

My use case here is with pkgs.nur.repos.rycee-firefox-addons.gaoptout. I add it to firefox with:

programs.firefox.profiles.default.extensions = with pkgs.nur.repos.rycee.firefox-addons; [

And try to allow it that way:

nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "gaoptout" ];

But I still get the unfree license error:

error: Package ‘gaoptout-1.0.8’ in /nix/store/ayjf12761b0sf8w0wqzqbh49s8lphqiv-source/pkgs/firefox-addons/default.nix:93 has an unfree license (‘gaooba’), refusing to evaluate.

Thank you!

Hmm, it worked for me.

$ cat 'example.nix'
{ lib, pkgs, ... }:

  home.stateVersion = "23.11";
  home.username = "example";
  home.homeDirectory = "/home/example";

  nixpkgs.overlays = [
    (final: prev: {
      nur = import (builtins.fetchTarball "") {
        pkgs = prev;

  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [

  programs.firefox = {
    enable = true;

    profiles.default.extensions = with pkgs.nur.repos.rycee.firefox-addons; [
$ home-manager -f 'example.nix' build
$ unzip -p 'result/home-files/.mozilla/firefox/default/extensions/{6d96bb5e-1175-4ebf-8ab5-5f56f1c79f65}.xpi' '_locales/en/messages.json' | jq '.gaoptout_name.message'
"Google Analytics Opt-out Add-on (by Google)"
1 Like

Thank you for your feedback!

Indeed, I forgot to precise that I’m using Home Manager here. If I move the allowUnfreePredicate out of hm, it’s working, thanks!

However, do you know how I could make it work in Home Manager? That way, I could let everything related to firefox in one file.