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

simple flake spams "warning: Use stdenv.tests instead. passthru is a mkDerivation detail." on eval #10035

Closed
ckp95 opened this issue Feb 18, 2024 · 3 comments
Labels
bug new-cli Relating to the "nix" command

Comments

@ckp95
Copy link

ckp95 commented Feb 18, 2024

Steps To Reproduce

I'm trying to follow a Flakes tutorial here:

https://serokell.io/blog/practical-nix-flakes#basic-flake-structure

I got to the point of a trivial Flake that just re-exports the hello package:

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs";
  };

  outputs = { self, nixpkgs }: {
    packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello;
  };
}

I ran nix eval .#hello to see what would happen, but it just spammed the following line in my terminal forever until I pressed CTRL-C:

trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.

Expected behavior

I don't know the expected behaviour because I'm still learning Flakes, but whatever it is, it shouldn't spam an unhelpful error forever.

Version info

$ nix --version
nix (Nix) 2.18.1

I run NixOS 23.11

@ckp95 ckp95 added the bug label Feb 18, 2024
@thufschmitt
Copy link
Member

nix eval is a fairly low-level command designed to directly integrate with the language, and will blindly recurse into anything. For some reason, the derivations exposed by Nixpkgs are a cyclic data structure, so trying to directly evaluate a derivation is bound to loop forever.

I think there are three paths from here (in order of preference as far as I'm concerned):

  1. Fix Nixpkgs stdenv to not yield infinitely recursive data structures (why does it even need that?)
  2. Do like the old nix-instantiate --eval command which didn't deeply evaluate anything by default (and had a --strict mode for that)
  3. Keep the current behaviour.

nix eval is in the queue of commands to be stabilized (#7701), so it will soon be a good time to re-visit it

@thufschmitt thufschmitt added the new-cli Relating to the "nix" command label Feb 19, 2024
@arianvp
Copy link
Member

arianvp commented Mar 14, 2024

Worse. this even segfaults on my machine. Very confusing:

arian@Arians-MacBook-Pro mercury-intranet % nix eval nixpkgs#gcc
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
trace: warning: Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail.
zsh: segmentation fault  nix eval nixpkgs#gcc

@thufschmitt
Copy link
Member

@arianvp this was changed just last week: #10200

On Nix master:

 $ nix eval nixpkgs#gcc  
«derivation /nix/store/svc566dmzacxdvdy6d1w4ahhcm9qc8zf-gcc-wrapper-12.3.0.drv»

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug new-cli Relating to the "nix" command
Projects
None yet
Development

No branches or pull requests

3 participants