#pragma once #include "types.hh" #include "hash.hh" #include "fetchers/fetchers.hh" #include namespace nix { class Store; typedef std::string FlakeId; struct FlakeRef { std::shared_ptr input; Path subdir; bool operator==(const FlakeRef & other) const; FlakeRef(const std::shared_ptr & input, const Path & subdir) : input(input), subdir(subdir) { assert(input); } // FIXME: change to operator <<. std::string to_string() const; fetchers::Input::Attrs toAttrs() const; FlakeRef resolve(ref store) const; static FlakeRef fromAttrs(const fetchers::Input::Attrs & attrs); std::pair fetchTree(ref store) const; }; std::ostream & operator << (std::ostream & str, const FlakeRef & flakeRef); FlakeRef parseFlakeRef( const std::string & url, const std::optional & baseDir = {}); std::optional maybeParseFlake( const std::string & url, const std::optional & baseDir = {}); std::pair parseFlakeRefWithFragment( const std::string & url, const std::optional & baseDir = {}); std::optional> maybeParseFlakeRefWithFragment( const std::string & url, const std::optional & baseDir = {}); }