feat(nix-compat/{aterm,derivation}): init parser

This provides a nom-based parser for Nix derivations in ATerm format,
which can be reached via `Derivation::from_aterm_bytes`.

Some of the lower-level ATerm primitives are moved into a (new) aterm
module, and some more higher-level ones that construct derivation-
specific types.

Also, move the escape_bytes function into there, this is a generic ATerm
thing.

Change-Id: I2b03b8a1461c7ea2fcb8640c2fc3d1fa3ea719fb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9730
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-07-31 15:46:39 +02:00 committed by clbot
parent 8b09ae54b1
commit 2410f2292f
14 changed files with 679 additions and 3 deletions

View file

@ -3,7 +3,7 @@
//!
//! [ATerm]: http://program-transformation.org/Tools/ATermFormat.html
use crate::derivation::escape::escape_bytes;
use crate::aterm::escape_bytes;
use crate::derivation::output::Output;
use bstr::BString;
use std::{