#[non_exhaustive]pub enum FlakeRefType {
Resource(ResourceUrl),
GitForge(GitForge),
Indirect {
id: String,
ref_: Option<String>,
rev: Option<String>,
location: RefLocation,
},
Path {
path: String,
rev: Option<String>,
},
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Resource(ResourceUrl)
A resource-style URL (git+, hg+, file+, tarball+); see
ResourceUrl for the typed shape.
GitForge(GitForge)
A git-forge shorthand (github:, gitlab:, sourcehut:); see
GitForge for the typed shape.
Indirect
Indirect (registry) flake reference, e.g. flake:nixpkgs or
flake:nixpkgs/release-23.05.
Like GitForge, ref_ and rev are typed slots filled at parse
time by inspecting the path-component value: 40-hex goes to rev,
everything else to ref_. Nix’s indirect form accepts up to three
segments flake:id/ref/rev; when both are present, both slots
populate.
location records whether a present value would render as
flake:id/<value> or flake:id?ref=<value>.
Path
Path must be a directory in the filesystem containing a flake.nix.
Path must be an absolute path.
rev carries the optional 40-hex commit pin from a ?rev= query
parameter. Nix accepts rev, narHash, revCount, and
lastModified on path: URLs; narHash and the counts ride on
crate::LocationParameters, but rev is a typed slot so locked
store-path inputs round-trip without losing their pin. There is
no path-component form for the rev (Path has no /<rev> shape in
Nix’s grammar), so it always renders as ?rev=.
path: URLs may use the empty-authority form (path:///abs,
equivalent to path:/abs) – Nix rejects only when the URL
authority’s host is non-empty, so path://host/... errors but
path:///abs parses. To preserve the internal byte-for-byte
round-trip the empty-authority form is stored verbatim (leading
// kept on path); the slash-collapse normalisation Nix
performs at Display time is intentionally deferred.
Trait Implementations§
Source§impl Clone for FlakeRefType
impl Clone for FlakeRefType
Source§fn clone(&self) -> FlakeRefType
fn clone(&self) -> FlakeRefType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FlakeRefType
impl Debug for FlakeRefType
Source§impl Default for FlakeRefType
Default is only the seed for the in-progress FlakeRef inside
parse_nix_uri; an empty-path value is never round-trippable on its own
(the empty-input guard rejects it before it can escape).
impl Default for FlakeRefType
Default is only the seed for the in-progress FlakeRef inside
parse_nix_uri; an empty-path value is never round-trippable on its own
(the empty-input guard rejects it before it can escape).
Source§impl<'de> Deserialize<'de> for FlakeRefType
impl<'de> Deserialize<'de> for FlakeRefType
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for FlakeRefType
impl Display for FlakeRefType
Source§impl PartialEq for FlakeRefType
impl PartialEq for FlakeRefType
Source§fn eq(&self, other: &FlakeRefType) -> bool
fn eq(&self, other: &FlakeRefType) -> bool
self and other values to be equal, and is used by ==.