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 /examples/system/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 'examples/system/flake.nix')
-rw-r--r-- | examples/system/flake.nix | 87 |
1 files changed, 32 insertions, 55 deletions
diff --git a/examples/system/flake.nix b/examples/system/flake.nix index 68cf3ce..32fefa1 100644 --- a/examples/system/flake.nix +++ b/examples/system/flake.nix @@ -5,65 +5,42 @@ { description = "Deploy a full system with hello service as a separate profile"; - outputs = { self, nixpkgs }: - let - setActivate = base: activate: nixpkgs.legacyPackages.x86_64-linux.symlinkJoin { - name = ("activatable-" + base.name); - paths = [ - base - (nixpkgs.legacyPackages.x86_64-linux.writeTextFile { - name = base.name + "-activate-path"; - text = '' - #!${nixpkgs.legacyPackages.x86_64-linux.runtimeShell} - ${activate} - ''; - executable = true; - destination = "/activate"; - }) - ]; - }; - in - { - nixosConfigurations.example-nixos-system = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ ./configuration.nix ]; - }; + inputs.deploy-rs.url = "github:serokell/deploy-rs"; - nixosConfigurations.bare = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = - [ ./bare.nix "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" ]; - }; + outputs = { self, nixpkgs, deploy-rs }: { + nixosConfigurations.example-nixos-system = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ ./configuration.nix ]; + }; - # This is the application we actually want to run - defaultPackage.x86_64-linux = import ./hello.nix nixpkgs; + nixosConfigurations.bare = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = + [ ./bare.nix "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" ]; + }; - deploy.nodes.example = { - sshOpts = [ "-p" "2221" ]; - hostname = "localhost"; - fastConnection = true; - profiles = { - system = { - sshUser = "admin"; - path = - setActivate self.nixosConfigurations.example-nixos-system.config.system.build.toplevel "./bin/switch-to-configuration switch"; - user = "root"; - }; - hello = { - sshUser = "hello"; - path = setActivate self.defaultPackage.x86_64-linux "./bin/activate"; - user = "hello"; - }; + # This is the application we actually want to run + defaultPackage.x86_64-linux = import ./hello.nix nixpkgs; + + deploy.nodes.example = { + sshOpts = [ "-p" "2221" ]; + hostname = "localhost"; + fastConnection = true; + profiles = { + system = { + sshUser = "admin"; + path = + deploy-rs.lib.x86_64-linux.setActivate self.nixosConfigurations.example-nixos-system.config.system.build.toplevel "./bin/switch-to-configuration switch"; + user = "root"; + }; + hello = { + sshUser = "hello"; + path = deploy-rs.lib.x86_64-linux.setActivate self.defaultPackage.x86_64-linux "./bin/activate"; + user = "hello"; }; }; - - checks = builtins.mapAttrs - (_: pkgs: { - jsonschema = pkgs.runCommandNoCC "jsonschema-deploy-system" { } - "${pkgs.python3.pkgs.jsonschema}/bin/jsonschema -i ${ - pkgs.writeText "deploy.json" (builtins.toJSON self.deploy) - } ${../../interface/deploy.json} && touch $out"; - }) - nixpkgs.legacyPackages; }; + + checks = { "x86_64-linux" = { jsonSchema = deploy-rs.lib.x86_64-linux.checkSchema self.deploy; }; }; + }; } |