docs(reference/nix-daemon-protocol): migrate
This moves the daemon protocol reference to the "Reference" section in
our new docs.
It also updates them a bit, we now use `{{< relref "path/to/file.md" >}}`
to refer to other files, and fixes the (previously broken) references
in handshake.md.
Change-Id: I114e40622dc504e7a5f75946895900e797a1e722
Reviewed-on: https://cl.snix.dev/c/snix/+/30273
Autosubmit: Florian Klink <flokli@flokli.de>
Tested-by: besadii
Reviewed-by: Brian Olsen <brian@maven-group.org>
This commit is contained in:
parent
76250b354f
commit
8101e7a45f
10 changed files with 165 additions and 79 deletions
|
|
@ -5,7 +5,7 @@ summary: ""
|
|||
date: 2023-09-07T16:12:37+02:00
|
||||
lastmod: 2023-09-07T16:12:37+02:00
|
||||
draft: false
|
||||
weight: 900
|
||||
weight: 50
|
||||
toc: true
|
||||
sidebar:
|
||||
collapsed: true
|
||||
|
|
|
|||
11
web/content/docs/reference/nix-daemon-protocol/_index.md
Normal file
11
web/content/docs/reference/nix-daemon-protocol/_index.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
title: Nix Daemon Protocol
|
||||
slug: nix-daemon-protocol
|
||||
description: ""
|
||||
summary: ""
|
||||
date: 2025-03-24T13:10:37+02:00
|
||||
lastmod: 2025-03-24T13:10:37+02:00
|
||||
draft: false
|
||||
weight: 50
|
||||
toc: true
|
||||
---
|
||||
221
web/content/docs/reference/nix-daemon-protocol/changelog.md
Normal file
221
web/content/docs/reference/nix-daemon-protocol/changelog.md
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
---
|
||||
title: Changelog
|
||||
slug: Changelog
|
||||
description: ""
|
||||
summary: ""
|
||||
date: 2025-03-24T13:10:37+02:00
|
||||
lastmod: 2025-03-24T13:10:37+02:00
|
||||
draft: false
|
||||
weight: 55
|
||||
toc: true
|
||||
---
|
||||
|
||||
This page tracks the different protocol versions and corresponding Nix versions,
|
||||
as well as when certain [Operations][operations] have been introduced or
|
||||
deprecated.
|
||||
|
||||
Different "function signatures" are tracked on the [Operations][operations] page
|
||||
as well.
|
||||
|
||||
## Nix version protocol
|
||||
|
||||
| Nix version | Protocol |
|
||||
| --------------- | -------- |
|
||||
| 0.11 | 1.02 |
|
||||
| 0.12 | 1.04 |
|
||||
| 0.13 | 1.05 |
|
||||
| 0.14 | 1.05 |
|
||||
| 0.15 | 1.05 |
|
||||
| 0.16 | 1.06 |
|
||||
| 1.0 | 1.10 |
|
||||
| 1.1 | 1.11 |
|
||||
| 1.2 | 1.12 |
|
||||
| 1.3 - 1.5.3 | 1.13 |
|
||||
| 1.6 - 1.10 | 1.14 |
|
||||
| 1.11 - 1.11.16 | 1.15 |
|
||||
| 2.0 - 2.0.4 | 1.20 |
|
||||
| 2.1 - 2.3.18 | 1.21 |
|
||||
| 2.4 - 2.6.1 | 1.32 |
|
||||
| 2.7.0 | 1.33 |
|
||||
| 2.8.0 - 2.14.1 | 1.34 |
|
||||
| 2.15.0 - 2.19.4 | 1.35 |
|
||||
| 2.20.0 - 2.22.0 | 1.37 |
|
||||
|
||||
In commit [be64fbb501][be64fbb501] support was droped for protocol versions older than 1.10.
|
||||
This happened when the protocol was between 1.17 and 1.18 and was released with Nix 2.0.
|
||||
So this means that any version of Nix 2.x can't talk to Nix 0.x.
|
||||
|
||||
## Operation History
|
||||
|
||||
| Op | Id | Commit | Protocol | Nix Version | Notes |
|
||||
| --------------- | -- | -------------- | -------- | ----------- | ----- |
|
||||
| *Quit | 0 | [a711689368][a711689368] || 0.11 | Became dead code in [7951c3c54][7951c3c54] (Nix 0.11) and removed in [d3c61d83b][d3c61d83b] (Nix 1.8) |
|
||||
| IsValidPath | 1 | [a711689368][a711689368] || 0.11 ||
|
||||
| HasSubstitutes | 3 | [0565b5f2b3][0565b5f2b3] || 0.11 | Obsolete [09a6321aeb][09a6321aeb]<br>Nix 1.2 Protocol 1.12 |
|
||||
| QueryPathHash | 4 | [0565b5f2b3][0565b5f2b3] || 0.11 | Obsolete [e0204f8d46][e0204f8d46]<br>Nix 2.0 Protocol 1.16 |
|
||||
| QueryReferences | 5 | [0565b5f2b3][0565b5f2b3] || 0.11 | Obsolete [e0204f8d46][e0204f8d46]<br>Nix 2.0 Protocol 1.16 |
|
||||
| QueryReferrers | 6 | [0565b5f2b3][0565b5f2b3] || 0.11 ||
|
||||
| AddToStore | 7 | [0263279071][0263279071] || 0.11 ||
|
||||
| AddTextToStore | 8 | [0263279071][0263279071] || 0.11 | Obsolete [c602ebfb34][c602ebfb34]<br>Nix 2.4 Protocol 1.25 |
|
||||
| BuildPaths | 9 | [0565b5f2b3][0565b5f2b3] || 0.11 ||
|
||||
| EnsurePath | 10 | [0565b5f2b3][0565b5f2b3] || 0.11 ||
|
||||
| AddTempRoot | 11 | [e25fad691a][e25fad691a] || 0.11 ||
|
||||
| AddIndirectRoot | 12 | [74033a844f][74033a844f] || 0.11 ||
|
||||
| SyncWithGC | 13 | [e25fad691a][e25fad691a] || 0.11 | Obsolete [9947f1646a][9947f1646a]<br> Nix 2.5.0 Protocol 1.32 |
|
||||
| FindRoots | 14 | [29cf434a35][29cf434a35] || 0.11 ||
|
||||
| *CollectGarbage | 15 | [a9c4f66cfb][a9c4f66cfb] || 0.11 | Removed [a72709afd8][a72709afd8]<br>Nix 0.12 Protocol 1.02 |
|
||||
| ExportPath | 16 | [0f5da8a83c][0f5da8a83c] || 0.11 | Obsolete [538a64e8c3][538a64e8c3]<br>Nix 2.0 Protocol 1.17 |
|
||||
| *ImportPath | 17 | [0f5da8a83c][0f5da8a83c] || 0.11 | Removed [273b288a7e][273b288a7e]<br>Nix 1.0 Protocol 1.09 |
|
||||
| QueryDeriver | 18 | [6d1a1191b0][6d1a1191b0] || 0.11 | Obsolete [e0204f8d46][e0204f8d46]<br>Nix 2.0 Protocol 1.16 |
|
||||
| SetOptions | 19 | [f3441e6122][f3441e6122] || 0.11 ||
|
||||
| CollectGarbage | 20 | [a72709afd8][a72709afd8] | 1.02 | 0.12 ||
|
||||
| QuerySubstitutablePathInfo | 21 | [03427e76f1][03427e76f1] | 1.02 | 0.12 | Obsolete Nix 1.2 Protocol 1.12 |
|
||||
| QueryDerivationOutputs | 22 | [e42401ee7b][e42401ee7b] | 1.05 | 1.0 | Obsolete [d38f860c3e][d38f860c3e]<br>Nix 2.4 Protocol 1.22* |
|
||||
| QueryAllValidPaths | 23 | [24035b98b1][24035b98b1] | 1.05 | 1.0 ||
|
||||
| *QueryFailedPaths | 24 | [f92c9a0ac5][f92c9a0ac5] | 1.05 | 1.0 | Removed [8cffec848][8cffec848]<br>Nix 2.0 Protocol 1.16 |
|
||||
| *ClearFailedPaths | 25 | [f92c9a0ac5][f92c9a0ac5] | 1.05 | 1.0 | Removed [8cffec848][8cffec848]<br>Nix 2.0 Protocol 1.16 |
|
||||
| QueryPathInfo | 26 | [1db6259076][1db6259076] | 1.06 | 1.0 ||
|
||||
| ImportPaths | 27 | [273b288a7e][273b288a7e] | 1.09 | 1.0 | Obsolete [538a64e8c3][538a64e8c3]<br>Nix 2.0 Protocol 1.17 |
|
||||
| QueryDerivationOutputNames | 28 | [af2e53fd48][af2e53fd48]<br>([194d21f9f6][194d21f9f6]) | 1.08 | 1.0 | Obsolete<br>[045b07200c][045b07200c]<br>Nix 2.4 Protocol 1.21 |
|
||||
| QueryPathFromHashPart | 29 | [ccc52adfb2][ccc52adfb2] | 1.11 | 1.1 ||
|
||||
| QuerySubstitutablePathInfos | 30 | [eb3036da87][eb3036da87] | 1.12* | 1.2 | Obsolete Nix 2.0, Protocol 1.19*|
|
||||
| QueryValidPaths | 31 | [58ef4d9a95][58ef4d9a95] | 1.12 | 1.2 ||
|
||||
| QuerySubstitutablePaths | 32 | [09a6321aeb][09a6321aeb] | 1.12 | 1.2 ||
|
||||
| QueryValidDerivers | 33 | [2754a07ead][2754a07ead] | 1.13* | 1.3 ||
|
||||
| OptimiseStore | 34 | [8fb8c26b6d][2754a07ead] | 1.14 | 1.8 ||
|
||||
| VerifyStore | 35 | [b755752f76][b755752f76] | 1.14 | 1.9 ||
|
||||
| BuildDerivation | 36 | [71a5161365][71a5161365] | 1.14 | 1.10 ||
|
||||
| AddSignatures | 37 | [d0f5719c2a][d0f5719c2a] | 1.16 | 2.0 ||
|
||||
| NarFromPath | 38 | [b4b5e9ce2f][b4b5e9ce2f] | 1.17 | 2.0 ||
|
||||
| AddToStoreNar | 39 | [584f8a62de][584f8a62de] | 1.17 | 2.0 ||
|
||||
| QueryMissing | 40 | [ba20730b3f][ba20730b3f] | 1.19* | 2.0 ||
|
||||
| QueryDerivationOutputMap | 41 | [d38f860c3e][d38f860c3e] | 1.22* | 2.4 ||
|
||||
| RegisterDrvOutput | 42 | [58cdab64ac][58cdab64ac] | 1.27 | 2.4 ||
|
||||
| QueryRealisation | 43 | [58cdab64ac][58cdab64ac] | 1.27 | 2.4 ||
|
||||
| AddMultipleToStore | 44 | [fe1f34fa60][fe1f34fa60] | 1.32* | 2.4 ||
|
||||
| AddBuildLog | 45 | [4dda1f92aa][4dda1f92aa] | 1.32 | 2.6.0 ||
|
||||
| BuildPathsWithResults | 46 | [a4604f1928][a4604f1928] | 1.34* | 2.8.0 ||
|
||||
| AddPermRoot | 47 | [226b0f3956][226b0f3956] | 1.36* | 2.20.0 ||
|
||||
|
||||
Notes: Ops that start with * have been removed.
|
||||
Protocol version that ends with * was bumped while adding that operation. Otherwise protocol version referes to the protocol version at the time the operation was added (so only at the next protocol version can you assume the operation is present/removed/obsolete since it was added/removed/obsoleted between protocol versions).
|
||||
|
||||
## Protocol version change log
|
||||
|
||||
- 1.01 [f3441e6122][f3441e6122] Initial Version
|
||||
- 1.02 [c370755583][c370755583] Use build hook
|
||||
- 1.03 [db4f4a8425][db4f4a8425] Backward compatibility check
|
||||
- 1.04 [96598e7b06][96598e7b06] SetOptions buildVerbosity
|
||||
- 1.05 [60ec75048a][60ec75048a] SetOptions useAtime & maxAtime
|
||||
- 1.06 [6846ed8b44][6846ed8b44] SetOptions buildCores
|
||||
- 1.07 [bdf089f463][bdf089f463] QuerySubstitutablePathInfo narSize
|
||||
- 1.08 [b1eb252172][b1eb252172] STDERR_ERROR exit status
|
||||
- 1.09 [e0bd307802][e0bd307802] ImportPath not supported on versions older than 1.09
|
||||
- 1.10 [db5b86ef13][db5b86ef13] SetOptions build-use-substitutess
|
||||
- 1.11 [4bc4da331a][4bc4da331a] open connection reserveSpace
|
||||
- 1.12 [eb3036da87][eb3036da87] Implement QuerySubstitutablePathInfos
|
||||
- 1.13 [2754a07ead][2754a07ead] Implement QueryValidDerivers
|
||||
- 1.14 [a583a2bc59][a583a2bc59] open connection cpu affinity
|
||||
- 1.15 [d1e3bf01bc][d1e3bf01bc] BuildPaths buildMode
|
||||
- 1.16 [9cee600c88][9cee600c88] QueryPathInfo ultimate & sigs
|
||||
- 1.17 [ddea253ff8][ddea253ff8] QueryPathInfo returns valid bool
|
||||
- 1.18 [4b8f1b0ec0][4b8f1b0ec0] Select between AddToStoreNar and ImportPaths
|
||||
- 1.19 [ba20730b3f][ba20730b3f] Implement QueryMissing
|
||||
- 1.20 [cfc8132391][cfc8132391] Don't send activity and result logs to old clients
|
||||
- 1.21 [6185d25e52][6185d25e52] AddToStoreNar uses TunnelLogger for data
|
||||
- 1.22 [d38f860c3e][d38f860c3e] Implement QueryDerivationOutputMap and obsolete QueryDerivationOutputs
|
||||
- 1.23 [4c0077a07d][4c0077a07d] AddToStoreNar uses FramedSink/-Source for data
|
||||
- 1.24 [5ccd94501d][5ccd94501d] Allow trustless building of CA derivations
|
||||
- 1.25 [e34fe47d0c][e34fe47d0c] New implementation of AddToStore
|
||||
- 1.26 [c43e882f54][c43e882f54] STDERR_ERROR serialize exception
|
||||
- 1.27 [3a63fc6cd5][3a63fc6cd5] QueryValidPaths substitute flag
|
||||
- 1.28 [27b5747ca7][27b5747ca7] BuildDerivation returns builtOutputs
|
||||
- 1.29 [9d309de0de][9d309de0de] BuildDerivation returns timesBuilt, isNonDeterministic, startTime & stopTime
|
||||
- 1.30 [e5951a6b2f][e5951a6b2f] Bump version number for DerivedPath changes
|
||||
- 1.31 [a8416866cf][a8416866cf] RegisterDrvOutput & QueryRealisation send realisations as JSON
|
||||
- 1.32 [fe1f34fa60][fe1f34fa60] Implement AddMultipleToStore
|
||||
- 1.33 [35dbdbedd4][35dbdbedd4] open connection sends nix version
|
||||
- 1.34 [a4604f1928][a4604f1928] Implement BuildPathsWithResults
|
||||
- 1.35 [9207f94582][9207f94582] open connection sends trusted option
|
||||
- 1.36 [226b0f3956][226b0f3956] Implement AddPermRoot
|
||||
- 1.37 [1e3d811840][1e3d811840] Serialize BuildResult send cpuUser & cpuSystem
|
||||
|
||||
|
||||
|
||||
[0263279071]: https://github.com/NixOS/nix/commit/0263279071
|
||||
[03427e76f1]: https://github.com/NixOS/nix/commit/03427e76f1
|
||||
[045b07200c]: https://github.com/NixOS/nix/commit/045b07200c
|
||||
[0565b5f2b3]: https://github.com/NixOS/nix/commit/0565b5f2b3
|
||||
[09a6321aeb]: https://github.com/NixOS/nix/commit/09a6321aeb
|
||||
[0f5da8a83c]: https://github.com/NixOS/nix/commit/0f5da8a83c
|
||||
[194d21f9f6]: https://github.com/NixOS/nix/commit/194d21f9f6
|
||||
[1db6259076]: https://github.com/NixOS/nix/commit/1db6259076
|
||||
[1e3d811840]: https://github.com/NixOS/nix/commit/1e3d811840
|
||||
[24035b98b1]: https://github.com/NixOS/nix/commit/24035b98b1
|
||||
[226b0f3956]: https://github.com/NixOS/nix/commit/226b0f3956
|
||||
[273b288a7e]: https://github.com/NixOS/nix/commit/273b288a7e
|
||||
[2754a07ead]: https://github.com/NixOS/nix/commit/2754a07ead
|
||||
[27b5747ca7]: https://github.com/NixOS/nix/commit/27b5747ca7
|
||||
[29cf434a35]: https://github.com/NixOS/nix/commit/29cf434a35
|
||||
[35dbdbedd4]: https://github.com/NixOS/nix/commit/35dbdbedd4
|
||||
[3a63fc6cd5]: https://github.com/NixOS/nix/commit/3a63fc6cd5
|
||||
[4b8f1b0ec0]: https://github.com/NixOS/nix/commit/4b8f1b0ec0
|
||||
[4bc4da331a]: https://github.com/NixOS/nix/commit/4bc4da331a
|
||||
[4c0077a07d]: https://github.com/NixOS/nix/commit/4c0077a07d
|
||||
[4dda1f92aa]: https://github.com/NixOS/nix/commit/4dda1f92aa
|
||||
[538a64e8c3]: https://github.com/NixOS/nix/commit/538a64e8c3
|
||||
[584f8a62de]: https://github.com/NixOS/nix/commit/584f8a62de
|
||||
[58cdab64ac]: https://github.com/NixOS/nix/commit/58cdab64ac
|
||||
[58ef4d9a95]: https://github.com/NixOS/nix/commit/58ef4d9a95
|
||||
[5ccd94501d]: https://github.com/NixOS/nix/commit/5ccd94501d
|
||||
[60ec75048a]: https://github.com/NixOS/nix/commit/60ec75048a
|
||||
[6185d25e52]: https://github.com/NixOS/nix/commit/6185d25e52
|
||||
[6846ed8b44]: https://github.com/NixOS/nix/commit/6846ed8b44
|
||||
[6d1a1191b0]: https://github.com/NixOS/nix/commit/6d1a1191b0
|
||||
[71a5161365]: https://github.com/NixOS/nix/commit/71a5161365
|
||||
[74033a844f]: https://github.com/NixOS/nix/commit/74033a844f
|
||||
[7951c3c54]: https://github.com/NixOS/nix/commit/7951c3c54
|
||||
[8cffec848]: https://github.com/NixOS/nix/commit/8cffec848
|
||||
[8fb8c26b6d]: https://github.com/NixOS/nix/commit/8fb8c26b6d
|
||||
[9207f94582]: https://github.com/NixOS/nix/commit/9207f94582
|
||||
[96598e7b06]: https://github.com/NixOS/nix/commit/96598e7b06
|
||||
[9947f1646a]: https://github.com/NixOS/nix/commit/9947f1646a
|
||||
[9cee600c88]: https://github.com/NixOS/nix/commit/9cee600c88
|
||||
[9d309de0de]: https://github.com/NixOS/nix/commit/9d309de0de
|
||||
[a4604f1928]: https://github.com/NixOS/nix/commit/a4604f1928
|
||||
[a583a2bc59]: https://github.com/NixOS/nix/commit/a583a2bc59
|
||||
[a711689368]: https://github.com/NixOS/nix/commit/a711689368
|
||||
[a72709afd8]: https://github.com/NixOS/nix/commit/a72709afd8
|
||||
[a8416866cf]: https://github.com/NixOS/nix/commit/a8416866cf
|
||||
[a9c4f66cfb]: https://github.com/NixOS/nix/commit/a9c4f66cfb
|
||||
[af2e53fd48]: https://github.com/NixOS/nix/commit/af2e53fd48
|
||||
[b1eb252172]: https://github.com/NixOS/nix/commit/b1eb252172
|
||||
[b4b5e9ce2f]: https://github.com/NixOS/nix/commit/b4b5e9ce2f
|
||||
[b755752f76]: https://github.com/NixOS/nix/commit/b755752f76
|
||||
[ba20730b3f]: https://github.com/NixOS/nix/commit/ba20730b3f
|
||||
[bdf089f463]: https://github.com/NixOS/nix/commit/bdf089f463
|
||||
[be64fbb501]: https://github.com/NixOS/nix/commit/be64fbb501
|
||||
[c370755583]: https://github.com/NixOS/nix/commit/c370755583
|
||||
[c43e882f54]: https://github.com/NixOS/nix/commit/c43e882f54
|
||||
[c602ebfb34]: https://github.com/NixOS/nix/commit/c602ebfb34
|
||||
[ccc52adfb2]: https://github.com/NixOS/nix/commit/ccc52adfb2
|
||||
[cfc8132391]: https://github.com/NixOS/nix/commit/cfc8132391
|
||||
[d0f5719c2a]: https://github.com/NixOS/nix/commit/d0f5719c2a
|
||||
[d1e3bf01bc]: https://github.com/NixOS/nix/commit/d1e3bf01bc
|
||||
[d38f860c3e]: https://github.com/NixOS/nix/commit/d38f860c3e
|
||||
[d3c61d83b]: https://github.com/NixOS/nix/commit/d3c61d83b
|
||||
[db4f4a8425]: https://github.com/NixOS/nix/commit/db4f4a8425
|
||||
[db5b86ef13]: https://github.com/NixOS/nix/commit/db5b86ef13
|
||||
[ddea253ff8]: https://github.com/NixOS/nix/commit/ddea253ff8
|
||||
[e0204f8d46]: https://github.com/NixOS/nix/commit/e0204f8d46
|
||||
[e0bd307802]: https://github.com/NixOS/nix/commit/e0bd307802
|
||||
[e25fad691a]: https://github.com/NixOS/nix/commit/e25fad691a
|
||||
[e34fe47d0c]: https://github.com/NixOS/nix/commit/e34fe47d0c
|
||||
[e42401ee7b]: https://github.com/NixOS/nix/commit/e42401ee7b
|
||||
[e5951a6b2f]: https://github.com/NixOS/nix/commit/e5951a6b2f
|
||||
[eb3036da87]: https://github.com/NixOS/nix/commit/eb3036da87
|
||||
[f3441e6122]: https://github.com/NixOS/nix/commit/f3441e6122
|
||||
[f92c9a0ac5]: https://github.com/NixOS/nix/commit/f92c9a0ac5
|
||||
[fe1f34fa60]: https://github.com/NixOS/nix/commit/fe1f34fa60
|
||||
|
||||
[operations]: {{< relref "operations.md" >}}
|
||||
49
web/content/docs/reference/nix-daemon-protocol/handshake.md
Normal file
49
web/content/docs/reference/nix-daemon-protocol/handshake.md
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
title: Handshake
|
||||
slug: handshake
|
||||
description: ""
|
||||
summary: ""
|
||||
date: 2025-03-24T13:10:37+02:00
|
||||
lastmod: 2025-03-24T13:10:37+02:00
|
||||
draft: false
|
||||
weight: 51
|
||||
toc: true
|
||||
---
|
||||
|
||||
When connecting, the handshake sequence documented below must be performed, so
|
||||
client and server can agree on a protocol version to use and exchange some
|
||||
parameters.
|
||||
|
||||
## client -> server
|
||||
- 0x6e697863 :: [Int](#se-Int) (hardcoded, 'nixc' in ASCII)
|
||||
|
||||
## client <- server
|
||||
- 0x6478696f :: [Int](#se-Int) (hardcoded, 'dxio' in ASCII)
|
||||
- protocolVersion :: [Int](#se-Int)
|
||||
|
||||
## client -> server
|
||||
- clientVersion :: [Int](#se-Int)
|
||||
|
||||
### If clientVersion is 1.14 or later
|
||||
- sendCpu :: [Bool](#se-Bool) (hardcoded to false in client)
|
||||
#### If sendCpu is true
|
||||
- cpuAffinity :: [Int](#se-Int) (obsolete and ignored)
|
||||
|
||||
### If clientVersion is 1.11 or later
|
||||
- reserveSpace :: [Bool](#se-Bool) (obsolete, ignored and set to false)
|
||||
|
||||
|
||||
## client <- server
|
||||
|
||||
### If clientVersion is 1.33 or later
|
||||
- nixVersion :: String
|
||||
|
||||
### If clientVersion is 1.35 or later
|
||||
- trusted :: OptTrusted
|
||||
|
||||
## client <- server
|
||||
- send logs
|
||||
- [operation]({{< relref "operations.md" >}}) :: [Int](#se-Int)
|
||||
|
||||
[se-Int]: {{< relref "serialization.md" >}}#int
|
||||
[se-Bool]: {{< relref "serialization.md" >}}#bool
|
||||
25
web/content/docs/reference/nix-daemon-protocol/intro.md
Normal file
25
web/content/docs/reference/nix-daemon-protocol/intro.md
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
title: Intro
|
||||
slug: Intro
|
||||
description: ""
|
||||
summary: ""
|
||||
date: 2025-03-24T13:10:37+02:00
|
||||
lastmod: 2025-03-24T13:10:37+02:00
|
||||
draft: false
|
||||
weight: 50
|
||||
toc: true
|
||||
---
|
||||
|
||||
The Nix Daemon protocol is what's used to communicate with the `nix-daemon`,
|
||||
either on the local system (in which case the communication happens via a Unix
|
||||
domain socket), or with a remote Nix (in which this is tunneled over SSH).
|
||||
|
||||
It uses a custom binary format which isn't too documented. This reference here
|
||||
aims to serve as an in-depth documentation about some of the inner workings,
|
||||
data types etc.
|
||||
|
||||
A first implementation of this exists in
|
||||
[griff/Nix.rs](https://github.com/griff/Nix.rs/tree/main).
|
||||
|
||||
Work is underway to port / factor this out into reusable building blocks into
|
||||
the [nix-compat](https://snix.dev//rustdoc/nix_compat/index.html) crate.
|
||||
135
web/content/docs/reference/nix-daemon-protocol/logging.md
Normal file
135
web/content/docs/reference/nix-daemon-protocol/logging.md
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
---
|
||||
title: Logging
|
||||
slug: logging
|
||||
description: ""
|
||||
summary: ""
|
||||
date: 2025-03-24T13:10:37+02:00
|
||||
lastmod: 2025-03-24T13:10:37+02:00
|
||||
draft: false
|
||||
weight: 54
|
||||
toc: true
|
||||
---
|
||||
|
||||
Because the daemon protocol only has one sender stream and one receiver stream
|
||||
logging messages need to be carefully interleaved with requests and responses.
|
||||
Usually this means that after the operation and all of its inputs (the request)
|
||||
has been read logging hijacks the sender stream (in the server case) and uses
|
||||
it to send typed logging messages while the request is being processed. When
|
||||
the response has been generated it will send `STDERR_LAST` to mark that what
|
||||
follows is the response data to the request. If the request failed a
|
||||
`STDERR_ERROR` message is sent with the error and no response is sent.
|
||||
|
||||
While not in this state between request reading and response sending all
|
||||
messages and activities are buffered until next time the logger can send data.
|
||||
|
||||
The logging messages supported are:
|
||||
- [`STDERR_LAST`](#stderr_last)
|
||||
- [`STDERR_ERROR`](#stderr_error)
|
||||
- [`STDERR_NEXT`](#stderr_next)
|
||||
- [`STDERR_READ`](#stderr_read)
|
||||
- [`STDERR_WRITE`](#stderr_write)
|
||||
- [`STDERR_START_ACTIVITY`](#stderr_start_activity)
|
||||
- [`STDERR_STOP_ACTIVITY`](#stderr_stop_activity)
|
||||
- [`STDERR_RESULT`](#stderr_result)
|
||||
|
||||
|
||||
### `STDERR_LAST`
|
||||
Marks the end of the logs, normal processing can resume.
|
||||
|
||||
- 0x616c7473 :: [UInt64][se-UInt64] (hardcoded, 'alts' in ASCII)
|
||||
|
||||
|
||||
### `STDERR_ERROR`
|
||||
This also marks the end of this log "session" and so it
|
||||
has the same effect as `STDERR_LAST`.
|
||||
On the client the error is thrown as an exception and no response is read.
|
||||
|
||||
#### If protocol version is 1.26 or newer
|
||||
- 0x63787470 :: [UInt64][se-UInt64] (hardcoded, 'cxtp' in ASCII)
|
||||
- error :: [Error][se-Error]
|
||||
|
||||
#### If protocol version is older than 1.26
|
||||
- 0x63787470 :: [UInt64][se-UInt64] (hardcoded, 'cxtp' in ASCII)
|
||||
- msg :: [String][se-String] (If logger is JSON, invalid UTF-8 is replaced with U+FFFD)
|
||||
- exitStatus :: [Int][se-Int]
|
||||
|
||||
|
||||
### `STDERR_NEXT`
|
||||
Normal string log message.
|
||||
|
||||
- 0x6f6c6d67 :: [UInt64][se-UInt64] (hardcoded, 'olmg' in ASCII)
|
||||
- msg :: [String][se-String] (If logger is JSON, invalid UTF-8 is replaced with U+FFFD)
|
||||
|
||||
|
||||
### `STDERR_READ`
|
||||
Reader interface used by ImportsPaths and AddToStoreNar (between 1.21 and 1.23).
|
||||
It works by sending a *desired* buffer length and then on the receiver stream it
|
||||
reads the *actual* buffer length followed by a bytes buffer of that length padded to
|
||||
8 bytes. If it receives 0 bytes it sees this as an unexpected EOF.
|
||||
|
||||
- 0x64617461 :: [UInt64][se-UInt64] (hardcoded, 'data' in ASCII)
|
||||
- desiredLen :: [Size][se-Size]
|
||||
|
||||
|
||||
### `STDERR_WRITE`
|
||||
Writer interface used by ExportPath. Simply writes a buffer.
|
||||
|
||||
- 0x64617416 :: [UInt64][se-UInt64] (hardcoded)
|
||||
- buffer :: [Bytes][se-Bytes]
|
||||
|
||||
|
||||
### `STDERR_START_ACTIVITY`
|
||||
Begins an activity. In other tracing frameworks this would be called a span.
|
||||
|
||||
Implemented in protocol 1.20. To achieve backwards compatible with older
|
||||
versions of the protocol instead of sending an `STDERR_START_ACTIVITY`
|
||||
the level is checked against enabled logging level and the text field is
|
||||
sent as a simple log message with `STDERR_NEXT`.
|
||||
|
||||
- 0x53545254 :: [UInt64][se-UInt64] (hardcoded, 'STRT' in ASCII)
|
||||
- act :: [UInt64][se-UInt64]
|
||||
- level :: [Verbosity][se-Verbosity]
|
||||
- type :: [ActivityType][se-ActivityType]
|
||||
- text :: [String][se-String] (If logger is JSON, invalid UTF-8 is replaced with U+FFFD)
|
||||
- fields :: [List][se-List] of [Field][se-Field]
|
||||
- parent :: [UInt64][se-UInt64]
|
||||
|
||||
|
||||
act is atomic (nextId++ + (getPid() << 32))
|
||||
|
||||
|
||||
### `STDERR_STOP_ACTIVITY`
|
||||
Stops the given activity. The activity id should not send any more results.
|
||||
Just sends `ActivityId`.
|
||||
|
||||
Implemented in protocol 1.20. When backwards compatible with older versions of
|
||||
the protocol and this message would have been sent it is instead ignored.
|
||||
|
||||
- 0x53544f50 :: [UInt64][se-UInt64] (hardcoded, 'STOP' in ASCII)
|
||||
- act :: [UInt64][se-UInt64]
|
||||
|
||||
|
||||
### `STDERR_RESULT`
|
||||
Sends results for a given activity.
|
||||
|
||||
Implemented in protocol 1.20. When backwards compatible with older versions of
|
||||
the protocol and this message would have been sent it is instead ignored.
|
||||
|
||||
- 0x52534c54 :: [UInt64][se-UInt64] (hardcoded, 'RSLT' in ASCII)
|
||||
- act :: [UInt64][se-UInt64]
|
||||
- type :: [ResultType][se-ResultType]
|
||||
- fields :: [List][se-List] of [Field][se-Field]
|
||||
|
||||
|
||||
|
||||
[se-UInt64]: ./serialization.md#uint64
|
||||
[se-Int]: ./serialization.md#int
|
||||
[se-Size]: ./serialization.md#size
|
||||
[se-Verbosity]: ./serialization.md#verbosity
|
||||
[se-ActivityType]: ./serialization.md#activitytype
|
||||
[se-ResultType]: ./serialization.md#resulttype
|
||||
[se-Bytes]: ./serialization.md#bytes
|
||||
[se-String]: ./serialization.md#string
|
||||
[se-List]: ./serialization.md#list-of-x
|
||||
[se-Error]: ./serialization.md#error
|
||||
[se-Field]: ./serialization.md#field
|
||||
916
web/content/docs/reference/nix-daemon-protocol/operations.md
Normal file
916
web/content/docs/reference/nix-daemon-protocol/operations.md
Normal file
|
|
@ -0,0 +1,916 @@
|
|||
---
|
||||
title: Operations
|
||||
slug: operations
|
||||
description: ""
|
||||
summary: ""
|
||||
date: 2025-03-24T13:10:37+02:00
|
||||
lastmod: 2025-03-24T13:10:37+02:00
|
||||
draft: false
|
||||
weight: 53
|
||||
toc: true
|
||||
---
|
||||
|
||||
These page describes the different operations a client can request, as well as
|
||||
its expected input and output types.
|
||||
|
||||
| Operation | Id |
|
||||
| ----------------------------------------------------------- | -- |
|
||||
| [IsValidPath](#isvalidpath) | 1 |
|
||||
| [QueryReferrers](#queryreferrers) | 6 |
|
||||
| [AddToStore](#addtostore) | 7 |
|
||||
| [BuildPaths](#buildpaths) | 9 |
|
||||
| [EnsurePath](#ensurepath) | 10 |
|
||||
| [AddTempRoot](#addtemproot) | 11 |
|
||||
| [AddIndirectRoot](#addindirectroot) | 12 |
|
||||
| [FindRoots](#findroots) | 14 |
|
||||
| [SetOptions](#setoptions) | 19 |
|
||||
| [CollectGarbage](#collectgarbage) | 20 |
|
||||
| [QueryAllValidPaths](#queryallvalidpaths) | 23 |
|
||||
| [QueryPathInfo](#querypathinfo) | 26 |
|
||||
| [QueryPathFromHashPart](#querypathfromhashpart) | 29 |
|
||||
| [QueryValidPaths](#queryvalidpaths) | 31 |
|
||||
| [QuerySubstitutablePaths](#querysubstitutablepaths) | 32 |
|
||||
| [QueryValidDerivers](#queryvalidderivers) | 33 |
|
||||
| [OptimiseStore](#optimisestore) | 34 |
|
||||
| [VerifyStore](#verifystore) | 35 |
|
||||
| [BuildDerivation](#buildderivation) | 36 |
|
||||
| [AddSignatures](#addsignatures) | 37 |
|
||||
| [NarFromPath](#narfrompath) | 38 |
|
||||
| [AddToStoreNar](#addtostore) | 39 |
|
||||
| [QueryMissing](#querymissing) | 40 |
|
||||
| [QueryDerivationOutputMap](#queryderivationoutputmap) | 41 |
|
||||
| [RegisterDrvOutput](#registerdrvoutput) | 42 |
|
||||
| [QueryRealisation](#queryrealisation) | 43 |
|
||||
| [AddMultipleToStore](#addmultipletostore) | 44 |
|
||||
| [AddBuildLog](#addbuildlog) | 45 |
|
||||
| [BuildPathsWithResults](#buildpathswithresults) | 46 |
|
||||
| [AddPermRoot](#addpermroot) | 47 |
|
||||
|
||||
|
||||
## Obsolete operations
|
||||
|
||||
| Operation | Id |
|
||||
| ----------------------------------------------------------- | -- |
|
||||
| [HasSubstitutes](#hassubstitutes) | 3 |
|
||||
| [QueryPathHash](#querypathhash) | 4 |
|
||||
| [QueryReferences](#queryreferences) | 5 |
|
||||
| [AddTextToStore](#addtexttostore) | 8 |
|
||||
| [SyncWithGC](#syncwithgc) | 13 |
|
||||
| [ExportPath](#exportpath) | 16 |
|
||||
| [QueryDeriver](#queryderiver) | 18 |
|
||||
| [QuerySubstitutablePathInfo](#querysubstitutablepathinfo) | 21 |
|
||||
| [QueryDerivationOutputs](#queryderivationoutputs) | 22 |
|
||||
| [ImportPaths](#importpaths) | 27 |
|
||||
| [QueryDerivationOutputNames](#queryderivationoutputnames) | 28 |
|
||||
| [QuerySubstitutablePathInfos](#querysubstitutablepathinfos) | 30 |
|
||||
|
||||
|
||||
## Removed operations
|
||||
|
||||
| Operation | Id |
|
||||
| ------------------------------------------------- | -- |
|
||||
| [Quit](#quit-removed) | 0 |
|
||||
| [ImportPath](#importpath-removed) | 17 |
|
||||
| [Old CollectGarbage](#old-collectgarbage-removed) | 15 |
|
||||
| [QueryFailedPaths](#queryfailedpaths) | 24 |
|
||||
| [ClearFailedPaths](#clearfailedpaths) | 25 |
|
||||
|
||||
|
||||
|
||||
## Quit (removed)
|
||||
|
||||
**Id:** 0<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
**Removed:** Became dead code in Nix 0.11 and removed in Nix 1.8
|
||||
|
||||
|
||||
## IsValidPath
|
||||
|
||||
**Id:** 1<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
|
||||
As the name says checks that a store path is valid i.e. in the store.
|
||||
|
||||
This is a pretty core operation used everywhere.
|
||||
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath]
|
||||
|
||||
### Outputs
|
||||
isValid :: [Bool][se-Bool]
|
||||
|
||||
|
||||
## HasSubstitutes
|
||||
|
||||
**Id:** 3<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
**Obsolete** Protocol 1.12, Nix 1.2<br>
|
||||
|
||||
Replaced by QuerySubstitutablePaths.
|
||||
|
||||
Checks if we can substitute the input path from a substituter. Uses
|
||||
QuerySubstitutablePaths under the hood :/
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath]
|
||||
|
||||
### Outputs
|
||||
hasSubstitutes :: [Bool][se-Bool]
|
||||
|
||||
|
||||
## QueryPathHash
|
||||
|
||||
**Id:** 4<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
**Obsolete:** Protocol 1.16, Nix 2.0<br>
|
||||
|
||||
Retrieves the base16 NAR hash of a given store path.
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath]
|
||||
|
||||
### Outputs
|
||||
hash :: [NARHash][se-NARHash]
|
||||
|
||||
|
||||
## QueryReferences
|
||||
|
||||
**Id:** 5<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
**Obsolete:** Protocol 1.16, Nix 2.0<br>
|
||||
|
||||
Retrieves the references of a given path
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath]
|
||||
|
||||
### Outputs
|
||||
references :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
|
||||
|
||||
## QueryReferrers
|
||||
|
||||
**Id:** 6<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
|
||||
Retrieves the referrers of a given path.
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath]
|
||||
|
||||
### Outputs
|
||||
referrers :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
|
||||
|
||||
## AddToStore
|
||||
|
||||
**Id:** 7<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
|
||||
Add a new path to the store.
|
||||
|
||||
### Before protocol version 1.25
|
||||
#### Inputs
|
||||
- baseName :: [StorePathName][se-StorePathName]
|
||||
- fixed :: [Bool64][se-Bool64]
|
||||
- recursive :: [FileIngestionMethod][se-FileIngestionMethod]
|
||||
- hashAlgo :: [HashAlgorithm][se-HashAlgorithm]
|
||||
- NAR dump
|
||||
|
||||
If fixed is `true`, hashAlgo is forced to `sha256` and recursive is forced to
|
||||
`NixArchive`.
|
||||
|
||||
Only `Flat` and `NixArchive` values are supported for the recursive input
|
||||
parameter.
|
||||
|
||||
#### Outputs
|
||||
path :: [StorePath][se-StorePath]
|
||||
|
||||
### Protocol version 1.25 or newer
|
||||
#### Inputs
|
||||
- name :: [StorePathName][se-StorePathName]
|
||||
- camStr :: [ContentAddressMethodWithAlgo][se-ContentAddressMethodWithAlgo]
|
||||
- refs :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
- repairBool :: [Bool64][se-Bool64]
|
||||
- [Framed][se-Framed] NAR dump
|
||||
|
||||
#### Outputs
|
||||
info :: [ValidPathInfo][se-ValidPathInfo]
|
||||
|
||||
|
||||
## AddTextToStore
|
||||
|
||||
**Id:** 8<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
**Obsolete:** Protocol 1.25, Nix 2.4
|
||||
|
||||
Add a text file as a store path.
|
||||
|
||||
This was obsoleted by adding the functionality implemented by this operation
|
||||
to [AddToStore](#addtostore). And so this corresponds to calling
|
||||
[AddToStore](#addtostore) with `camStr` set to `text:sha256` and `text`
|
||||
wrapped as a NAR.
|
||||
|
||||
### Inputs
|
||||
- suffix :: [StorePathName][se-StorePathName]
|
||||
- text :: [Bytes][se-Bytes]
|
||||
- refs :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
|
||||
### Outpus
|
||||
path :: [StorePath][se-StorePath]
|
||||
|
||||
|
||||
## BuildPaths
|
||||
|
||||
**Id:** 9<br>
|
||||
****Introduced:**** Nix 0.11<br>
|
||||
|
||||
Build (or substitute) a list of derivations.
|
||||
|
||||
### Inputs
|
||||
paths :: [Set][se-Set] of [DerivedPath][se-DerivedPath]
|
||||
|
||||
#### Protocol 1.15 or newer
|
||||
mode :: [BuildMode][se-BuildMode] (defaults to Normal)
|
||||
|
||||
Check that connection is trusted before allowing Repair mode.
|
||||
|
||||
### Outputs
|
||||
1 :: [Int][se-Int] (hardcoded and ignored by client)
|
||||
|
||||
|
||||
## EnsurePath
|
||||
|
||||
**Id:** 10<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
|
||||
Checks if a path is valid. Note: it may be made valid by running a substitute.
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath]
|
||||
|
||||
### Outputs
|
||||
1 :: [Int][se-Int] (hardcoded and ignored by client)
|
||||
|
||||
|
||||
## AddTempRoot
|
||||
|
||||
**Id:** 11<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
|
||||
Creates a temporary GC root for the given store path.
|
||||
|
||||
Temporary GC roots are valid only for the life of the connection and are used
|
||||
primarily to prevent the GC from pulling the rug out from under the client and
|
||||
deleting store paths that the client is actively doing something with.
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath]
|
||||
|
||||
### Outputs
|
||||
1 :: [Int][se-Int] (hardcoded and ignored by client)
|
||||
|
||||
|
||||
## AddIndirectRoot
|
||||
|
||||
**Id:** 12<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
|
||||
Add an indirect root, which is a weak reference to the user-facing symlink
|
||||
created by [AddPermRoot](#addpermroot).
|
||||
|
||||
Only ever sent on the local unix socket nix daemon.
|
||||
|
||||
### Inputs
|
||||
path :: [Path][se-Path]
|
||||
|
||||
### Outputs
|
||||
1 :: [Int][se-Int] (hardcoded and ignored by client)
|
||||
|
||||
|
||||
## SyncWithGC
|
||||
|
||||
**Id:** 13<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
**Obsolete:** Protocol 1.32, Nix 2.5.0
|
||||
|
||||
Acquire the global GC lock, then immediately release it. This function must be
|
||||
called after registering a new permanent root, but before exiting. Otherwise,
|
||||
it is possible that a running garbage collector doesn't see the new root and
|
||||
deletes the stuff we've just built. By acquiring the lock briefly, we ensure
|
||||
that either:
|
||||
|
||||
- The collector is already running, and so we block until the
|
||||
collector is finished. The collector will know about our
|
||||
*temporary* locks, which should include whatever it is we
|
||||
want to register as a permanent lock.
|
||||
- The collector isn't running, or it's just started but hasn't
|
||||
acquired the GC lock yet. In that case we get and release
|
||||
the lock right away, then exit. The collector scans the
|
||||
permanent root and sees ours.
|
||||
|
||||
In either case the permanent root is seen by the collector.
|
||||
|
||||
Was made obsolete by using [AddTempRoot](#addtemproot) to accomplish the same
|
||||
thing.
|
||||
|
||||
|
||||
## FindRoots
|
||||
|
||||
**Id:** 14<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
|
||||
Find the GC roots.
|
||||
|
||||
### Outputs
|
||||
roots :: [Map][se-Map] of [Path][se-Path] to [StorePath][se-StorePath]
|
||||
|
||||
The key is the link pointing to the given store path.
|
||||
|
||||
|
||||
## Old CollectGarbage (removed)
|
||||
|
||||
**Id:** 15<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
**Removed:** Protocol 1.02, Nix 0.12<br>
|
||||
|
||||
|
||||
## ExportPath
|
||||
|
||||
**Id:** 16<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
**Obsolete:** Protocol 1.17, Nix 2.0<br>
|
||||
|
||||
Export a store path in the binary format nix-store --import expects. See implementation there https://github.com/NixOS/nix/blob/db3bf180a569cb20db42c5e4669d2277be6f46b6/src/libstore/export-import.cc#L29 for more details.
|
||||
|
||||
### Inputs
|
||||
- path :: [StorePath][se-StorePath]
|
||||
- sign :: [Int][se-Int] (ignored and hardcoded to 0 in client)
|
||||
|
||||
### Outputs
|
||||
Uses [`STDERR_WRITE`](./logging.md#stderr_write) to send dump in
|
||||
[export format][se-ExportFormat]
|
||||
|
||||
After dump it outputs.
|
||||
|
||||
1 :: [Int][se-Int] (hardcoded)
|
||||
|
||||
|
||||
## ImportPath (removed)
|
||||
|
||||
**Id:** 17<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
**Removed:** Protocol 1.09, Nix 1.0<br>
|
||||
|
||||
|
||||
## QueryDeriver
|
||||
|
||||
**Id:** 18<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
**Obsolete:** Protocol 1.16, Nix 2.0<br>
|
||||
|
||||
Returns the store path of the derivation for a given store path.
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath]
|
||||
|
||||
### Outputs
|
||||
deriver :: [OptStorePath][se-OptStorePath]
|
||||
|
||||
|
||||
## SetOptions
|
||||
|
||||
**Id:** 19<br>
|
||||
**Introduced:** Nix 0.11<br>
|
||||
|
||||
Sends client options to the remote side.
|
||||
|
||||
Only ever used right after the handshake.
|
||||
|
||||
### Inputs
|
||||
|
||||
- keepFailed :: [Bool][se-Bool]
|
||||
- keepGoing :: [Bool][se-Bool]
|
||||
- tryFallback :: [Bool][se-Bool]
|
||||
- verbosity :: [Verbosity][se-Verbosity]
|
||||
- maxBuildJobs :: [Int][se-Int]
|
||||
- maxSilentTime :: [Time][se-Time]
|
||||
- useBuildHook :: [Bool][se-Bool] (ignored and hardcoded to true in client)
|
||||
- verboseBuild :: [Verbosity][se-Verbosity]
|
||||
- logType :: [Int][se-Int] (ignored and hardcoded to 0 in client)
|
||||
- printBuildTrace :: [Int][se-Int] (ignored and hardcoded to 0 in client)
|
||||
- buildCores :: [Int][se-Int]
|
||||
- useSubstitutes :: [Bool][se-Bool]
|
||||
|
||||
### Protocol 1.12 or newer
|
||||
otherSettings :: [Map][se-Map] of [String][se-String] to [String][se-String]
|
||||
|
||||
|
||||
## CollectGarbage
|
||||
|
||||
**Id:** 20<br>
|
||||
**Introduced:** Protocol 1.02, Nix 0.12<br>
|
||||
|
||||
Find the GC roots.
|
||||
|
||||
### Inputs
|
||||
- action :: [GCAction][se-GCAction]
|
||||
- pathsToDelete :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
- ignoreLiveness :: [Bool64][se-Bool64]
|
||||
- maxFreed :: [UInt64][se-UInt64]
|
||||
- removed :: [Int][se-Int] (ignored and hardcoded to 0 in client)
|
||||
- removed :: [Int][se-Int] (ignored and hardcoded to 0 in client)
|
||||
- removed :: [Int][se-Int] (ignored and hardcoded to 0 in client)
|
||||
|
||||
### Outputs
|
||||
- pathsDeleted :: [Set][se-Set] of [Path][se-Path]
|
||||
- bytesFreed :: [UInt64][se-UInt64]
|
||||
- 0 :: [UInt64][se-UInt64] (hardcoded, obsolete and ignored by client)
|
||||
|
||||
Depending on the value of the action input the value of output pathsDeleted
|
||||
is either, the GC roots, or the paths that would be or have been deleted.
|
||||
|
||||
|
||||
## QuerySubstitutablePathInfo
|
||||
|
||||
**Id:** 21<br>
|
||||
**Introduced:** Protocol 1.02, Nix 0.12<br>
|
||||
**Obsolete:** Protocol 1.12, Nix 1.2<br>
|
||||
|
||||
Retrieves the various substitutable paths infos for a given path.
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath]
|
||||
|
||||
### Outputs
|
||||
found :: [Bool][se-Bool]
|
||||
|
||||
#### If found is true
|
||||
- info :: [SubstitutablePathInfo][se-SubstitutablePathInfo]
|
||||
|
||||
|
||||
## QueryDerivationOutputs
|
||||
|
||||
**Id:** 22<br>
|
||||
**Introduced:** Protocol 1.05, Nix 1.0<br>
|
||||
**Obsolete:** Protocol 1.22*, Nix 2.4<br>
|
||||
|
||||
Retrieves all the outputs paths of a given derivation.
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath] (must point to a derivation)
|
||||
|
||||
### Outputs
|
||||
derivationOutputs :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
|
||||
|
||||
## QueryAllValidPaths
|
||||
|
||||
**Id:** 23<br>
|
||||
**Introduced:** Protocol 1.05, Nix 1.0<br>
|
||||
|
||||
Retrieves all the valid paths contained in the store.
|
||||
|
||||
### Outputs
|
||||
paths :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
|
||||
|
||||
## QueryFailedPaths (removed)
|
||||
|
||||
**Id:** 24<br>
|
||||
**Introduced:** Protocol 1.05, Nix 1.0<br>
|
||||
**Removed:** Protocol 1.16, Nix 2.0<br>
|
||||
|
||||
Failed build caching API only ever used by Hydra.
|
||||
|
||||
|
||||
## ClearFailedPaths (removed)
|
||||
|
||||
**Id:** 25<br>
|
||||
**Introduced:** Protocol 1.05, Nix 1.0<br>
|
||||
**Removed:** Protocol 1.16, Nix 2.0<br>
|
||||
|
||||
Failed build caching API only ever used by Hydra.
|
||||
|
||||
|
||||
## QueryPathInfo
|
||||
|
||||
**Id:** 26<br>
|
||||
**Introduced:** Protocol 1.06, Nix 1.0<br>
|
||||
|
||||
Retrieves the pathInfo for a given path.
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath]
|
||||
|
||||
### Outputs
|
||||
|
||||
#### If protocol version is 1.17 or newer
|
||||
success :: [Bool64][se-Bool64]
|
||||
|
||||
##### If success is true
|
||||
pathInfo :: [UnkeyedValidPathInfo][se-UnkeyedValidPathInfo]
|
||||
|
||||
#### If protocol version is older than 1.17
|
||||
If info not found return error with [`STDERR_ERROR`](./logging.md#stderr_error)
|
||||
|
||||
pathInfo :: [UnkeyedValidPathInfo][se-UnkeyedValidPathInfo]
|
||||
|
||||
|
||||
## ImportPaths
|
||||
|
||||
**Id:** 27<br>
|
||||
**Introduced:** Protocol 1.09, Nix 1.0<br>
|
||||
**Obsolete:** Protocol 1.17, Nix 2.0<br>
|
||||
|
||||
Older way of adding a store path to the remote store.
|
||||
|
||||
It was obsoleted and replaced by AddToStoreNar because it sends the NAR
|
||||
before the metadata about the store path and so you would typically have
|
||||
to store the NAR in memory or temporarily on disk before processing it.
|
||||
|
||||
### Inputs
|
||||
[List of NAR dumps][se-ImportPaths] coming from one or more ExportPath operations.
|
||||
|
||||
### Outputs
|
||||
importedPaths :: [List][se-List] of [StorePath][se-StorePath]
|
||||
|
||||
|
||||
## QueryDerivationOutputNames
|
||||
|
||||
**Id:** 28<br>
|
||||
**Introduced:** Protocol 1.08, Nix 1.0<br>
|
||||
**Obsolete:** Protocol 1.21, Nix 2.4<br>
|
||||
|
||||
Retrieves the name of the outputs of a given derivation. EG. out, dev, etc.
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath] (must be a derivation path)
|
||||
|
||||
### Outputs
|
||||
names :: [Set][se-Set] of [OutputName][se-OutputName]
|
||||
|
||||
|
||||
## QueryPathFromHashPart
|
||||
|
||||
**Id:** 29<br>
|
||||
**Introduced:** Protocol 1.11, Nix 1.1<br>
|
||||
|
||||
Retrieves a store path from a nixbase32 (input) hash.
|
||||
|
||||
### Inputs
|
||||
hashPart :: [StorePathHash][se-StorePathHash]
|
||||
|
||||
### Outputs
|
||||
path :: [OptStorePath][se-OptStorePath]
|
||||
|
||||
|
||||
## QuerySubstitutablePathInfos
|
||||
|
||||
**Id:** 30<br>
|
||||
**Introduced:** Protocol 1.12*, Nix 1.2<br>
|
||||
**Obsolete:** Protocol 1.19*, Nix 2.0<br>
|
||||
|
||||
Retrieves the various substitutable paths infos for set of store paths.
|
||||
|
||||
Only ever used in the fallback for QueryMissing which means that if protocol is 1.19 or later
|
||||
it is never sent and is therefore obsolete after that.
|
||||
|
||||
### Inputs
|
||||
#### If protocol version is 1.22 or newer
|
||||
paths :: [Map][se-Map] of [StorePath][se-StorePath] to [OptContentAddress][se-OptContentAddress]
|
||||
|
||||
#### If protocol version older than 1.22
|
||||
paths :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
|
||||
### Outputs
|
||||
infos :: [Map][se-Map] of [StorePath][se-StorePath] to [SubstitutablePathInfo][se-SubstitutablePathInfo]
|
||||
|
||||
|
||||
## QueryValidPaths
|
||||
|
||||
**Id:** 31<br>
|
||||
**Introduced:** Protocol 1.12, Nix 1.2<br>
|
||||
|
||||
Takes a list of store paths and returns a new list only containing the valid store paths
|
||||
|
||||
## Inputs
|
||||
paths :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
|
||||
### If protocol version is 1.27 or newer
|
||||
substitute :: [Bool][se-Bool] (defaults to false if not sent)
|
||||
|
||||
## Outputs
|
||||
paths :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
|
||||
|
||||
## QuerySubstitutablePaths
|
||||
|
||||
**Id:** 32<br>
|
||||
**Introduced:** Protocol 1.12, Nix 1.2<br>
|
||||
|
||||
Takes a set of store path, returns a filtered new set of paths that can be
|
||||
substituted.
|
||||
|
||||
In versions of the protocol prior to 1.12 [HasSubstitutes](#hassubstitutes)
|
||||
is used to implement the functionality that this operation provides.
|
||||
|
||||
### Inputs
|
||||
paths :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
|
||||
### Outputs
|
||||
paths :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
|
||||
|
||||
## QueryValidDerivers
|
||||
|
||||
**Id:** 33<br>
|
||||
**Introduced:** Protocol 1.13*, Nix 1.3<br>
|
||||
|
||||
Retrieves the derivers of a given path.
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath]
|
||||
|
||||
### Outputs
|
||||
derivers :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
|
||||
|
||||
## OptimiseStore
|
||||
|
||||
**Id:** 34<br>
|
||||
**Introduced:** Protocol 1.14, Nix 1.8<br>
|
||||
|
||||
Optimise store by hardlinking files with the same content.
|
||||
|
||||
### Outputs
|
||||
1 :: [Int][se-Int] (hardcoded and ignored by client)
|
||||
|
||||
|
||||
## VerifyStore
|
||||
|
||||
**Id:** 35<br>
|
||||
**Introduced:** Protocol 1.14, Nix 1.9<br>
|
||||
|
||||
Verify store either only db and existence of path or entire contents of store
|
||||
paths against the NAR hash.
|
||||
|
||||
### Inputs
|
||||
- checkContents :: [Bool64][se-Bool64]
|
||||
- repair :: [Bool64][se-Bool64]
|
||||
|
||||
### Outputs
|
||||
errors :: [Bool][se-Bool]
|
||||
|
||||
|
||||
## BuildDerivation
|
||||
|
||||
**Id:** 36<br>
|
||||
**Introduced:** Protocol 1.14, Nix 1.10<br>
|
||||
|
||||
Main build operation used when remote building.
|
||||
|
||||
When functioning as a remote builder this operation is used instead of
|
||||
BuildPaths so that it doesn't have to send the entire tree of derivations
|
||||
to the remote side first before it can start building. What this does
|
||||
instead is have a reduced version of the derivation to be built sent as
|
||||
part of its input and then only building that derivation.
|
||||
|
||||
The paths required by the build need to be part of the remote store
|
||||
(by copying with AddToStoreNar or substituting) before this operation is
|
||||
called.
|
||||
|
||||
### Inputs
|
||||
- drvPath :: [StorePath][se-StorePath]
|
||||
- drv :: [BasicDerivation][se-BasicDerivation]
|
||||
- buildMode :: [BuildMode][se-BuildMode]
|
||||
|
||||
### Outputs
|
||||
buildResult :: [BuildResult][se-BuildResult]
|
||||
|
||||
|
||||
## AddSignatures
|
||||
|
||||
**Id:** 37<br>
|
||||
**Introduced:** Protocol 1.16, Nix 2.0<br>
|
||||
|
||||
Add the signatures associated to a given path. Used by `nix store copy-sigs` and `nix store sign`.
|
||||
|
||||
### Inputs
|
||||
- path :: [StorePath][se-StorePath]
|
||||
- signatures :: [Set][se-Set] of [Signature][se-Signature]
|
||||
|
||||
### Outputs
|
||||
1 :: [Int][se-Int] (hardcoded and ignored by client)
|
||||
|
||||
|
||||
## NarFromPath
|
||||
|
||||
**Id:** 38<br>
|
||||
**Introduced:** Protocol 1.17, Nix 2.0<br>
|
||||
|
||||
Main way of getting the contents of a store path to the client.
|
||||
|
||||
As the name suggests this is done by sending a NAR file.
|
||||
|
||||
It replaced the now obsolete ExportPath operation and is used by newer clients to
|
||||
implement the export functionality for cli. It is also used when remote building
|
||||
to transfer build results from remote builder to client.
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath]
|
||||
|
||||
### Outputs
|
||||
NAR dumped straight to the stream.
|
||||
|
||||
|
||||
## AddToStoreNar
|
||||
|
||||
**Id:** 39<br>
|
||||
**Introduced:** Protocol 1.17, Nix 2.0<br>
|
||||
|
||||
Dumps a path as a NAR
|
||||
|
||||
### Inputs
|
||||
- path :: [StorePath][se-StorePath]
|
||||
- deriver :: [OptStorePath][se-OptStorePath]
|
||||
- narHash :: [NARHash][se-NARHash]
|
||||
- references :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
- registrationTime :: [Time][se-Time]
|
||||
- narSize :: [UInt64][se-UInt64]
|
||||
- ultimate :: [Bool64][se-Bool64]
|
||||
- signatures :: [Set][se-Set] of [Signature][se-Signature]
|
||||
- ca :: [OptContentAddress][se-OptContentAddress]
|
||||
- repair :: [Bool64][se-Bool64]
|
||||
- dontCheckSigs :: [Bool64][se-Bool64]
|
||||
|
||||
#### If protocol version is 1.23 or newer
|
||||
[Framed][se-Framed] NAR dump
|
||||
|
||||
#### If protocol version is between 1.21 and 1.23
|
||||
NAR dump sent using [`STDERR_READ`](./logging.md#stderr_read)
|
||||
|
||||
#### If protocol version is older than 1.21
|
||||
NAR dump sent raw on stream
|
||||
|
||||
|
||||
## QueryMissing
|
||||
|
||||
**Id:** 40<br>
|
||||
**Introduced:** Protocol 1.19*, Nix 2.0<br>
|
||||
|
||||
### Inputs
|
||||
targets :: [List][se-List] of [DerivedPath][se-DerivedPath]
|
||||
|
||||
### Outputs
|
||||
- willBuild :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
- willSubstitute :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
- unknown :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
- downloadSize :: [UInt64][se-UInt64]
|
||||
- narSize :: [UInt64][se-UInt64]
|
||||
|
||||
|
||||
## QueryDerivationOutputMap
|
||||
|
||||
**Id:** 41<br>
|
||||
**Introduced:** Protocol 1.22*, Nix 2.4<br>
|
||||
|
||||
Retrieves an associative map outputName -> storePath for a given derivation.
|
||||
|
||||
### Inputs
|
||||
path :: [StorePath][se-StorePath] (must be a derivation path)
|
||||
|
||||
### Outputs
|
||||
outputs :: [Map][se-Map] of [OutputName][se-OutputName] to [OptStorePath][se-OptStorePath]
|
||||
|
||||
|
||||
## RegisterDrvOutput
|
||||
|
||||
**Id:** 42<br>
|
||||
**Introduced:** Protocol 1.27, Nix 2.4<br>
|
||||
|
||||
Registers a DRV output
|
||||
|
||||
### Inputs
|
||||
#### If protocol is 1.31 or newer
|
||||
realisation :: [Realisation][se-Realisation]
|
||||
|
||||
#### If protocol is older than 1.31
|
||||
- outputId :: [DrvOutput][se-DrvOutput]
|
||||
- outputPath :: [StorePath][se-StorePath]
|
||||
|
||||
|
||||
## QueryRealisation
|
||||
|
||||
**Id:** 43<br>
|
||||
**Introduced:** Protocol 1.27, Nix 2.4<br>
|
||||
|
||||
Retrieves the realisations attached to a drv output id realisations.
|
||||
|
||||
### Inputs
|
||||
outputId :: [DrvOutput][se-DrvOutput]
|
||||
|
||||
### Outputs
|
||||
#### If protocol is 1.31 or newer
|
||||
realisations :: [Set][se-Set] of [Realisation][se-Realisation]
|
||||
|
||||
#### If protocol is older than 1.31
|
||||
outPaths :: [Set][se-Set] of [StorePath][se-StorePath]
|
||||
|
||||
|
||||
## AddMultipleToStore
|
||||
|
||||
**Id:** 44<br>
|
||||
**Introduced:** Protocol 1.32*, Nix 2.4<br>
|
||||
|
||||
A pipelined version of [AddToStoreNar](#addtostorenar) where you can add
|
||||
multiple paths in one go.
|
||||
|
||||
Added because the protocol doesn't support pipelining and so on a low latency
|
||||
connection waiting for the request/response of [AddToStoreNar](#addtostorenar)
|
||||
for each small NAR was costly.
|
||||
|
||||
### Inputs
|
||||
- repair :: [Bool64][se-Bool64]
|
||||
- dontCheckSigs :: [Bool64][se-Bool64]
|
||||
- [Framed][se-Framed] stream of [add multiple NAR dump][se-AddMultipleToStore]
|
||||
|
||||
|
||||
## AddBuildLog
|
||||
|
||||
**Id:** 45<br>
|
||||
**Introduced:** Protocol 1.32, Nix 2.6.0<br>
|
||||
|
||||
Attach some build logs to a given build.
|
||||
|
||||
### Inputs
|
||||
- path :: [BaseStorePath][se-BaseStorePath]
|
||||
- [Framed][se-Framed] stream of log lines
|
||||
|
||||
### Outputs
|
||||
1 :: [Int][se-Int] (hardcoded and ignored by client)
|
||||
|
||||
|
||||
## BuildPathsWithResults
|
||||
|
||||
**Id:** 46<br>
|
||||
**Introduced:** Protocol 1.34*, Nix 2.8.0<br>
|
||||
|
||||
Build (or substitute) a list of derivations and returns a list of results.
|
||||
|
||||
### Inputs
|
||||
- drvs :: [List][se-List] of [DerivedPath][se-DerivedPath]
|
||||
- mode :: [BuildMode][se-BuildMode]
|
||||
|
||||
### Outputs
|
||||
results :: [List][se-List] of [KeyedBuildResult][se-KeyedBuildResult]
|
||||
|
||||
|
||||
## AddPermRoot
|
||||
|
||||
**Id:** 47<br>
|
||||
**Introduced:** Protocol 1.36*, Nix 2.20.0<br>
|
||||
|
||||
### Inputs
|
||||
- storePath :: [StorePath][se-StorePath]
|
||||
- gcRoot :: [Path][se-Path]
|
||||
|
||||
### Outputs
|
||||
gcRoot :: [Path][se-Path]
|
||||
|
||||
|
||||
|
||||
[se-Int]: {{< relref "serialization.md" >}}#int
|
||||
[se-UInt8]: {{< relref "serialization.md" >}}#uint8
|
||||
[se-UInt64]: {{< relref "serialization.md" >}}#uint64
|
||||
[se-Bool]: {{< relref "serialization.md" >}}#bool
|
||||
[se-Bool64]: {{< relref "serialization.md" >}}#bool64
|
||||
[se-Time]: {{< relref "serialization.md" >}}#time
|
||||
[se-FileIngestionMethod]: {{< relref "serialization.md" >}}#fileingestionmethod
|
||||
[se-BuildMode]: {{< relref "serialization.md" >}}#buildmode
|
||||
[se-Verbosity]: {{< relref "serialization.md" >}}#verbosity
|
||||
[se-GCAction]: {{< relref "serialization.md" >}}#gcaction
|
||||
[se-Bytes]: {{< relref "serialization.md" >}}#bytes
|
||||
[se-String]: {{< relref "serialization.md" >}}#string
|
||||
[se-StorePath]: {{< relref "serialization.md" >}}#storepath
|
||||
[se-BaseStorePath]: {{< relref "serialization.md" >}}#basestorepath
|
||||
[se-OptStorePath]: {{< relref "serialization.md" >}}#optstorepath
|
||||
[se-ContentAddressMethodWithAlgo]: {{< relref "serialization.md" >}}#contentaddressmethodwithalgo
|
||||
[se-OptContentAddress]: {{< relref "serialization.md" >}}#optcontentaddress
|
||||
[se-DerivedPath]: {{< relref "serialization.md" >}}#derivedpath
|
||||
[se-DrvOutput]: {{< relref "serialization.md" >}}#drvoutput
|
||||
[se-Realisation]: {{< relref "serialization.md" >}}#realisation
|
||||
[se-List]: {{< relref "serialization.md" >}}#list-of-x
|
||||
[se-Set]: {{< relref "serialization.md" >}}#set-of-x
|
||||
[se-Map]: {{< relref "serialization.md" >}}#map-of-x-to-y
|
||||
[se-SubstitutablePathInfo]: {{< relref "serialization.md" >}}#substitutablepathinfo
|
||||
[se-ValidPathInfo]: {{< relref "serialization.md" >}}#validpathinfo
|
||||
[se-UnkeyedValidPathInfo]: {{< relref "serialization.md" >}}#unkeyedvalidpathinfo
|
||||
[se-BuildResult]: {{< relref "serialization.md" >}}#buildmode
|
||||
[se-KeyedBuildResult]: {{< relref "serialization.md" >}}#keyedbuildresult
|
||||
[se-BasicDerivation]: {{< relref "serialization.md" >}}#basicderivation
|
||||
[se-Framed]: {{< relref "serialization.md" >}}#framed
|
||||
[se-AddMultipleToStore]: {{< relref "serialization.md" >}}#addmultipletostore-format
|
||||
[se-ExportFormat]: {{< relref "serialization.md" >}}#export-path-format
|
||||
[se-ImportPaths]: {{< relref "serialization.md" >}}#import-paths-format
|
||||
422
web/content/docs/reference/nix-daemon-protocol/serialization.md
Normal file
422
web/content/docs/reference/nix-daemon-protocol/serialization.md
Normal file
|
|
@ -0,0 +1,422 @@
|
|||
---
|
||||
title: Types
|
||||
slug: types
|
||||
description: ""
|
||||
summary: ""
|
||||
date: 2025-03-24T13:10:37+02:00
|
||||
lastmod: 2025-03-24T13:10:37+02:00
|
||||
draft: false
|
||||
weight: 52
|
||||
toc: true
|
||||
---
|
||||
|
||||
This describes how certain types are serialized to the wire format.
|
||||
|
||||
### UInt64
|
||||
Little endian byte order
|
||||
|
||||
### Bytes
|
||||
|
||||
- len :: [UInt64](#uint64)
|
||||
- len bytes of content
|
||||
- padding with zeros to ensure 64 bit alignment of content + padding
|
||||
|
||||
|
||||
## Int serializers
|
||||
|
||||
### Int
|
||||
[UInt64](#uint64) cast to C `unsigned int` with upper bounds checking.
|
||||
|
||||
### Int64
|
||||
[UInt64](#uint64) cast to C `int64_t` with upper bounds checking.
|
||||
This means that negative numbers can be written but not read.
|
||||
Since this is only used for cpuSystem and cpuUser it is fine that
|
||||
negative numbers aren't supported.
|
||||
|
||||
### UInt8
|
||||
[UInt64](#uint64) cast to C `uint8_t` with upper bounds checking.
|
||||
|
||||
### Size
|
||||
[UInt64](#uint64) cast to C `size_t` with upper bounds checking.
|
||||
|
||||
### Time
|
||||
[UInt64](#uint64) cast to C `time_t` with upper bounds checking.
|
||||
This means that negative numbers can be written but not read.
|
||||
|
||||
### Bool
|
||||
Sent as an [Int](#int) where 0 is false and everything else is true.
|
||||
|
||||
### Bool64
|
||||
Sent as an [UInt64](#uint64) where 0 is false and everything else is true.
|
||||
|
||||
### FileIngestionMethod
|
||||
An [UInt8](#uint8) enum with the following possible values:
|
||||
|
||||
| Name | Int |
|
||||
| ---------- | --- |
|
||||
| Flat | 0 |
|
||||
| NixArchive | 1 |
|
||||
|
||||
### BuildMode
|
||||
An [Int](#int) enum with the following possible values:
|
||||
|
||||
| Name | Int |
|
||||
| ------ | --- |
|
||||
| Normal | 0 |
|
||||
| Repair | 1 |
|
||||
| Check | 2 |
|
||||
|
||||
### Verbosity
|
||||
An [Int](#int) enum with the following possible values:
|
||||
|
||||
| Name | Int |
|
||||
| --------- | --- |
|
||||
| Error | 0 |
|
||||
| Warn | 1 |
|
||||
| Notice | 2 |
|
||||
| Info | 3 |
|
||||
| Talkative | 4 |
|
||||
| Chatty | 5 |
|
||||
| Debug | 6 |
|
||||
| Vomit | 7 |
|
||||
|
||||
### GCAction
|
||||
An [Int](#int) enum with the following possible values:
|
||||
|
||||
| Name | Int |
|
||||
| -------------- | --- |
|
||||
| ReturnLive | 0 |
|
||||
| ReturnDead | 1 |
|
||||
| DeleteDead | 2 |
|
||||
| DeleteSpecific | 3 |
|
||||
|
||||
### BuildStatus
|
||||
An [Int](#int) enum with the following possible values:
|
||||
|
||||
| Name | Int |
|
||||
| ---------------------- | --- |
|
||||
| Built | 0 |
|
||||
| Substituted | 1 |
|
||||
| AlreadyValid | 2 |
|
||||
| PermanentFailure | 3 |
|
||||
| InputRejected | 4 |
|
||||
| OutputRejected | 5 |
|
||||
| TransientFailure | 6 |
|
||||
| CachedFailure | 7 |
|
||||
| TimedOut | 8 |
|
||||
| MiscFailure | 9 |
|
||||
| DependencyFailed | 10 |
|
||||
| LogLimitExceeded | 11 |
|
||||
| NotDeterministic | 12 |
|
||||
| ResolvesToAlreadyValid | 13 |
|
||||
| NoSubstituters | 14 |
|
||||
|
||||
### ActivityType
|
||||
An [Int](#int) enum with the following possible values:
|
||||
|
||||
| Name | Int |
|
||||
| ------------- | --- |
|
||||
| Unknown | 0 |
|
||||
| CopyPath | 100 |
|
||||
| FileTransfer | 101 |
|
||||
| Realise | 102 |
|
||||
| CopyPaths | 103 |
|
||||
| Builds | 104 |
|
||||
| Build | 105 |
|
||||
| OptimiseStore | 106 |
|
||||
| VerifyPaths | 107 |
|
||||
| Substitute | 108 |
|
||||
| QueryPathInfo | 109 |
|
||||
| PostBuildHook | 110 |
|
||||
| BuildWaiting | 111 |
|
||||
| FetchTree | 112 |
|
||||
|
||||
### ResultType
|
||||
An [Int](#int) enum with the following possible values:
|
||||
|
||||
| Name | Int |
|
||||
| ---------------- | --- |
|
||||
| FileLinked | 100 |
|
||||
| BuildLogLine | 101 |
|
||||
| UntrustedPath | 102 |
|
||||
| CorruptedPath | 103 |
|
||||
| SetPhase | 104 |
|
||||
| Progress | 105 |
|
||||
| SetExpected | 106 |
|
||||
| PostBuildLogLine | 107 |
|
||||
| FetchStatus | 108 |
|
||||
|
||||
### FieldType
|
||||
An [Int](#int) enum with the following possible values:
|
||||
|
||||
| Name | Int |
|
||||
| ------ | --- |
|
||||
| Int | 0 |
|
||||
| String | 1 |
|
||||
|
||||
### OptTrusted
|
||||
An [UInt8](#uint8) optional enum with the following possible values:
|
||||
|
||||
| Name | Int |
|
||||
| ---------- | --- |
|
||||
| Unknown | 0 |
|
||||
| Trusted | 1 |
|
||||
| NotTrusted | 2 |
|
||||
|
||||
|
||||
## Bytes serializers
|
||||
|
||||
### String
|
||||
Simply a [Bytes](#bytes) that has some UTF-8 string like semantics sometimes.
|
||||
|
||||
### StorePath
|
||||
[String](#string) representation of a full store path including the store directory.
|
||||
|
||||
### BaseStorePath
|
||||
[String](#string) representation of the basename of a store path. That is the store path
|
||||
without the /nix/store prefix.
|
||||
|
||||
### StorePathName
|
||||
[String](#string) representation of the name part of a base store path. This is the part
|
||||
of the store path after the nixbase32 hash and '-'
|
||||
|
||||
It must have the following format:
|
||||
- Deny ".", "..", or those strings followed by '-'
|
||||
- Otherwise check that each character is 0-9, a-z, A-Z or one of +-._?=
|
||||
|
||||
### StorePathHash
|
||||
[String](#string) representation of the hash part of a base store path. This is the part
|
||||
of the store path at the beginning and before the '-' and is in nixbase32 format.
|
||||
|
||||
|
||||
### OutputName
|
||||
[String](#string) representation of the name of a derivation output.
|
||||
This is usually combined with the name in the derivation to form the store path name for the
|
||||
store path with this output.
|
||||
|
||||
Since output name is usually combined to form a store path name its format must follow the
|
||||
same rules as [StorePathName](#storepathname):
|
||||
- Deny ".", "..", or those strings followed by '-'
|
||||
- Otherwise check that each character is 0-9, a-z, A-Z or one of +-._?=
|
||||
|
||||
|
||||
### OptStorePath
|
||||
Optional store path.
|
||||
|
||||
If no store path this is serialized as the empty string otherwise it is the same as
|
||||
[StorePath](#storepath).
|
||||
|
||||
### Path
|
||||
[String](#string) representation of an absolute path.
|
||||
|
||||
### NARHash
|
||||
[String](#string) base16-encoded NAR SHA256 hash without algorithm prefix.
|
||||
|
||||
### Signature
|
||||
[String](#string) with a signature for the given store path or realisation. This should be
|
||||
in the format `name`:`base 64 encoded signature` but this is not enforced in the protocol.
|
||||
|
||||
### HashAlgorithm
|
||||
[String](#string) with one of the following values:
|
||||
- md5
|
||||
- sha1
|
||||
- sha256
|
||||
- sha512
|
||||
|
||||
### HashDigest
|
||||
[String](#string) with a hash digest in any encoding
|
||||
|
||||
### OptHashDigest
|
||||
Optional version of [HashDigest](#hashdigest) where empty string means
|
||||
no value.
|
||||
|
||||
|
||||
### ContentAddressMethodWithAlgo
|
||||
[String](#string) with one of the following formats:
|
||||
- text:[HashAlgorithm](#hashalgorithm)
|
||||
- fixed:r:[HashAlgorithm](#hashalgorithm)
|
||||
- fixed:[HashAlgorithm](#hashalgorithm)
|
||||
|
||||
### OptContentAddressMethodWithAlgo
|
||||
Optional version of [ContentAddressMethodWithAlgo](#contentaddressmethodwithalgo)
|
||||
where empty string means no value.
|
||||
|
||||
### ContentAddress
|
||||
[String](#string) with the format:
|
||||
- [ContentAddressMethodWithAlgo](#contentaddressmethodwithalgo):[HashDigest](#hashdigest)
|
||||
|
||||
### OptContentAddress
|
||||
Optional version of [ContentAddress](#contentaddress) where empty string means
|
||||
no content address.
|
||||
|
||||
### DerivedPath
|
||||
#### If protocol is 1.30 or newer
|
||||
output-names = [OutputName](#outputname), { "," [OutputName](#outputname) }<br>
|
||||
output-spec = "*" | output-names<br>
|
||||
derived-path = [StorePath](#storepath), [ "!", output-spec ]<br>
|
||||
|
||||
#### If protocol is older than 1.30
|
||||
[StorePath](#storepath), [ "!", [OutputName](#outputname), { "," [OutputName](#outputname) } ]
|
||||
|
||||
### DrvOutput
|
||||
[String](#string) with format:
|
||||
- `hash with any prefix` "!" [OutputName](#outputname)
|
||||
|
||||
### Realisation
|
||||
A JSON object sent as a [String](#string).
|
||||
|
||||
The JSON object has the following keys:
|
||||
| Key | Value |
|
||||
| --------------------- | -------------------------------- |
|
||||
| id | [DrvOutput](#drvoutput) |
|
||||
| outPath | [StorePath](#storepath) |
|
||||
| signatures | Array of [Signature](#signature) |
|
||||
| dependentRealisations | Object where key is [DrvOutput](#drvoutput) and value is [StorePath](#storepath) |
|
||||
|
||||
|
||||
## Complex serializers
|
||||
|
||||
### List of x
|
||||
A list is encoded as a [Size](#size) length n followed by n encodings of x
|
||||
|
||||
### Map of x to y
|
||||
A map is encoded as a [Size](#size) length n followed by n encodings of pairs of x and y
|
||||
|
||||
### Set of x
|
||||
A set is encoded as a [Size](#size) length n followed by n encodings of x
|
||||
|
||||
### BuildResult
|
||||
- status :: [BuildStatus](#buildstatus)
|
||||
- errorMsg :: [String](#string)
|
||||
|
||||
#### Protocol 1.29 or newer
|
||||
- timesBuilt :: [Int](#int) (defaults to 0)
|
||||
- isNonDeterministic :: [Bool64](#bool64) (defaults to false)
|
||||
- startTime :: [Time](#time) (defaults to 0)
|
||||
- stopTime :: [Time](#time) (defaults to 0)
|
||||
|
||||
#### Protocol 1.37 or newer
|
||||
- cpuUser :: [OptMicroseconds](#optmicroseconds) (defaults to none)
|
||||
- cpuSystem :: [OptMicroseconds](#optmicroseconds) (defaults to none)
|
||||
|
||||
#### Protocol 1.28 or newer
|
||||
builtOutputs :: [Map](#map-of-x-to-y) of [DrvOutput](#drvoutput) to [Realisation](#realisations)
|
||||
|
||||
### KeyedBuildResult
|
||||
- path :: [DerivedPath](#derivedpath)
|
||||
- result :: [BuildResult](#buildresult)
|
||||
|
||||
### OptMicroseconds
|
||||
Optional microseconds.
|
||||
|
||||
- tag :: [UInt8](#uint8)
|
||||
|
||||
#### If tag is 1
|
||||
- seconds :: [Int64](#int64)
|
||||
|
||||
|
||||
### SubstitutablePathInfo
|
||||
- deriver :: [OptStorePath](#optstorepath)
|
||||
- references :: [Set][#set-of-x] of [StorePath](#storepath)
|
||||
- downloadSize :: [UInt64](#uint64)
|
||||
- narSize :: [UInt64](#uint64)
|
||||
|
||||
|
||||
### UnkeyedValidPathInfo
|
||||
- deriver :: [OptStorePath](#optstorepath)
|
||||
- narHash :: [NARHash](#narhash)
|
||||
- references :: [Set](#set-of-x) of [StorePath](#storepath)
|
||||
- registrationTime :: [Time](#time)
|
||||
- narSize :: [UInt64](#uint64)
|
||||
|
||||
#### If protocol version is 1.16 or above
|
||||
- ultimate :: [Bool64](#bool64) (defaults to false)
|
||||
- signatures :: [Set](#set-of-x) of [Signature](#signature)
|
||||
- ca :: [OptContentAddress](#optcontentaddress)
|
||||
|
||||
|
||||
### ValidPathInfo
|
||||
- path :: [StorePath](#storepath)
|
||||
- info :: [UnkeyedValidPathInfo](#unkeyedvalidpathinfo)
|
||||
|
||||
### DerivationOutput
|
||||
- path :: [OptStorePath](#optstorepath)
|
||||
- hashAlgo :: [OptContentAddressMethodWithAlgo](#optcontentaddressmethodwithalgo)
|
||||
- hash :: [OptHashDigest](#opthashdigest)
|
||||
|
||||
### BasicDerivation
|
||||
- outputs :: [Map](#map-of-x-to-y) of [OutputName](#outputname) to [DerivationOutput](#derivationoutput)
|
||||
- inputSrcs :: [Set](#set-of-x) of [StorePath](#storepath)
|
||||
- platform :: [String](#string)
|
||||
- builder :: [String](#string)
|
||||
- args :: [List](#list-of-x) of [String](#string)
|
||||
- env :: [Map](#map-of-x-to-y) of [String](#string) to [String](#string)
|
||||
|
||||
### TraceLine
|
||||
- havePos :: [Size](#size) (hardcoded to 0 with assert on read)
|
||||
- hint :: [String](#string) (If logger is JSON, invalid UTF-8 is replaced with U+FFFD)
|
||||
|
||||
### Error
|
||||
- type :: [String](#string) (hardcoded to `Error` with assert on read)
|
||||
- level :: [Verbosity](#verbosity)
|
||||
- name :: [String](#string) (removed and hardcoded to `Error`)
|
||||
- msg :: [String](#string) (If logger is JSON, invalid UTF-8 is replaced with U+FFFD)
|
||||
- havePos :: [Size](#size) (hardcoded to 0 with assert on read)
|
||||
- traces :: [List](#list-of-x) of [TraceLine](#traceline)
|
||||
|
||||
## Field
|
||||
- type :: [FieldType](#fieldtype)
|
||||
|
||||
### If type is Int
|
||||
- value :: [UInt64](#uint64)
|
||||
|
||||
### If type is String
|
||||
- value :: [String](#string)
|
||||
|
||||
|
||||
## Framed
|
||||
|
||||
At protocol 1.23 [AddToStoreNar](./operations.md#addtostorenar) introduced a
|
||||
framed streaming for sending the NAR dump and later versions of the protocol
|
||||
also used this framing for other operations.
|
||||
|
||||
At its core the framed streaming is just a series of [UInt64](#uint64) `size`
|
||||
followed by `size` bytes. The stream is terminated when `size` is zero.
|
||||
|
||||
Unlike [Bytes](#bytes), frames are *NOT* padded.
|
||||
|
||||
This method of sending data has the advantage of not having to parse the data
|
||||
to find where it ends. Older versions of the protocol would potentially parse
|
||||
the NAR twice.
|
||||
|
||||
|
||||
## AddMultipleToStore format
|
||||
|
||||
Paths must be topologically sorted.
|
||||
|
||||
- expected :: [UInt64](#uint64)
|
||||
|
||||
### Repeated expected times
|
||||
- info :: [ValidPathInfo](#validpathinfo)
|
||||
- NAR dump
|
||||
|
||||
|
||||
## Export path format
|
||||
- NAR dump
|
||||
- 0x4558494es :: [Int](#int) (hardcoded, 'EXIN' in ASCII)
|
||||
- path :: [StorePath](#storepath)
|
||||
- references :: [Set](#set-of-x) of [StorePath](#storepath)
|
||||
- deriver :: [OptStorePath](#optstorepath)
|
||||
- hasSignature :: [Int](#int) (hardcoded to 0 in newer versions)
|
||||
|
||||
#### If hasSignature is 1
|
||||
- signature :: [String](#string) (ignored)
|
||||
|
||||
|
||||
## Import paths format
|
||||
|
||||
- hasNext :: [UInt64](#uint64)
|
||||
|
||||
### While hasNext is 1
|
||||
- [Export path format](#export-path-format)
|
||||
- hasNext :: [UInt64](#uint64)
|
||||
Loading…
Add table
Add a link
Reference in a new issue