pub struct Derivation {
drv_path: StorePath,
inner: UnverifiedDerivation,
}Expand description
A verified derivation with its StorePath.
A Derivation can only be created by also verifying that all its data
is valid and that its output paths and StorePath matches that data
and the hash derivation modulo of its dependencies.
Fields§
§drv_path: StorePath§inner: UnverifiedDerivationImplementations§
Source§impl Derivation
impl Derivation
Sourcepub fn from_aterm_bytes<'i, L>(
name: &str,
lookup_fn: L,
b: &'i [u8],
) -> Result<Derivation, Error<&'i [u8]>>where
L: HashDerivationModuloLookup,
pub fn from_aterm_bytes<'i, L>(
name: &str,
lookup_fn: L,
b: &'i [u8],
) -> Result<Derivation, Error<&'i [u8]>>where
L: HashDerivationModuloLookup,
Parse a Derivation in ATerm serialization, and verify that it is valid
and that its output paths have been calculated correctly.
Use UnverifiedDerivation::from_aterm_bytes to parse without verifying this.
Sourcepub fn into_parts(self) -> (StorePath, DerivationBuilder, Outputs)
pub fn into_parts(self) -> (StorePath, DerivationBuilder, Outputs)
Split this Derivation into its constituent parts.
Sourcepub fn as_unverified(&self) -> &UnverifiedDerivation
pub fn as_unverified(&self) -> &UnverifiedDerivation
Return this Derivation as a UnverifiedDerivation.
Sourcepub fn into_unverified(self) -> UnverifiedDerivation
pub fn into_unverified(self) -> UnverifiedDerivation
Convert this Derivation into a UnverifiedDerivation.
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Return name of this derivation.
This is the name of the store path with the suffix .drv stripped.
Sourcepub fn recalculate_derivation_path(&self) -> Result<StorePath, DerivationError>
pub fn recalculate_derivation_path(&self) -> Result<StorePath, DerivationError>
Recalculate and return the derivation StorePath.
Sourcepub fn recalculate_outputs<L>(
&self,
lookup: L,
) -> Result<Outputs, DerivationError>where
L: HashDerivationModuloLookup,
pub fn recalculate_outputs<L>(
&self,
lookup: L,
) -> Result<Outputs, DerivationError>where
L: HashDerivationModuloLookup,
Recalculate and return the Outputs of this Derivation.
Methods from Deref<Target = UnverifiedDerivation>§
Sourcepub fn serialize(&self, writer: &mut impl Write) -> Result<(), Error>
pub fn serialize(&self, writer: &mut impl Write) -> Result<(), Error>
write the Derivation to the given std::io::Write, in ATerm format.
The only errors returned are from the passed in writer.
Sourcepub fn to_aterm_bytes(&self) -> Vec<u8> ⓘ
pub fn to_aterm_bytes(&self) -> Vec<u8> ⓘ
return the ATerm serialization.
Sourcepub fn calculate_derivation_path(
&self,
name: &str,
) -> Result<StorePath, DerivationError>
pub fn calculate_derivation_path( &self, name: &str, ) -> Result<StorePath, DerivationError>
Calculate and return the drv path of this UnverifiedDerivation.
The drv path is calculated by invoking store_path::build_text_path, using
the provided name with a .drv suffix added. All input_sources and
keys of input_derivations are used as references. And the ATerm string of
the UnverifiedDerivation is used as content.
Sourcepub fn fod_digest(&self) -> Option<Sha256>
pub fn fod_digest(&self) -> Option<Sha256>
Returns the FOD digest, if the derivation is fixed-output, or None if it’s not.
Sourcepub fn hash_derivation_modulo<L>(
&self,
lookup: L,
) -> Result<Sha256, DerivationError>where
L: HashDerivationModuloLookup,
pub fn hash_derivation_modulo<L>(
&self,
lookup: L,
) -> Result<Sha256, DerivationError>where
L: HashDerivationModuloLookup,
Calculates the hash derivation module of this UnverifiedDerivation.
Sourcepub fn recalculate_outputs<L>(
&self,
name: &str,
lookup: L,
) -> Result<Outputs, DerivationError>where
L: HashDerivationModuloLookup,
pub fn recalculate_outputs<L>(
&self,
name: &str,
lookup: L,
) -> Result<Outputs, DerivationError>where
L: HashDerivationModuloLookup,
Recalculate and return the Outputs of this UnverifiedDerivation.
Sourcepub fn command(&self) -> &str
pub fn command(&self) -> &str
Return builder to execute.
This is usually a path to bash.
NOTE: This is called builder in cppnix and in Nix code.
Sourcepub fn environment(&self) -> &BTreeMap<String, BString>
pub fn environment(&self) -> &BTreeMap<String, BString>
Return environment variables to include in build environmennt.
Sourcepub fn input_derivations(&self) -> &BTreeMap<StorePath, BTreeSet<OutputName>>
pub fn input_derivations(&self) -> &BTreeMap<StorePath, BTreeSet<OutputName>>
Map from drv path to output names used from this derivation.
Sourcepub fn input_sources(&self) -> &BTreeSet<StorePath>
pub fn input_sources(&self) -> &BTreeSet<StorePath>
Return plain store paths of additional inputs.
Trait Implementations§
Source§impl AsRef<UnverifiedDerivation> for Derivation
impl AsRef<UnverifiedDerivation> for Derivation
Source§fn as_ref(&self) -> &UnverifiedDerivation
fn as_ref(&self) -> &UnverifiedDerivation
Source§impl Clone for Derivation
impl Clone for Derivation
Source§fn clone(&self) -> Derivation
fn clone(&self) -> Derivation
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 Derivation
impl Debug for Derivation
Source§impl Deref for Derivation
impl Deref for Derivation
Source§impl From<Derivation> for UnverifiedDerivation
impl From<Derivation> for UnverifiedDerivation
Source§fn from(value: Derivation) -> Self
fn from(value: Derivation) -> Self
Source§impl PartialEq<&Derivation> for UnverifiedDerivation
impl PartialEq<&Derivation> for UnverifiedDerivation
Source§fn eq(&self, other: &&Derivation) -> bool
fn eq(&self, other: &&Derivation) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq<&UnverifiedDerivation> for Derivation
impl PartialEq<&UnverifiedDerivation> for Derivation
Source§fn eq(&self, other: &&UnverifiedDerivation) -> bool
fn eq(&self, other: &&UnverifiedDerivation) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq<Derivation> for UnverifiedDerivation
impl PartialEq<Derivation> for UnverifiedDerivation
Source§fn eq(&self, other: &Derivation) -> bool
fn eq(&self, other: &Derivation) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq<UnverifiedDerivation> for Derivation
impl PartialEq<UnverifiedDerivation> for Derivation
Source§fn eq(&self, other: &UnverifiedDerivation) -> bool
fn eq(&self, other: &UnverifiedDerivation) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq for Derivation
impl PartialEq for Derivation
Source§fn eq(&self, other: &Derivation) -> bool
fn eq(&self, other: &Derivation) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for Derivation
Available on crate feature serde only.
impl Serialize for Derivation
serde only.impl Eq for Derivation
impl StructuralPartialEq for Derivation
Auto Trait Implementations§
impl Freeze for Derivation
impl RefUnwindSafe for Derivation
impl Send for Derivation
impl Sync for Derivation
impl Unpin for Derivation
impl UnsafeUnpin for Derivation
impl UnwindSafe for Derivation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.