Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-free nix packages with Flakes are failing to upgrade #611

Closed
1 of 2 tasks
punkeel opened this issue Nov 20, 2023 · 0 comments · Fixed by #881
Closed
1 of 2 tasks

Non-free nix packages with Flakes are failing to upgrade #611

punkeel opened this issue Nov 20, 2023 · 0 comments · Fixed by #881
Labels
C-bug Something isn't working

Comments

@punkeel
Copy link

punkeel commented Nov 20, 2023

This is related to #389, with a twist.

Steps to reproduce

  1. 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 😬
  2. Install an unfree flake: NIXPKGS_ALLOW_UNFREE=1 nix profile install --impure 'nixpkgs#_1password'
  3. 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 when NIX_* 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

let nix_args = ["--extra-experimental-features", "nix-command"];

@punkeel punkeel added the C-bug Something isn't working label Nov 20, 2023
dashmoho pushed a commit to dashmoho/topgrade that referenced this issue Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant