mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Merge pull request #10200 from 9999years/fix-nix-eval-for-derivations
Fix `nix eval nixpkgs#bash` segfault
This commit is contained in:
commit
25bf671015
2 changed files with 24 additions and 2 deletions
13
doc/manual/rl-next/nix-eval-derivations.md
Normal file
13
doc/manual/rl-next/nix-eval-derivations.md
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
synopsis: "`nix eval` prints derivations as `.drv` paths"
|
||||||
|
prs: 10200
|
||||||
|
---
|
||||||
|
|
||||||
|
`nix eval` will now print derivations as their `.drv` paths, rather than as
|
||||||
|
attribute sets. This makes commands like `nix eval nixpkgs#bash` terminate
|
||||||
|
instead of infinitely looping into recursive self-referential attributes:
|
||||||
|
|
||||||
|
```ShellSession
|
||||||
|
$ nix eval nixpkgs#bash
|
||||||
|
«derivation /nix/store/m32cbgbd598f4w299g0hwyv7gbw6rqcg-bash-5.2p26.drv»
|
||||||
|
```
|
|
@ -120,8 +120,17 @@ struct CmdEval : MixJSON, InstallableValueCommand, MixReadOnlyOption
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
state->forceValueDeep(*v);
|
logger->cout(
|
||||||
logger->cout("%s", ValuePrinter(*state, *v, PrintOptions { .force = true }));
|
"%s",
|
||||||
|
ValuePrinter(
|
||||||
|
*state,
|
||||||
|
*v,
|
||||||
|
PrintOptions {
|
||||||
|
.force = true,
|
||||||
|
.derivationPaths = true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue