Why isn't `~/.config/nixpkgs/config.nix` evaluated for `nix build`?

So I have:

$ cat ~/.config/nixpkgs/config.nix
  allowUnfree = true;
  android_sdk.accept_license = true;


$ nix build nixpkgs#zoom-us
Package ‘zoom-us-5.3.472687.1012’ in /nix/store/4kri1x29xchw732jrvq3mva4bw8v3jnj-source/pkgs/applications/networking/instant-messengers/zoom-us/default.nix:128 has an unfree license (‘unfree’), refusing to evaluate.

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

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

(use '--show-trace' to show detailed location information)

How come?

Looks like you’re building using the new CLI utilizing flakes. Because flakes are supposed to be reproducibly evaluatable, local config is ignored.


Hmmm… and indeed --impure works! I think we should modify that message to explain this for nixUnstable users.


Fixed in https://github.com/NixOS/nixpkgs/pull/101367 .

1 Like