mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
add explanation and test
This commit is contained in:
parent
b13fd4c58e
commit
bd8571a5c3
2 changed files with 16 additions and 0 deletions
|
@ -83,6 +83,17 @@ struct CmdWhyDepends : SourceExprCommand
|
|||
{
|
||||
auto package = parseInstallable(store, _package);
|
||||
auto packagePath = Installable::toStorePath(getEvalStore(), store, Realise::Outputs, operateOn, package);
|
||||
|
||||
/* We don't need to build `dependency`. We try to get the store
|
||||
* path if it's already known, and if not, then it's not a dependency.
|
||||
*
|
||||
* Why? If `package` does depends on `dependency`, then getting the
|
||||
* store path of `package` above necessitated having the store path
|
||||
* of `dependency`. The contrapositive is, if the store path of
|
||||
* `dependency` is not already known at this point (i.e. it's a CA
|
||||
* derivation which hasn't been built), then `package` did not need it
|
||||
* to build.
|
||||
*/
|
||||
auto dependency = parseInstallable(store, _dependency);
|
||||
auto derivedDependency = dependency->toDerivedPath();
|
||||
auto optDependencyPath = std::visit(overloaded {
|
||||
|
|
5
tests/ca/why-depends.sh
Normal file
5
tests/ca/why-depends.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
source common.sh
|
||||
|
||||
export NIX_TESTS_CA_BY_DEFAULT=1
|
||||
|
||||
cd .. && source why-depends.sh
|
Loading…
Reference in a new issue