Provenance
- 1. Property
Build - 2. Property
Copied - 3. Property
Derivation - 4. Property
Flake - 5. Property
Subpath - 6. Property
Tree - 7. Property
Fetchurl - 8. Property
Unknown
Title: Provenance
| Type | combining |
| Required | No |
| Additional properties | Any type allowed |
Description: > Warning
This JSON format is currently experimental and subject to change.
Provenance describes where a store object came from, such as the derivation that built it, the flake output that produced that derivation, or the source tree that it was fetched from.
It appears in the provenance field of store object info, as shown by e.g. nix path-info --json.
A provenance record is a JSON object with a type field that determines what other fields are present.
Most types have a next field that contains the provenance of the thing from which this one was derived (or null if that isn’t known).
Thus, provenance forms a chain, going from the store object itself back to its ultimate origin.
For example, a store object substituted from a binary cache might have copied provenance, whose next is build provenance, whose next is derivation provenance, and so on.
Future versions of Nix may add new provenance types, and new fields to existing types.
Consumers should therefore accept provenance records with a type that they don’t recognise, and ignore fields that they don’t recognise.
Nix itself preserves records of unknown types unchanged.
1. Property Build
Title: Build
| Type | object |
| Required | No |
| Additional properties | Any type allowed |
| Defined in | #/$defs/build |
Description: The store object is an output of a derivation that was built locally or on a remote builder.
| Property | Type | Pattern | Title/Description |
|---|---|---|---|
| + type | enum (of string) | No | - |
| + drv | string | No | Derivation |
| + output | string | No | Output Name |
| - buildHost | Combination | No | Build Host |
| + system | string | No | System |
| - tags | object | No | Tags |
| - next | object | No | Next |
1.1. Property type
| Type | enum (of string) |
| Required | Yes |
Must be one of:
- “build”
1.2. Property drv
Title: Derivation
| Type | string |
| Required | Yes |
| Defined in | JSON format for StorePath |
Description: The store derivation that was built.
| Restrictions | |
|---|---|
| Min length | 34 |
| Must match regular expression | ^[0123456789abcdfghijklmnpqrsvwxyz]{32}-.+$ Test |
1.3. Property output
Title: Output Name
| Type | string |
| Required | Yes |
Description: The name of the derivation output that corresponds to this store object, e.g. out.
1.4. Property buildHost
Title: Build Host
| Type | combining |
| Required | No |
| Additional properties | Any type allowed |
Description: The hostname of the machine on which the derivation was built, or null if not known.
1.4.1. Property item 0
| Type | string |
| Required | No |
1.4.2. Property item 1
| Type | null |
| Required | No |
1.5. Property system
Title: System
| Type | string |
| Required | Yes |
Description: The system type of the derivation, e.g. x86_64-linux.
1.6. Property tags
Title: Tags
| Type | object |
| Required | No |
| Additional properties | Not allowed |
Description: User-defined key/value pairs from the build-provenance-tags setting on the build host, e.g. a CI job URL.
| Property | Type | Pattern | Title/Description |
|---|---|---|---|
| - ^[A-Za-z_][A-Za-z0-9_+-]*$ | string | Yes | - |
1.6.1. Pattern Property ^[A-Za-z_][A-Za-z0-9_+\-]*$
All properties whose name matches the regular expression
^[A-Za-z_][A-Za-z0-9_+\-]*$(Test) must respect the following conditions
| Type | string |
| Required | No |
1.7. Property next
Title: Next
| Type | combining |
| Required | No |
| Additional properties | Any type allowed |
| Defined in | #/$defs/next |
Description: The provenance of the derivation, typically of type derivation.
| One of(Option) |
|---|
| item 0 |
| Provenance |
1.7.1. Property item 0
| Type | null |
| Required | No |
1.7.2. Property Provenance
Title: Provenance
| Type | combining |
| Required | No |
| Additional properties | Any type allowed |
| Same definition as | Provenance |
Description: > Warning
This JSON format is currently experimental and subject to change.
Provenance describes where a store object came from, such as the derivation that built it, the flake output that produced that derivation, or the source tree that it was fetched from.
It appears in the provenance field of store object info, as shown by e.g. nix path-info --json.
A provenance record is a JSON object with a type field that determines what other fields are present.
Most types have a next field that contains the provenance of the thing from which this one was derived (or null if that isn’t known).
Thus, provenance forms a chain, going from the store object itself back to its ultimate origin.
For example, a store object substituted from a binary cache might have copied provenance, whose next is build provenance, whose next is derivation provenance, and so on.
Future versions of Nix may add new provenance types, and new fields to existing types.
Consumers should therefore accept provenance records with a type that they don’t recognise, and ignore fields that they don’t recognise.
Nix itself preserves records of unknown types unchanged.
2. Property Copied
Title: Copied
| Type | object |
| Required | No |
| Additional properties | Any type allowed |
| Defined in | #/$defs/copied |
Description: The store object was copied from another store, typically substituted from a binary cache.
| Property | Type | Pattern | Title/Description |
|---|---|---|---|
| + type | enum (of string) | No | - |
| + from | string | No | From |
| - next | object | No | Next |
2.1. Property type
| Type | enum (of string) |
| Required | Yes |
Must be one of:
- “copied”
2.2. Property from
Title: From
| Type | string |
| Required | Yes |
Description: The URL of the store from which the store object was copied.
2.3. Property next
Title: Next
| Type | combining |
| Required | No |
| Additional properties | Any type allowed |
| Same definition as | next |
Description: The provenance of the store object in the store from which it was copied.
3. Property Derivation
Title: Derivation
| Type | object |
| Required | No |
| Additional properties | Any type allowed |
| Defined in | #/$defs/derivation |
Description: The store object is a store derivation that was instantiated by builtins.derivationWithMeta.
| Property | Type | Pattern | Title/Description |
|---|---|---|---|
| + type | enum (of string) | No | - |
| + meta | object | No | Metadata |
| - next | object | No | Next |
3.1. Property type
| Type | enum (of string) |
| Required | Yes |
Must be one of:
- “derivation”
3.2. Property meta
Title: Metadata
| Type | object |
| Required | Yes |
| Additional properties | Any type allowed |
Description: The value of the __meta attribute passed to derivationWithMeta, converted to JSON.
3.3. Property next
Title: Next
| Type | combining |
| Required | No |
| Additional properties | Any type allowed |
| Same definition as | next |
Description: The provenance of the Nix expression that instantiated the derivation, typically of type flake.
4. Property Flake
Title: Flake
| Type | object |
| Required | No |
| Additional properties | Any type allowed |
| Defined in | #/$defs/flake |
Description: The thing was produced by evaluating a flake output.
| Property | Type | Pattern | Title/Description |
|---|---|---|---|
| + type | enum (of string) | No | - |
| + flakeOutput | string | No | Flake Output |
| - pure | boolean | No | Pure |
| - next | object | No | Next |
4.1. Property type
| Type | enum (of string) |
| Required | Yes |
Must be one of:
- “flake”
4.2. Property flakeOutput
Title: Flake Output
| Type | string |
| Required | Yes |
Description: The attribute path of the flake output that was evaluated, e.g. packages.x86_64-linux.default.
4.3. Property pure
Title: Pure
| Type | boolean |
| Required | No |
Description: Whether the flake output was evaluated in pure evaluation mode.
Defaults to true if absent.
4.4. Property next
Title: Next
| Type | combining |
| Required | No |
| Additional properties | Any type allowed |
| Same definition as | next |
Description: The provenance of the flake’s flake.nix file, typically of type subpath.
5. Property Subpath
Title: Subpath
| Type | object |
| Required | No |
| Additional properties | Any type allowed |
| Defined in | #/$defs/subpath |
Description: The thing is a file or directory inside another source tree.
| Property | Type | Pattern | Title/Description |
|---|---|---|---|
| + type | enum (of string) | No | - |
| + subpath | string | No | Subpath |
| - next | object | No | Next |
5.1. Property type
| Type | enum (of string) |
| Required | Yes |
Must be one of:
- “subpath”
5.2. Property subpath
Title: Subpath
| Type | string |
| Required | Yes |
Description: The absolute path of the file or directory within the source tree, e.g. /flake.nix.
5.3. Property next
Title: Next
| Type | combining |
| Required | No |
| Additional properties | Any type allowed |
| Same definition as | next |
Description: The provenance of the source tree, typically of type tree.
6. Property Tree
Title: Tree
| Type | object |
| Required | No |
| Additional properties | Any type allowed |
| Defined in | #/$defs/tree |
Description: The thing is a source tree fetched by a fetcher, e.g. a flake input.
6.1. Property type
| Type | enum (of string) |
| Required | Yes |
Must be one of:
- “tree”
6.2. Property attrs
Title: Attributes
| Type | object |
| Required | Yes |
| Additional properties | Each additional property must conform to the schema |
Description: The attributes of the locked input, as accepted by builtins.fetchTree, except narHash.
6.2.1. Property additionalProperties
| Type | string, integer or boolean |
| Required | No |
7. Property Fetchurl
Title: Fetchurl
| Type | object |
| Required | No |
| Additional properties | Any type allowed |
| Defined in | #/$defs/fetchurl |
Description: The store object was downloaded from a URL, e.g. by builtins.fetchurl.
7.1. Property type
| Type | enum (of string) |
| Required | Yes |
Must be one of:
- “fetchurl”
7.2. Property url
Title: URL
| Type | string |
| Required | Yes |
Description: The URL from which the store object was downloaded, with any credentials removed.
8. Property Unknown
Title: Unknown
| Type | object |
| Required | No |
| Additional properties | Any type allowed |
| Defined in | #/$defs/unknown |
Description: A provenance type not known to this version of Nix.
| Property | Type | Pattern | Title/Description |
|---|---|---|---|
| + type | Combination | No | - |
8.1. Property type
| Type | combining |
| Required | Yes |
8.1.1. Must not be
| Type | enum (of string) |
| Required | No |
Must be one of:
- “build”
- “copied”
- “derivation”
- “flake”
- “subpath”
- “tree”
- “fetchurl”
Examples
Build provenance
A store object built from a flake output, showing the full provenance chain back to the flake’s source tree:
{
"buildHost": "builder-1",
"drv": "lhj2ix9nrbw9wjab4ywsg9xvc86fm8in-hello-2.12.2.drv",
"next": {
"meta": {
"description": "Program that produces a familiar, friendly greeting",
"license": {
"free": true,
"spdxId": "GPL-3.0-or-later"
}
},
"next": {
"flakeOutput": "packages.x86_64-linux.default",
"next": {
"next": {
"attrs": {
"lastModified": 1760000000,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0b4defa2584313f3b781240b29d61f6f9f7e0df3",
"type": "github"
},
"type": "tree"
},
"subpath": "/flake.nix",
"type": "subpath"
},
"pure": true,
"type": "flake"
},
"type": "derivation"
},
"output": "out",
"system": "x86_64-linux",
"tags": {
"ci-job": "https://ci.example.org/jobs/1234"
},
"type": "build"
}
Copied provenance
A store object substituted from a binary cache:
{
"from": "https://cache.example.org",
"next": {
"buildHost": null,
"drv": "lhj2ix9nrbw9wjab4ywsg9xvc86fm8in-hello-2.12.2.drv",
"next": null,
"output": "out",
"system": "x86_64-linux",
"tags": {},
"type": "build"
},
"type": "copied"
}
Source file
A file inside a Git repository:
{
"next": {
"attrs": {
"lastModified": 1760000000,
"ref": "refs/heads/main",
"rev": "8f2b1c0d9e4a7b6c5d3e2f1a0b9c8d7e6f5a4b3c",
"revCount": 42,
"type": "git",
"url": "https://example.org/repo.git"
},
"type": "tree"
},
"subpath": "/builder.sh",
"type": "subpath"
}
Fetched URL
{
"type": "fetchurl",
"url": "https://ftp.gnu.org/gnu/hello/hello-2.12.2.tar.gz"
}