-
Notifications
You must be signed in to change notification settings - Fork 181
Closed
Labels
C-bugSomething isn't workingSomething isn't working
Description
This is related to #389, with a twist.
Steps to reproduce
- Install Nix on macOS, with the Determinate Systems installer. Using the "official" installer would work, but with more steps (enable Flakes, disable nixpkgs) and I'm not an expert on that 😬
- Install an unfree flake:
NIXPKGS_ALLOW_UNFREE=1 nix profile install --impure 'nixpkgs#_1password'
- Run
topgrade
Erroneous Behavior
topgrade fails with the following error:
MacPro% env|grep ALLOW
NIXPKGS_ALLOW_UNFREE=1
MacPro% nix --extra-experimental-features nix-command profile upgrade '.*' --verbose
error: Package ‘1password-cli-2.22.0’ in /nix/store/mrckm9b3v6wg2fljdp3z4pja1sz07g3z-source/pkgs/applications/misc/1password/default.nix:71 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
Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
then pass `--impure` in order to allow use of environment variables.
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) [
"1password-cli"
];
}
c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.
Options b
/c
do not work, because of Flakes (from what I understand) - and the env.var alone isn't enough, --impure
must be passed.
Expected Behavior
One of:
- Documentation to explain why this doesn't work - which I'm trying to achieve with this ticket.
- The command used by topgrade should work out of the box.
- Topgrade should allow setting
--impure
. - Topgrade should automagically add
--impure
whenNIX_*
environment variables are present?
Problem persists without calling from topgrade
- Yes, but with a workaround
- No
Additional Details
- Operation System/Version: MacOS Sonoma
- Topgrade version (
topgrade -V
): Topgrade 13.0.0, installed with Nix
Relevant code
Line 397 in 78dec89
let nix_args = ["--extra-experimental-features", "nix-command"]; |
starsep
Metadata
Metadata
Assignees
Labels
C-bugSomething isn't workingSomething isn't working