> nix run nixpkgs#vscode
error: Package ‘vscode-1.57.0’ in /nix/store/z9jsqkhnq7cwq7szvkx0yyp5fy8z8czv-source/pkgs/applications/editors/vscode/vscode.nix:43 has an unfree license (‘unfree’), 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 allow specific packages:
{ nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"vscode"
];
}
c) 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)
but I already have ~/.config/nixpkgs/config.nix:
{ allowUnfree = true; }
Ok, well then I tried:
> NIXPKGS_ALLOW_UNFREE=1 nix run nixpkgs#vscode
error: Package ‘vscode-1.57.0’ in /nix/store/z9jsqkhnq7cwq7szvkx0yyp5fy8z8czv-source/pkgs/applications/editors/vscode/vscode.nix:43 has an unfree license (‘unfree’), refusing to evaluate.
...
How do I evaluate unfree derivations with nix run?
I don’t think so, no. The output you reported is what I would expect.
In the command I gave, I am using my personal nix config repo and referring to a specially-configured output attribute. My nixcfg repo specifically configures pkgs to be a re-export of nixpkgs with allowUnfree set to true. If you trace through my config (and my very personal helper functions) you see that it boils down to roughly pkgs.x86_64-linux = import inputs.nixpkgs { system = "x86_64-linux"; allowUnfree = true; }. One cannot escape the explicit-ness!
EDIT: Oh! Re-reading your post, one could indeed argue that the error message is out-of-date. Those tips aren’t very useful for you at all!!