Update to Nim-2.0.0
This commit is contained in:
parent
8e06628d21
commit
6b6187f508
|
@ -1,4 +1,4 @@
|
||||||
version = "20230730"
|
version = "20230824"
|
||||||
author = "Emery Hemingway"
|
author = "Emery Hemingway"
|
||||||
description = "Syndicated Nix Actor"
|
description = "Syndicated Nix Actor"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
let
|
let
|
||||||
flake = builtins.getFlake "syndicate";
|
flake = builtins.getFlake "/home/emery/src/syndicate-flake";
|
||||||
pkgs = import <nixpkgs> { overlays = [ flake.overlays.default ]; };
|
pkgs = import <nixpkgs> { overlays = [ flake.overlays.default ]; };
|
||||||
in pkgs.nix_actor
|
in pkgs.nim2Packages.nix_actor
|
||||||
|
|
|
@ -143,36 +143,42 @@ type
|
||||||
DaemonSideArgs {.preservesDictionary.} = object
|
DaemonSideArgs {.preservesDictionary.} = object
|
||||||
`daemon-socket`: string
|
`daemon-socket`: string
|
||||||
|
|
||||||
main.initNix()
|
proc runNixActor(nixState: EvalState) =
|
||||||
libexpr.initGC()
|
let erisStore = newMemoryStore()
|
||||||
|
runActor("nix_actor") do (root: Cap; turn: var Turn):
|
||||||
|
connectStdio(root, turn)
|
||||||
|
|
||||||
runActor("main") do (root: Cap; turn: var Turn):
|
let pat = ?CapArgs
|
||||||
let
|
during(turn, root, pat) do (ds: Cap):
|
||||||
erisStore = newMemoryStore()
|
|
||||||
nixStore = openStore()
|
|
||||||
nixState = newEvalState(nixStore)
|
|
||||||
connectStdio(root, turn)
|
|
||||||
|
|
||||||
during(turn, root, ?CapArgs) do (ds: Cap):
|
discard publish(turn, ds,
|
||||||
discard publish(turn, ds,
|
initRecord("nixVersion", toPreserve($nixVersion.c_str)))
|
||||||
initRecord("nixVersion", toPreserve($nixVersion.c_str)))
|
|
||||||
|
|
||||||
discard bootNixFacet(turn, ds)
|
discard bootNixFacet(turn, ds)
|
||||||
|
|
||||||
during(turn, ds, ?Observe(pattern: !Eval) ?? {0: grabLit(), 1: grabDict()}) do (e: string, o: Assertion):
|
let pat = ?Observe(pattern: !Eval) ?? {0: grabLit(), 1: grabDict()}
|
||||||
var ass = Eval(expr: e)
|
during(turn, ds, pat) do (e: string, o: Assertion):
|
||||||
doAssert fromPreserve(ass.options, unpackLiterals(o))
|
var ass = Eval(expr: e)
|
||||||
# unused options
|
doAssert fromPreserve(ass.options, unpackLiterals(o))
|
||||||
try:
|
# unused options
|
||||||
ass.result = eval(nixState, ass.expr)
|
try:
|
||||||
discard publish(turn, ds, ass)
|
ass.result = eval(nixState, ass.expr)
|
||||||
except CatchableError as err:
|
discard publish(turn, ds, ass)
|
||||||
stderr.writeLine "failed to evaluate ", ass.expr, ": ", err.msg
|
except CatchableError as err:
|
||||||
except StdException as err:
|
stderr.writeLine "failed to evaluate ", ass.expr, ": ", err.msg
|
||||||
stderr.writeLine "failed to evaluate ", ass.expr, ": ", err.what
|
except StdException as err:
|
||||||
|
stderr.writeLine "failed to evaluate ", ass.expr, ": ", err.what
|
||||||
|
|
||||||
during(turn, root, ?ClientSideArgs) do (socketPath: string):
|
during(turn, root, ?ClientSideArgs) do (socketPath: string):
|
||||||
bootClientSide(turn, ds, erisStore, socketPath)
|
bootClientSide(turn, ds, erisStore, socketPath)
|
||||||
|
|
||||||
during(turn, root, ?DaemonSideArgs) do (socketPath: string):
|
during(turn, root, ?DaemonSideArgs) do (socketPath: string):
|
||||||
bootDaemonSide(turn, ds, erisStore, socketPath)
|
bootDaemonSide(turn, ds, erisStore, socketPath)
|
||||||
|
|
||||||
|
proc main =
|
||||||
|
initNix()
|
||||||
|
initGC()
|
||||||
|
let nixStore = openStore()
|
||||||
|
runNixActor(newEvalState(nixStore))
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
|
@ -83,11 +83,11 @@ type
|
||||||
ExprObj {.importcpp: "nix::Expr", header: "nixexpr.hh".} = object
|
ExprObj {.importcpp: "nix::Expr", header: "nixexpr.hh".} = object
|
||||||
discard
|
discard
|
||||||
Expr* = ptr ExprObj
|
Expr* = ptr ExprObj
|
||||||
EvalState* {.importcpp: "nix::ref<nix::EvalState>", header: "eval.hh".} = object
|
EvalState* {.importcpp: "std::shared_ptr<nix::EvalState>", header: "eval.hh".} = object
|
||||||
discard
|
discard
|
||||||
|
|
||||||
proc newEvalState*(store: Store): EvalState {.
|
proc newEvalState*(store: Store): EvalState {.
|
||||||
importcpp: "nix::newEvalState(@)", header: "seepuspus.hh".}
|
importcpp: "nix::newEvalState(@)", header: "seepuspus.hh", constructor.}
|
||||||
|
|
||||||
proc parseExprFromString*(state: EvalState; s, basePath: cstring): Expr {.
|
proc parseExprFromString*(state: EvalState; s, basePath: cstring): Expr {.
|
||||||
importcpp: "#->parseExprFromString(@)".}
|
importcpp: "#->parseExprFromString(@)".}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
ref<EvalState> newEvalState(ref<Store> store)
|
std::shared_ptr<nix::EvalState> newEvalState(ref<Store> store)
|
||||||
{
|
{
|
||||||
auto searchPath = Strings();
|
auto searchPath = Strings();
|
||||||
auto evalState =
|
auto evalState =
|
||||||
|
@ -15,7 +15,7 @@ namespace nix {
|
||||||
searchPath, store, store)
|
searchPath, store, store)
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
return ref<EvalState>(evalState);
|
return evalState;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue