Syndicated Nix Actor
Go to file
Emery Hemingway d8606cc0e2 Make defaut.nix TVL depot compatible 2024-09-02 12:27:38 +03:00
src Restore the store entity and add replication 2024-08-27 18:31:44 +03:00
tests Restore the store entity and add replication 2024-08-27 18:31:44 +03:00
.gitignore Add lockfile 2023-10-09 19:57:31 +01:00
README.md Restore the store entity and add replication 2024-08-27 18:31:44 +03:00
Tupfile Replace protocol, update dependencies 2024-06-24 12:04:15 +03:00
Tuprules.jq Replace protocol, update dependencies 2024-06-24 12:04:15 +03:00
Tuprules.tup Drop direnv 2024-08-14 14:52:54 +01:00
build-nim-sbom.nix Make build-nim-sbom.nix compatible with nixos-24.05 2024-08-28 00:52:03 +03:00
default.nix Make defaut.nix TVL depot compatible 2024-09-02 12:27:38 +03:00
nix_actor.nimble Replace protocol, update dependencies 2024-06-24 12:04:15 +03:00
protocol.prs Restore the store entity and add replication 2024-08-27 18:31:44 +03:00
sbom.json Make build-nim-sbom.nix compatible with nixos-24.05 2024-08-28 00:52:03 +03:00
service.pr.in Add cfg output to default.nix 2024-07-04 15:39:26 +03:00
tup.config.nix Fix pkg-config importing 2024-08-27 18:01:02 +03:00

README.md

Syndicated Nix Actor

An actor for interacting with the Nix daemon via the Syndicated Actor Model.

See protocol.prs for the Syndicate protocol schema.

Evaluation state as entity capabililties

The actor exposes on its initial capability a gatekeeper that resolves requests in the form <nix { lookupPath: [ … ], store: … } >.

The resolved entity is an evaluation state that responds to the assertions <eval @expr string @args any @result #:Result> as well as observation of literal values via the dataspace protocol. The evaluation state is initialized with the value nil and is advanced with Nix functions in the form of prev: args: body with a type of Any -> Any -> Any.

To evaluate the hello package from Nixpkgs one could use an assertion like <eval "_: pkgName: builtins.getAttr pkgName (import <nixpkgs> {})" "hello" #:…> which would assert back a new assertion state at hello.

The evaluation state represents a lazy Nix expression and must be "realised" to become a physical store path. Asserting <realise-string @result #:Result> to an evaluation state will return a string with its realized closure at the evaluation store.

With the exception of observations the result value of <ok @value any> or <error @message any> is used for response assertions.

Dataspace observations work over evaluation state. In the example case of an evaluation state positioned at the hello package the observation of { hello: { meta: { license: { shortName: ? } } } } would capture the value "gpl3Plus". If an attrset contains an outPath attribute then the value of outPath is captured in place of the attrset. This is to avoid traversing deeply nested and recursive Nix values.

Store replication

Nix stores can be opened using the gatekeeper step <nix-store { storeUri: "…" }>. The store entity responds to <check-path @store-path string @result #:any> with true or false.

To replicate paths between two stores, assert <replicate @target #:any @storePath string @result #:Result> to a store entity or a evaluation entity, with target set to a store entity or a evaluation entity.

Worker protocol

The was once an abstraction of the Nix worker socket that could intermediate between clients and the worker but that code has been removed, refer to git history for that.