pub struct UnverifiedDerivation {
builder: DerivationBuilder,
outputs: Outputs,
}Expand description
A derivation with its output paths filled out but not verified.
This is used for working with serialized versions of the derivation
without having to go through the hash derivation modulo verification
required by Derivation.
UnverifiedDerivation has getters for values, is not mutable and does
have output paths defined using Outputs. Those output paths are
possibly loaded from somewhere else and are not guaranteed to have been
verified to match the content of the derivation. When a derivation is
deserialized from either ATerm format or via serde this is the returned type.
Fields§
§builder: DerivationBuilder§outputs: OutputsImplementations§
Source§impl UnverifiedDerivation
impl UnverifiedDerivation
Sourcepub fn verify<L>(
self,
name: &str,
lookup_fn: L,
) -> Result<Derivation, DerivationError>where
L: HashDerivationModuloLookup,
pub fn verify<L>(
self,
name: &str,
lookup_fn: L,
) -> Result<Derivation, DerivationError>where
L: HashDerivationModuloLookup,
Verify and consume this UnverifiedDerivation and return the Derivation.
It requires the name and lookup function to be passed in, as it verifies the outputs to have been calculated correctly and also calculates the drvPath.
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 from_aterm_bytes(b: &[u8]) -> Result<Self, Error<&[u8]>>
pub fn from_aterm_bytes(b: &[u8]) -> Result<Self, Error<&[u8]>>
Parse an Derivation in ATerm serialization, and validate it passes our set of validations. This one does not validate output store paths to be calculated correctly.
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 into_parts(self) -> (DerivationBuilder, Outputs)
pub fn into_parts(self) -> (DerivationBuilder, Outputs)
Split this UnverifiedDerivation into its constituent parts.
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 UnverifiedDerivation
impl Clone for UnverifiedDerivation
Source§fn clone(&self) -> UnverifiedDerivation
fn clone(&self) -> UnverifiedDerivation
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 UnverifiedDerivation
impl Debug for UnverifiedDerivation
Source§impl DerivationAsyncExt for UnverifiedDerivation
Available on crate feature async only.
impl DerivationAsyncExt for UnverifiedDerivation
async only.Source§async fn from_streaming_aterm_bytes<R>(
reader: R,
) -> Result<UnverifiedDerivation, Error<Vec<u8>>>
async fn from_streaming_aterm_bytes<R>( reader: R, ) -> Result<UnverifiedDerivation, Error<Vec<u8>>>
Source§impl<'d> Deserialize<'d> for UnverifiedDerivation
Available on crate feature serde only.
impl<'d> Deserialize<'d> for UnverifiedDerivation
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'d>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'d>,
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 UnverifiedDerivation
impl PartialEq for UnverifiedDerivation
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 Serialize for UnverifiedDerivation
Available on crate feature serde only.
impl Serialize for UnverifiedDerivation
serde only.Source§impl TryFrom<BasicDerivation> for UnverifiedDerivation
Available on crate feature daemon only.
impl TryFrom<BasicDerivation> for UnverifiedDerivation
daemon only.Source§type Error = DerivationError
type Error = DerivationError
impl Eq for UnverifiedDerivation
impl StructuralPartialEq for UnverifiedDerivation
Auto Trait Implementations§
impl Freeze for UnverifiedDerivation
impl RefUnwindSafe for UnverifiedDerivation
impl Send for UnverifiedDerivation
impl Sync for UnverifiedDerivation
impl Unpin for UnverifiedDerivation
impl UnsafeUnpin for UnverifiedDerivation
impl UnwindSafe for UnverifiedDerivation
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.