TOC
Operation | Id |
---|---|
IsValidPath | 1 |
HasSubstitutes | 3 |
QueryReferrers | 6 |
AddToStore | 7 |
BuildPaths | 9 |
EnsurePath | 10 |
AddTempRoot | 11 |
AddIndirectRoot | 12 |
FindRoots | 14 |
SetOptions | 19 |
CollectGarbage | 20 |
QueryAllValidPaths | 23 |
QueryPathInfo | 26 |
QueryPathFromHashPart | 29 |
QueryValidPaths | 31 |
QuerySubstitutablePaths | 32 |
QueryValidDerivers | 33 |
OptimiseStore | 34 |
VerifyStore | 35 |
BuildDerivation | 36 |
AddSignatures | 37 |
NarFromPath | 38 |
AddToStoreNar | 39 |
QueryMissing | 40 |
QueryDerivationOutputMap | 41 |
RegisterDrvOutput | 42 |
QueryRealisation | 43 |
AddMultipleToStore | 44 |
AddBuildLog | 45 |
BuildPathsWithResults | 46 |
AddPermRoot | 47 |
Obsolete operations
Operation | Id |
---|---|
QueryPathHash | 4 |
QueryReferences | 5 |
AddTextToStore | 8 |
SyncWithGC | 13 |
ExportPath | 16 |
QueryDeriver | 18 |
QuerySubstitutablePathInfo | 21 |
QueryDerivationOutputs | 22 |
ImportPaths | 27 |
QueryDerivationOutputNames | 28 |
QuerySubstitutablePathInfos | 30 |
Removed operations
Operation | Id |
---|---|
Quit | 0 |
ImportPath | 17 |
Old CollectGarbage | 15 |
QueryFailedPaths | 24 |
ClearFailedPaths | 25 |
Quit (removed)
Id: 0
Introduced: Nix 0.11
Removed: Became dead code in Nix 0.11 and removed in Nix 1.8
IsValidPath
Id: 1
Introduced: Nix 0.11
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
Outputs
isValid :: Bool
HasSubstitutes
Id: 3
Introduced: Nix 0.11
Obsolete Protocol 1.12, Nix 1.2
Replaced by QuerySubstitutablePaths.
Checks if we can substitute the input path from a substituter. Uses QuerySubstitutablePaths under the hood :/
Inputs
path :: StorePath
Outputs
hasSubstitutes :: Bool
QueryPathHash
Id: 4
Introduced: Nix 0.11
Obsolete: Protocol 1.16, Nix 2.0
Retrieves the base16 NAR hash of a given store path.
Inputs
path :: StorePath
Outputs
hash :: [NARHash][se-NARHash]
QueryReferences
Id: 5
Introduced: Nix 0.11
Obsolete: Protocol 1.16, Nix 2.0
Retrieves the references of a given path
Inputs
path :: StorePath
Outputs
references :: Set of StorePath
QueryReferrers
Id: 6
Introduced: Nix 0.11
Retrieves the referrers of a given path.
Inputs
path :: StorePath
Outputs
AddToStore
Id: 7
Introduced: Nix 0.11
Add a new path to the store.
Before protocol version 1.25
Inputs
- baseName :: [StorePathName][se-StorePathName]
- fixed :: Bool64
- recursive :: 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
Protocol version 1.25 or newer
Inputs
- name :: [StorePathName][se-StorePathName]
- camStr :: ContentAddressMethodWithAlgo
- refs :: Set of StorePath
- repairBool :: Bool64
- Framed NAR dump
Outputs
info :: ValidPathInfo
AddTextToStore
Id: 8
Introduced: Nix 0.11
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. And so this corresponds to calling
AddToStore with camStr
set to text:sha256
and text
wrapped as a NAR.
Inputs
Outpus
path :: StorePath
BuildPaths
Id: 9
Introduced: Nix 0.11
Build (or substitute) a list of derivations.
Inputs
paths :: Set of DerivedPath
Protocol 1.15 or newer
mode :: BuildMode (defaults to Normal)
Check that connection is trusted before allowing Repair mode.
Outputs
1 :: Int (hardcoded and ignored by client)
EnsurePath
Id: 10
Introduced: Nix 0.11
Checks if a path is valid. Note: it may be made valid by running a substitute.
Inputs
path :: StorePath
Outputs
1 :: Int (hardcoded and ignored by client)
AddTempRoot
Id: 11
Introduced: Nix 0.11
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
Outputs
1 :: Int (hardcoded and ignored by client)
AddIndirectRoot
Id: 12
Introduced: Nix 0.11
Add an indirect root, which is a weak reference to the user-facing symlink created by AddPermRoot.
Only ever sent on the local unix socket nix daemon.
Inputs
path :: [Path][se-Path]
Outputs
1 :: Int (hardcoded and ignored by client)
SyncWithGC
Id: 13
Introduced: Nix 0.11
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 to accomplish the same thing.
FindRoots
Id: 14
Introduced: Nix 0.11
Find the GC roots.
Outputs
roots :: Map of [Path][se-Path] to StorePath
The key is the link pointing to the given store path.
Old CollectGarbage (removed)
Id: 15
Introduced: Nix 0.11
Removed: Protocol 1.02, Nix 0.12
ExportPath
Id: 16
Introduced: Nix 0.11
Obsolete: Protocol 1.17, Nix 2.0
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
Outputs
Uses STDERR_WRITE
to send dump in
export format
After dump it outputs.
1 :: Int (hardcoded)
ImportPath (removed)
Id: 17
Introduced: Nix 0.11
Removed: Protocol 1.09, Nix 1.0
QueryDeriver
Id: 18
Introduced: Nix 0.11
Obsolete: Protocol 1.16, Nix 2.0
Returns the store path of the derivation for a given store path.
Inputs
path :: StorePath
Outputs
deriver :: OptStorePath
SetOptions
Id: 19
Introduced: Nix 0.11
Sends client options to the remote side.
Only ever used right after the handshake.
Inputs
- keepFailed :: Bool
- keepGoing :: Bool
- tryFallback :: Bool
- verbosity :: Verbosity
- maxBuildJobs :: Int
- maxSilentTime :: Time
- useBuildHook :: Bool (ignored and hardcoded to true in client)
- verboseBuild :: Verbosity
- logType :: Int (ignored and hardcoded to 0 in client)
- printBuildTrace :: Int (ignored and hardcoded to 0 in client)
- buildCores :: Int
- useSubstitutes :: Bool
Protocol 1.12 or newer
otherSettings :: Map of String to String
CollectGarbage
Id: 20
Introduced: Protocol 1.02, Nix 0.12
Find the GC roots.
Inputs
- action :: GCAction
- pathsToDelete :: Set of StorePath
- ignoreLiveness :: Bool64
- maxFreed :: UInt64
- removed :: Int (ignored and hardcoded to 0 in client)
- removed :: Int (ignored and hardcoded to 0 in client)
- removed :: Int (ignored and hardcoded to 0 in client)
Outputs
- pathsDeleted :: Set of [Path][se-Path]
- bytesFreed :: UInt64
- 0 :: 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
Introduced: Protocol 1.02, Nix 0.12
Obsolete: Protocol 1.12, Nix 1.2
Retrieves the various substitutable paths infos for a given path.
Inputs
path :: StorePath
Outputs
found :: Bool
If found is true
- info :: SubstitutablePathInfo
QueryDerivationOutputs
Id: 22
Introduced: Protocol 1.05, Nix 1.0
Obsolete: Protocol 1.22*, Nix 2.4
Retrieves all the outputs paths of a given derivation.
Inputs
path :: StorePath (must point to a derivation)
Outputs
derivationOutputs :: Set of StorePath
QueryAllValidPaths
Id: 23
Introduced: Protocol 1.05, Nix 1.0
Retrieves all the valid paths contained in the store.
Outputs
QueryFailedPaths (removed)
Id: 24
Introduced: Protocol 1.05, Nix 1.0
Removed: Protocol 1.16, Nix 2.0
Failed build caching API only ever used by Hydra.
ClearFailedPaths (removed)
Id: 25
Introduced: Protocol 1.05, Nix 1.0
Removed: Protocol 1.16, Nix 2.0
Failed build caching API only ever used by Hydra.
QueryPathInfo
Id: 26
Introduced: Protocol 1.06, Nix 1.0
Retrieves the pathInfo for a given path.
Inputs
path :: StorePath
Outputs
If protocol version is 1.17 or newer
success :: Bool64
If success is true
pathInfo :: UnkeyedValidPathInfo
If protocol version is older than 1.17
If info not found return error with STDERR_ERROR
pathInfo :: UnkeyedValidPathInfo
ImportPaths
Id: 27
Introduced: Protocol 1.09, Nix 1.0
Obsolete: Protocol 1.17, Nix 2.0
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 coming from one or more ExportPath operations.
Outputs
importedPaths :: List of StorePath
QueryDerivationOutputNames
Id: 28
Introduced: Protocol 1.08, Nix 1.0
Obsolete: Protocol 1.21, Nix 2.4
Retrieves the name of the outputs of a given derivation. EG. out, dev, etc.
Inputs
path :: StorePath (must be a derivation path)
Outputs
names :: Set of [OutputName][se-OutputName]
QueryPathFromHashPart
Id: 29
Introduced: Protocol 1.11, Nix 1.1
Retrieves a store path from a nixbase32 (input) hash.
Inputs
hashPart :: [StorePathHash][se-StorePathHash]
Outputs
path :: OptStorePath
QuerySubstitutablePathInfos
Id: 30
Introduced: Protocol 1.12*, Nix 1.2
Obsolete: Protocol 1.19*, Nix 2.0
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 of StorePath to OptContentAddress
If protocol version older than 1.22
Outputs
infos :: Map of StorePath to SubstitutablePathInfo
QueryValidPaths
Id: 31
Introduced: Protocol 1.12, Nix 1.2
Takes a list of store paths and returns a new list only containing the valid store paths
Inputs
If protocol version is 1.27 or newer
substitute :: Bool (defaults to false if not sent)
Outputs
QuerySubstitutablePaths
Id: 32
Introduced: Protocol 1.12, Nix 1.2
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 is used to implement the functionality that this operation provides.
Inputs
Outputs
QueryValidDerivers
Id: 33
Introduced: Protocol 1.13*, Nix 1.3
Retrieves the derivers of a given path.
Inputs
path :: StorePath
Outputs
OptimiseStore
Id: 34
Introduced: Protocol 1.14, Nix 1.8
Optimise store by hardlinking files with the same content.
Outputs
1 :: Int (hardcoded and ignored by client)
VerifyStore
Id: 35
Introduced: Protocol 1.14, Nix 1.9
Verify store either only db and existence of path or entire contents of store paths against the NAR hash.
Inputs
Outputs
errors :: Bool
BuildDerivation
Id: 36
Introduced: Protocol 1.14, Nix 1.10
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
- drv :: BasicDerivation
- buildMode :: BuildMode
Outputs
buildResult :: BuildResult
AddSignatures
Id: 37
Introduced: Protocol 1.16, Nix 2.0
Add the signatures associated to a given path. Used by nix store copy-sigs
and nix store sign
.
Inputs
Outputs
1 :: Int (hardcoded and ignored by client)
NarFromPath
Id: 38
Introduced: Protocol 1.17, Nix 2.0
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
Outputs
NAR dumped straight to the stream.
AddToStoreNar
Id: 39
Introduced: Protocol 1.17, Nix 2.0
Dumps a path as a NAR
Inputs
- path :: StorePath
- deriver :: OptStorePath
- narHash :: [NARHash][se-NARHash]
- references :: Set of StorePath
- registrationTime :: Time
- narSize :: UInt64
- ultimate :: Bool64
- signatures :: Set of [Signature][se-Signature]
- ca :: OptContentAddress
- repair :: Bool64
- dontCheckSigs :: Bool64
If protocol version is 1.23 or newer
Framed NAR dump
If protocol version is between 1.21 and 1.23
NAR dump sent using STDERR_READ
If protocol version is older than 1.21
NAR dump sent raw on stream
QueryMissing
Id: 40
Introduced: Protocol 1.19*, Nix 2.0
Inputs
targets :: List of DerivedPath
Outputs
- willBuild :: Set of StorePath
- willSubstitute :: Set of StorePath
- unknown :: Set of StorePath
- downloadSize :: UInt64
- narSize :: UInt64
QueryDerivationOutputMap
Id: 41
Introduced: Protocol 1.22*, Nix 2.4
Retrieves an associative map outputName -> storePath for a given derivation.
Inputs
path :: StorePath (must be a derivation path)
Outputs
outputs :: Map of [OutputName][se-OutputName] to OptStorePath
RegisterDrvOutput
Id: 42
Introduced: Protocol 1.27, Nix 2.4
Registers a DRV output
Inputs
If protocol is 1.31 or newer
realisation :: Realisation
If protocol is older than 1.31
QueryRealisation
Id: 43
Introduced: Protocol 1.27, Nix 2.4
Retrieves the realisations attached to a drv output id realisations.
Inputs
outputId :: DrvOutput
Outputs
If protocol is 1.31 or newer
realisations :: Set of Realisation
If protocol is older than 1.31
AddMultipleToStore
Id: 44
Introduced: Protocol 1.32*, Nix 2.4
A pipelined version of 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 for each small NAR was costly.
Inputs
- repair :: Bool64
- dontCheckSigs :: Bool64
- Framed stream of add multiple NAR dump
AddBuildLog
Id: 45
Introduced: Protocol 1.32, Nix 2.6.0
Attach some build logs to a given build.
Inputs
- path :: BaseStorePath
- Framed stream of log lines
Outputs
1 :: Int (hardcoded and ignored by client)
BuildPathsWithResults
Id: 46
Introduced: Protocol 1.34*, Nix 2.8.0
Build (or substitute) a list of derivations and returns a list of results.
Inputs
- drvs :: List of DerivedPath
- mode :: BuildMode
Outputs
results :: List of KeyedBuildResult
AddPermRoot
Id: 47
Introduced: Protocol 1.36*, Nix 2.20.0
Inputs
- storePath :: StorePath
- gcRoot :: [Path][se-Path]
Outputs
gcRoot :: [Path][se-Path]