2023-03-26 22:02:55 +00:00
|
|
|
|
|
|
|
import
|
2023-05-30 12:32:29 +00:00
|
|
|
preserves, std/tables
|
2023-03-26 22:02:55 +00:00
|
|
|
|
|
|
|
type
|
2023-05-30 12:32:29 +00:00
|
|
|
Eval* {.preservesRecord: "eval".} = object
|
|
|
|
`expr`*: string
|
|
|
|
`options`*: Table[Symbol, Preserve[void]]
|
|
|
|
`result`*: Preserve[void]
|
|
|
|
|
|
|
|
Realise* {.preservesRecord: "realise".} = object
|
|
|
|
`drv`*: string
|
|
|
|
`outputs`*: seq[string]
|
2023-03-26 22:02:55 +00:00
|
|
|
|
2023-05-30 22:27:11 +00:00
|
|
|
Narinfo* {.preservesRecord: "narinfo".} = object
|
|
|
|
`path`*: string
|
|
|
|
`info`*: Dict
|
|
|
|
|
|
|
|
Dict* = Table[Symbol, Preserve[void]]
|
2023-03-26 22:02:55 +00:00
|
|
|
Build* {.preservesRecord: "nix-build".} = object
|
|
|
|
`input`*: string
|
|
|
|
`output`*: Preserve[void]
|
|
|
|
|
2023-05-30 22:27:11 +00:00
|
|
|
Instantiate* {.preservesRecord: "instantiate".} = object
|
|
|
|
`expr`*: string
|
|
|
|
`options`*: Dict
|
|
|
|
`result`*: Preserve[void]
|
|
|
|
|
|
|
|
proc `$`*(x: Eval | Realise | Narinfo | Dict | Build | Instantiate): string =
|
2023-03-26 22:02:55 +00:00
|
|
|
`$`(toPreserve(x))
|
|
|
|
|
2023-05-30 22:27:11 +00:00
|
|
|
proc encode*(x: Eval | Realise | Narinfo | Dict | Build | Instantiate): seq[byte] =
|
2023-03-26 22:02:55 +00:00
|
|
|
encode(toPreserve(x))
|