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

nix-env silently fails to install unfree packages #1963

Open
obadz opened this issue Mar 11, 2018 · 13 comments
Open

nix-env silently fails to install unfree packages #1963

obadz opened this issue Mar 11, 2018 · 13 comments
Assignees
Labels
bug cli The old and/or new command line interface UX The way in which users interact with Nix. Higher level than UI.

Comments

@obadz
Copy link

obadz commented Mar 11, 2018

nix-env silently fails to install unfree packages when allowUnfree = false; and returns success:

$ nix-env -iA nixpkgs.unrar
$ echo $?
0
$ nix build nixpkgs.unrar
error: Package ‘unrar-5.5.8’ in <nixpkgs>/pkgs/tools/archivers/unrar/default.nix:39 has an unfree license (‘unfreeRedistributable’), 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)

Feels like it should display the same error that nix build does.

@obadz
Copy link
Author

obadz commented Mar 11, 2018

Both with nix-1.11 and nix-2

@dtzWill
Copy link
Member

dtzWill commented Mar 11, 2018

Thanks for reporting, this is no good!

I can reproduce, but after some investigation it seems this only happens with recent nixpkgs:

$ nix-env -f channel:nixos-17.09 -iA unrar
error: while evaluating 'callPackageWith' at /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/lib/customisation.nix:113:35, called from /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/pkgs/top-level/all-packages.nix:4957:11:
while evaluating 'makeOverridable' at /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/lib/customisation.nix:72:24, called from /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/lib/customisation.nix:117:8:
while evaluating anonymous function at /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/pkgs/tools/archivers/unrar/default.nix:1:1, called from /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/lib/customisation.nix:74:12:
while evaluating 'mkDerivation' at /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/pkgs/stdenv/generic/make-derivation.nix:15:5, called from /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/pkgs/tools/archivers/unrar/default.nix:3:1:
while evaluating 'addPassthru' at /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/lib/customisation.nix:135:22, called from /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/pkgs/stdenv/generic/make-derivation.nix:166:7:
while evaluating anonymous function at /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/pkgs/stdenv/generic/check-meta.nix:5:1, called from /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/pkgs/stdenv/generic/make-derivation.nix:167:22:
while evaluating 'handleEvalIssue' at /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/pkgs/stdenv/generic/check-meta.nix:128:21, called from /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/pkgs/stdenv/generic/check-meta.nix:203:17:
Package ‘unrar-5.5.8’ in /nix/store/kzrzq8fca5grj82rrq9xmz3yz1vr5gpl-nixexprs.tar.xz/pkgs/tools/archivers/unrar/default.nix:36 has an unfree license (‘unfreeRedistributable’), 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.

Pointing at unstable:

$ nix-env -f channel:nixos-unstable -iA unrar

So perhaps the problem is with nixpkgs?

@dtzWill
Copy link
Member

dtzWill commented Mar 11, 2018

Okay bisected the change to this commit:

NixOS/nixpkgs@50148f0

Which links to #1771, although from a quick read I'm not sure this is known/"expected"?

Hopefully folks from that issue have some insights and suggestions :).

@obadz
Copy link
Author

obadz commented Mar 13, 2018

Thanks @dtzWill !

@oxij
Copy link
Member

oxij commented Apr 17, 2018 via email

@oxij
Copy link
Member

oxij commented Jun 12, 2018

Btw, I just checked and #1771 indeed fixes this.

@akavel
Copy link

akavel commented Sep 13, 2018

Just stumbled upon this when trying to install VSCode. Had no idea what to do. Only after running nix-env with -v flag, seeing "license.nix" as one of listed files, and being lucky enough to recall that an "allowUnfree" flag is a thing, I was able to resolve this for myself. If I was just a tad bit more newbie, with the empty output I'd stand no chance to resolve this, other than asking on Nix Discourse (having first to register on the forum).

@matthewbauer
Copy link
Member

This is not actually a Nix bug - but a Nixpkgs one.

Fixed in NixOS/nixpkgs@ae16dd1

@oxij
Copy link
Member

oxij commented Jan 28, 2019 via email

@matthewbauer
Copy link
Member

It still uses validity.handled, just not for the name attr: https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/make-derivation.nix#L307

@oxij
Copy link
Member

oxij commented Jan 28, 2019 via email

@matthewbauer
Copy link
Member

Yes- I think we can fix the nix-env -qa count with an added --out-path arg. That gets me 19260 which I think is correct.

I'd much rather have those numbers be wrong though than get the really bad user experience of trying to install something and getting no output from Nix.

Before:

nixpkgs $ nix-env -f. -iA zoom-us

After:

nixpkgs $ nix-env -f. -iA zoom-us
installing 'zoom-us-2.6.149990.1216'
error: Package ‘zoom-us-2.6.149990.1216’ in /home/mbauer/nixpkgs/pkgs/applications/networking/instant-messengers/zoom-us/default.nix:98 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)

@stale
Copy link

stale bot commented Feb 14, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Feb 14, 2021
@fricklerhandwerk fricklerhandwerk added bug UX The way in which users interact with Nix. Higher level than UI. cli The old and/or new command line interface labels Oct 6, 2022
@stale stale bot removed stale labels Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cli The old and/or new command line interface UX The way in which users interact with Nix. Higher level than UI.
Projects
None yet
Development

No branches or pull requests

8 participants