aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotgne22020-10-26 11:29:01 -0700
committernotgne22020-10-26 11:29:01 -0700
commit8b3b91344abe6b6361b22943a0176e41fb2d585c (patch)
tree6cd7116bd2ff19e5e8dbf2c9004dbfb636c2df3d
parent155f4bf45204b3090cc07271d2648ac7c024bbd1 (diff)
Improve checks usage, add check for activation script existing
Diffstat (limited to '')
-rw-r--r--flake.nix24
1 files changed, 21 insertions, 3 deletions
diff --git a/flake.nix b/flake.nix
index 73aa802..fe24754 100644
--- a/flake.nix
+++ b/flake.nix
@@ -34,7 +34,7 @@
program = "${self.defaultPackage."${system}"}/bin/deploy";
};
- lib = {
+ lib = rec {
setActivate = base: activate: pkgs.buildEnv {
name = ("activatable-" + base.name);
paths = [
@@ -51,8 +51,26 @@
];
};
- checkSchema = deploy: pkgs.runCommandNoCC "jsonschema-deploy-system" { }
- "${pkgs.python3.pkgs.jsonschema}/bin/jsonschema -i ${pkgs.writeText "deploy.json" (builtins.toJSON deploy)} ${./interface/deploy.json} && touch $out";
+ # DEPRECATED
+ checkSchema = checks.schema;
+
+ deployChecks = deploy: builtins.mapAttrs (_: check: check deploy) checks;
+
+ checks = {
+ schema = deploy: pkgs.runCommandNoCC "jsonschema-deploy-system" { } ''
+ ${pkgs.python3.pkgs.jsonschema}/bin/jsonschema -i ${pkgs.writeText "deploy.json" (builtins.toJSON deploy)} ${./interface/deploy.json} && touch $out
+ '';
+
+ activate = deploy:
+ let
+ allPaths = pkgs.lib.flatten (pkgs.lib.mapAttrsToList (nodeName: node: pkgs.lib.mapAttrsToList (profileName: profile: profile.path) node.profiles) deploy.nodes);
+ in
+ pkgs.runCommandNoCC "deploy-rs-check-activate" { } ''
+ for i in ${builtins.concatStringsSep " " allPaths}; do test -f "$i/deploy-rs-activate" || (echo "A profile path is missing an activation script" && exit 1); done
+
+ touch $out
+ '';
+ };
};
});
}