avoid the with keyword
This commit is contained in:
parent
0b13998fd4
commit
08ceff4581
1 changed files with 126 additions and 127 deletions
27
flake.nix
27
flake.nix
|
|
@ -35,18 +35,15 @@
|
|||
nib,
|
||||
deploy-rs,
|
||||
...
|
||||
} @ inputs:
|
||||
with builtins;
|
||||
with nib.types; let
|
||||
} @ inputs: let
|
||||
lib = nixpkgs.lib;
|
||||
|
||||
sys = with nib;
|
||||
mkUSys {
|
||||
pkgs = withPkgs nixpkgs {
|
||||
sys = nib.mkUSys {
|
||||
pkgs = nib.withPkgs nixpkgs {
|
||||
config.allowUnfree = false;
|
||||
overlays = attrValues self.overlays;
|
||||
overlays = builtins.attrValues self.overlays;
|
||||
};
|
||||
upkgs = withPkgs nixpkgs-unstable {
|
||||
upkgs = nib.withPkgs nixpkgs-unstable {
|
||||
config.allowUnfree = false;
|
||||
};
|
||||
};
|
||||
|
|
@ -67,6 +64,8 @@
|
|||
mkNexusConfig = config: let
|
||||
# abstract node instance that stores all default values
|
||||
templateNode = name: system: let
|
||||
Terminal = nib.types.Terminal;
|
||||
|
||||
missing = msg: path:
|
||||
Terminal (abort ''
|
||||
Each Cerulean Nexus node is required to specify ${msg}!
|
||||
|
|
@ -104,11 +103,11 @@
|
|||
};
|
||||
|
||||
parseNode = name: nodeAttrs:
|
||||
if !(isAttrs nodeAttrs)
|
||||
if !(builtins.isAttrs nodeAttrs)
|
||||
then
|
||||
# fail if node is not an attribute set
|
||||
abort ''
|
||||
Cerulean Nexus nodes must be provided as an attribute set, got "${typeOf nodeAttrs}" instead!
|
||||
Cerulean Nexus nodes must be provided as an attribute set, got "${builtins.typeOf nodeAttrs}" instead!
|
||||
Ensure all `cerulean.nexus.nodes.${name}` declarations are attribute sets under your call to `cerulean.mkNexus`.
|
||||
''
|
||||
# TODO: nodeAttrs.system won't display any nice error messages!!
|
||||
|
|
@ -117,7 +116,7 @@
|
|||
templateAttrs = templateNode name nodeAttrs.system;
|
||||
S = nib.parse.parseStructFor templateAttrs nodeAttrs;
|
||||
in
|
||||
unwrapRes (_:
|
||||
nib.types.unwrapRes (_:
|
||||
abort ''
|
||||
Cerulean failed to parse `cerulean.nexus.nodes.${name}`!
|
||||
mergeStruct should never return `result.Err`... How are you here?!?
|
||||
|
|
@ -125,7 +124,7 @@
|
|||
S;
|
||||
|
||||
# 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: builtins.mapAttrs f (builtins.mapAttrs parseNode config.nexus.nodes);
|
||||
in rec {
|
||||
nixosConfigurations = mapNodes (
|
||||
_: node:
|
||||
|
|
@ -161,14 +160,14 @@
|
|||
sshOpts =
|
||||
node.deploy.ssh.opts
|
||||
++ (
|
||||
if elem "-p" node.deploy.ssh.opts
|
||||
if builtins.elem "-p" node.deploy.ssh.opts
|
||||
then []
|
||||
else ["-p" (toString node.deploy.ssh.port)]
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
checks = mapAttrs (system: deployLib: deployLib.deployChecks deploy) deploy-rs.lib;
|
||||
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks deploy) deploy-rs.lib;
|
||||
};
|
||||
|
||||
mkNexus = outputs: let
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue