Home Explore Blog Models CI



nix

doc/manual/source/protocols/derivation-aterm.md
2b225adbab0f96f0c80ffbf4811a47230d488f191cf12097000000030000060e
# Derivation "ATerm" file format

For historical reasons, [store derivations][store derivation] are stored on-disk in [ATerm](https://homepages.cwi.nl/~daybuild/daily-books/technology/aterm-guide/aterm-guide.html) format.

## The ATerm format used

Derivations are serialised in one of the following formats:

- ```
  Derive(...)
  ```

  For all stable derivations.

- ```
  DrvWithVersion(<version-string>, ...)
  ```

  The only `version-string`s that are in use today are for [experimental features](@docroot@/development/experimental-features.md):

  - `"xp-dyn-drv"` for the [`dynamic-derivations`](@docroot@/development/experimental-features.md#xp-feature-dynamic-derivations) experimental feature.

## Use for encoding to store object

When derivation is encoded to a [store object] we make the following choices:

- The store path name is the derivation name with `.drv` suffixed at the end

  Indeed, the ATerm format above does *not* contain the name of the derivation, on the assumption that a store path will also be provided out-of-band.

- The derivation is content-addressed using the ["Text" method] of content-addressing derivations

Currently we always encode derivations to store object using the ATerm format (and the previous two choices),
but we reserve the option to encode new sorts of derivations differently in the future.


Chunks
c936b197 (1st chunk of `doc/manual/source/protocols/derivation-aterm.md`)
Title: Derivation Storage using ATerm Format
Summary
This document explains that derivation files are stored on-disk using the ATerm format. It details two main ATerm formats: `Derive(...)` for stable derivations and `DrvWithVersion(<version-string>, ...)` for experimental features like `dynamic-derivations`. When encoded into a store object, the derivation name is suffixed with `.drv`, and content-addressing uses the "Text" method. The document notes that while ATerm is currently the standard, future flexibility is reserved for different encoding methods.