support nib's new parsing schema
This commit is contained in:
parent
2638800707
commit
0b7fa9ab0d
1 changed files with 9 additions and 8 deletions
17
flake.nix
17
flake.nix
|
|
@ -36,7 +36,8 @@
|
||||||
deploy-rs,
|
deploy-rs,
|
||||||
...
|
...
|
||||||
} @ inputs:
|
} @ inputs:
|
||||||
with builtins; let
|
with builtins;
|
||||||
|
with nib.types; let
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
|
|
||||||
sys = with nib;
|
sys = with nib;
|
||||||
|
|
@ -67,17 +68,17 @@
|
||||||
# abstract node instance that stores all default values
|
# abstract node instance that stores all default values
|
||||||
templateNode = name: system: let
|
templateNode = name: system: let
|
||||||
missing = msg: path:
|
missing = msg: path:
|
||||||
abort ''
|
Terminal (abort ''
|
||||||
Each Cerulean Nexus node is required to specify ${msg}!
|
Each Cerulean Nexus node is required to specify ${msg}!
|
||||||
Ensure `cerulean.nexus.nodes.${name}.${path}` exists under your call to `cerulean.mkNexus`.
|
Ensure `cerulean.nexus.nodes.${name}.${path}` exists under your call to `cerulean.mkNexus`.
|
||||||
'';
|
'');
|
||||||
in {
|
in {
|
||||||
system = missing "its system type" "system"; # intentionally left missing!! (to raise errors)
|
system = missing "its system type" "system"; # intentionally left missing!! (to raise errors)
|
||||||
modules = missing "its required modules" "modules";
|
modules = missing "its required modules" "modules";
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
pkgs = sys.pkgsFor system;
|
pkgs = Terminal (sys.pkgsFor system);
|
||||||
upkgs = sys.upkgsFor system;
|
upkgs = Terminal (sys.upkgsFor system);
|
||||||
};
|
};
|
||||||
|
|
||||||
deploy = {
|
deploy = {
|
||||||
|
|
@ -114,14 +115,14 @@
|
||||||
# TODO: will mergeTypedStruct give nice error messages? or should I use mergeStructErr directly?
|
# TODO: will mergeTypedStruct give nice error messages? or should I use mergeStructErr directly?
|
||||||
else let
|
else let
|
||||||
templateAttrs = templateNode name nodeAttrs.system;
|
templateAttrs = templateNode name nodeAttrs.system;
|
||||||
r = nib.parse.mergeStruct templateAttrs nodeAttrs;
|
S = nib.parse.parseStructFor templateAttrs nodeAttrs;
|
||||||
in
|
in
|
||||||
nib.types.unwrapRes (_:
|
unwrapRes (_:
|
||||||
abort ''
|
abort ''
|
||||||
Cerulean failed to parse `cerulean.nexus.nodes.${name}`!
|
Cerulean failed to parse `cerulean.nexus.nodes.${name}`!
|
||||||
mergeStruct should never return `result.Err`... How are you here?!?
|
mergeStruct should never return `result.Err`... How are you here?!?
|
||||||
'')
|
'')
|
||||||
r;
|
S;
|
||||||
|
|
||||||
# TODO: mapNodes = f: mapAttrs (name: nodeAttrs: f name (parseNode name nodeAttrs)) config.nexus.nodes
|
# TODO: mapNodes = f: mapAttrs (name: nodeAttrs: f name (parseNode name nodeAttrs)) config.nexus.nodes
|
||||||
mapNodes = f: mapAttrs f (mapAttrs parseNode config.nexus.nodes);
|
mapNodes = f: mapAttrs f (mapAttrs parseNode config.nexus.nodes);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue