Home Explore Blog CI



nix

2nd chunk of `doc/manual/source/protocols/store-path.md`
605b26fd1081fcf0b383718e75f033f49d4c3ffdf10b5e650000000100000826
    ["Nix Archive"](@docroot@/store/store-object/content-address.md#method-nix-archive)
    method of content addressing store objects,
    if the hash algorithm is [SHA-256].
    Just like in the "Text" case, we can have the store objects referenced by their paths.
    Additionally, we can have an optional `:self` label to denote self-reference.

  - ```ebnf
    | "output:" id
    ```

    For either the outputs built from derivations,
    or content-addressed store objects that are not using one of the two above cases.
    To be explicit about the latter, that is currently these methods:

    - ["Flat"](@docroot@/store/store-object/content-address.md#method-flat)
    - ["Git"](@docroot@/store/store-object/content-address.md#method-git)
    - ["Nix Archive"](@docroot@/store/store-object/content-address.md#method-nix-archive) if the hash algorithm is not [SHA-256].

    `id` is the name of the output (usually, "out").
    For content-addressed store objects, `id`, is always "out".

- `inner-digest` = base-16 representation of a SHA-256 hash of `inner-fingerprint`.
  The base-16 encoding uses lower-cased hex digits.

## Inner fingerprint

- `inner-fingerprint` = one of the following based on `type`:

  - if `type` = `"text:" ...`:

    the string written to the resulting store path.

  - if `type` = `"source:" ...`:

    the [Nix Archive (NAR)] serialization of the [file system object](@docroot@/store/file-system-object.md) of the store object.

  - if `type` = `"output:" id`:

    - For input-addressed derivation outputs:

      the [ATerm](@docroot@/protocols/derivation-aterm.md) serialization of the derivation modulo fixed output derivations.

    - For content-addressed store paths:

      ```ebnf
      "fixed:out:" rec algo ":" hash ":"
      ```

      where

      - `rec` = one of:

        - ```ebnf
          | ""
          ```
          (empty string) for hashes of the flat (single file) serialization

        - ```ebnf
          | "r:"
          ```
          hashes of the for [Nix Archive (NAR)] (arbitrary file system object) serialization

Title: Inner Fingerprint Calculation Based on Store Object Type
Summary
This section details how the `inner-fingerprint` is determined based on the `type` of store object. For 'text' types, it's the string written to the store path. For 'source' types, it's the Nix Archive (NAR) serialization of the file system object. For 'output' types with input-addressed derivation outputs, it's the ATerm serialization of the derivation. For content-addressed store paths of 'output' type, it follows a 'fixed:out: rec algo : hash' format, where 'rec' indicates the serialization method (empty string for flat, 'r:' for NAR), 'algo' specifies the hash algorithm, and 'hash' is the actual hash value.