diff options
author | Florian Klink <flokli@flokli.de> | 2023-10-15T08·29+0100 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-10-16T12·23+0000 |
commit | 8934b34489290886b4bdddc4b5949d0c955f86e7 (patch) | |
tree | 2761109b633bb08bea21274ab8c6b554f1e1fa76 /tvix/nix-compat/src/derivation/parse_error.rs | |
parent | 2410f2292f53a17242ed54b0af2d7b04ec3173f6 (diff) |
fix(nix-compat/derivation): handle dups r/6832
This now properly checks for duplicate output names in input derivation output names, and duplicate input sources. Change-Id: I0053854bfbf504f4f511fb3fe1a77a82b3aa61dd Reviewed-on: https://cl.tvl.fyi/c/depot/+/9738 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Diffstat (limited to 'tvix/nix-compat/src/derivation/parse_error.rs')
-rw-r--r-- | tvix/nix-compat/src/derivation/parse_error.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tvix/nix-compat/src/derivation/parse_error.rs b/tvix/nix-compat/src/derivation/parse_error.rs index a064d4faba7b..34a9c9fd9204 100644 --- a/tvix/nix-compat/src/derivation/parse_error.rs +++ b/tvix/nix-compat/src/derivation/parse_error.rs @@ -6,15 +6,23 @@ use crate::nixhash; pub type NomResult<I, O> = IResult<I, O, NomError<I>>; -#[derive(Debug, PartialEq)] +#[derive(Debug, thiserror::Error, PartialEq)] pub enum ErrorKind { - // duplicate key in map + /// duplicate key in map + #[error("duplicate map key: {0}")] DuplicateMapKey(String), - // Digest parsing error + /// Input derivation has two outputs with the same name + #[error("duplicate output name {1} for input derivation {0}")] + DuplicateInputDerivationOutputName(String, String), + + #[error("duplicate input source: {0}")] + DuplicateInputSource(String), + + #[error("nix hash error: {0}")] NixHashError(nixhash::Error), - // error kind wrapped from native nom errors + #[error("nom error: {0:?}")] Nom(nom::error::ErrorKind), } |