1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-10 12:36:01 +01:00

Some effort to minimize flake dependencies

For example, if the top-level flake depends on
"nixpkgs/release-19.03", and one of its dependencies depends on
"nixpkgs", then the latter will be mapped to "nixpkgs/release-19.03",
rather than whatever the default branch of "nixpkgs" is. Thus you get
only one "nixpkgs" dependency rather than two.

This currently only works in a breadth-first way, so the other way
around (i.e. if the top-level flake depends on "nixpkgs", and a
dependency depends on "nixpkgs/release-19.03") still results in two
"nixpkgs" dependencies.
This commit is contained in:
Eelco Dolstra 2019-09-18 23:59:45 +02:00
parent c67407172d
commit aeb7148afd
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 94 additions and 26 deletions

View file

@ -182,6 +182,12 @@ struct FlakeRef
return std::get_if<FlakeRef::IsPath>(&data)
&& rev == Hash(rev->type);
}
/* Return true if 'other' is not less specific than 'this'. For
example, 'nixpkgs' contains 'nixpkgs/release-19.03', and both
'nixpkgs' and 'nixpkgs/release-19.03' contain
'nixpkgs/release-19.03/<hash>'. */
bool contains(const FlakeRef & other) const;
};
std::ostream & operator << (std::ostream & str, const FlakeRef & flakeRef);