aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authornotgne22020-10-05 19:46:28 -0700
committernotgne22020-10-05 19:46:28 -0700
commit7c00fd2761e6efffe763ece5d08d9a6d3fb95092 (patch)
tree9d4030bd4788bec3eb4783adc38130536d8fa696 /flake.nix
parent5674670a59168fb05f26e5b4fb41dd2662810e94 (diff)
Add interface with json schema, fix flake-less issues, put setActivate and jsonSchema check in flake lib
Diffstat (limited to '')
-rw-r--r--flake.nix25
1 files changed, 24 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index d3d1817..9cfaa49 100644
--- a/flake.nix
+++ b/flake.nix
@@ -14,12 +14,35 @@
let
pkgs = import nixpkgs { inherit system; };
naersk-lib = pkgs.callPackage naersk { };
- in {
+ setActivate = base: activate: pkgs.symlinkJoin {
+ name = ("activatable-" + base.name);
+ paths = [
+ base
+ (pkgs.writeTextFile {
+ name = base.name + "-activate-path";
+ text = ''
+ #!${pkgs.runtimeShell}
+ ${activate}
+ '';
+ executable = true;
+ destination = "/activate";
+ })
+ ];
+ };
+ in
+ {
defaultPackage = naersk-lib.buildPackage ./.;
defaultApp = {
type = "app";
program = "${self.defaultPackage."${system}"}/bin/deploy";
};
+
+ lib = {
+ inherit setActivate;
+
+ 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";
+ };
});
}