1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-19 00:39:37 +01:00

Change JSON derivation format to use ContentAddress JSON

Keeps it more consistent.
This commit is contained in:
John Ericson 2025-10-13 00:24:12 -04:00
parent 82a736bcbb
commit d7464ecd96
20 changed files with 52 additions and 44 deletions

View file

@ -1,7 +1,7 @@
{{#include derivation-v3-fixed.md}}
{{#include derivation-v4-fixed.md}}
<!--
## Raw Schema
[JSON Schema for Derivation v3](schema/derivation-v3.json)
[JSON Schema for Derivation v3](schema/derivation-v4.json)
-->

View file

@ -12,7 +12,7 @@ schemas = [
'file-system-object-v1',
'hash-v1',
'content-address-v1',
'derivation-v3',
'derivation-v4',
]
schema_files = files()

View file

@ -1,5 +1,5 @@
"$schema": http://json-schema.org/draft-04/schema#
"$id": https://nix.dev/manual/nix/latest/protocols/json/schema/derivation-v3.json
"$id": https://nix.dev/manual/nix/latest/protocols/json/schema/derivation-v4.json
title: Derivation
description: |
Experimental JSON representation of a Nix derivation (version 3).
@ -32,10 +32,10 @@ properties:
Used when calculating store paths for the derivations outputs.
version:
const: 3
const: 4
title: Format version (must be 3)
description: |
Must be `3`.
Must be `4`.
This is a guard that allows us to continue evolving this format.
The choice of `3` is fairly arbitrary, but corresponds to this informal version:
@ -47,6 +47,8 @@ properties:
- Version 3: Drop store dir from store paths, just include base name.
- Version 4: Use canonical content address JSON format for floating content addressed derivation outputs.
Note that while this format is experimental, the maintenance of versions is best-effort, and not promised to identify every change.
outputs:
@ -161,9 +163,11 @@ properties:
hashAlgo:
title: Hash algorithm
"$ref": "./hash-v1.yaml#/$defs/algorithm"
description: |
For an output which will be [content addressed], but the content address is not specified up front, the name of the hash algorithm used. When the content address is fixed, use `hash.hashAlgo` instead.
hash:
type: string
title: Expected hash value
description: |
For fixed-output derivations, the expected content hash in base-16.
For fixed-output derivations, the expected content hash.
"$ref": "./hash-v1.yaml"