aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake/flakeref.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-09-18 23:59:45 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-09-18 23:59:45 +0200
commitaeb7148afd56b228604b79373a45793d36d660a3 (patch)
tree7c25eceaf1196fbe942c3bca065682e4e953d891 /src/libexpr/flake/flakeref.hh
parentc67407172d8383394f4962ad177c84bf04529e5e (diff)
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.
Diffstat (limited to 'src/libexpr/flake/flakeref.hh')
-rw-r--r--src/libexpr/flake/flakeref.hh6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libexpr/flake/flakeref.hh b/src/libexpr/flake/flakeref.hh
index 6b47330a7..39e019dbd 100644
--- a/src/libexpr/flake/flakeref.hh
+++ b/src/libexpr/flake/flakeref.hh
@@ -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);