Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::FlakeRef Struct Reference

#include <flakeref.hh>

Public Member Functions

bool operator== (const FlakeRef &other) const =default
bool operator< (const FlakeRef &other) const
 FlakeRef (fetchers::Input &&input, const std::string &subdir)
std::string to_string () const
fetchers::Attrs toAttrs () const
FlakeRef resolve (const fetchers::Settings &fetchSettings, Store &store, fetchers::UseRegistries useRegistries=fetchers::UseRegistries::All) const
std::pair< ref< SourceAccessor >, FlakeRef > lazyFetch (const fetchers::Settings &fetchSettings, Store &store) const
FlakeRef canonicalize () const

Static Public Member Functions

static FlakeRef fromAttrs (const fetchers::Attrs &attrs)

Public Attributes

fetchers::Input input
std::string subdir

Detailed Description

A flake reference specifies how to fetch a flake or raw source (e.g. from a Git repository). It is created from a URL-like syntax (e.g. 'github:NixOS/patchelf'), an attrset representation (e.g. '{ type="github"; owner = "NixOS"; repo = "patchelf"; }'), or a local path.

Each flake will have a number of FlakeRef objects: one for each input to the flake.

The normal method of constructing a FlakeRef is by starting with an input description (usually the attrs or a url from the flake file), locating a fetcher for that input, and then capturing the Input object that fetcher generates (usually via FlakeRef::fromAttrs(attrs) or parseFlakeRef(url) calls).

The actual fetch may not have been performed yet (i.e. a FlakeRef may be lazy), but the fetcher can be invoked at any time via the FlakeRef to ensure the store is populated with this input.

Member Function Documentation

◆ canonicalize()

FlakeRef nix::FlakeRef::canonicalize ( ) const

Canonicalize a flakeref for the purpose of comparing "old" and "new" original fields in lock files.

Member Data Documentation

◆ input

fetchers::Input nix::FlakeRef::input

Fetcher-specific representation of the input, sufficient to perform the fetch operation.

◆ subdir

std::string nix::FlakeRef::subdir

sub-path within the fetched input that represents this input

Todo
Should probably use CanonPath instead of std::string?

The documentation for this struct was generated from the following files:
  • libflake/include/nix/flake/flakeref.hh
  • libflake/flakeref.cc