diff options
author | notgne2 | 2020-10-05 19:46:28 -0700 |
---|---|---|
committer | notgne2 | 2020-10-05 19:46:28 -0700 |
commit | 7c00fd2761e6efffe763ece5d08d9a6d3fb95092 (patch) | |
tree | 9d4030bd4788bec3eb4783adc38130536d8fa696 /flake.nix | |
parent | 5674670a59168fb05f26e5b4fb41dd2662810e94 (diff) |
Add interface with json schema, fix flake-less issues, put setActivate and jsonSchema check in flake lib
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -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"; + }; }); } |