Can't make allowUnfreePredicate in configuration.nix

dan4ik@nixos ~> sudo nixos-rebuild switch
building Nix…
building the system configuration…
error: Package ‘osu-lazer-2020.1225.0’ in /nix/store/vsvcwr94f3s4gx1gzkllqxvvzms24xw5-unstable-21.03pre260232.733e537a8ad/unstable/pkgs/games/osu-lazer/default.nix:107 has an unfree license (‘mit cc-by-nc-40 unfreeRedistributable’), refusing to evaluate.

a) To temporarily allow unfree packages, you can use an environment variable
for a single invocation of the nix tools.

 $ export NIXPKGS_ALLOW_UNFREE=1

b) For nixos-rebuild you can set
{ nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.

Alternatively you can configure a predicate to whitelist specific packages:
{ nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
“osu-lazer”
];
}

c) For nix-env, nix-build, nix-shell or any other Nix command you can add
{ allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.

Did you try the suggestion from the error message?

b) For nixos-rebuild you can set

{ nixpkgs.config.allowUnfree = true; }

in configuration.nix to override this.

1 Like