aboutsummaryrefslogtreecommitdiff
path: root/examples/simple/flake.nix
blob: d44b88851e88cf00360c033619eb006b5897aa08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# SPDX-FileCopyrightText: 2020 Serokell <https://serokell.io/>
#
# SPDX-License-Identifier: MPL-2.0

{
  description = "Deploy GNU hello to localhost";

  inputs.deploy-rs.url = "github:serokell/deploy-rs";

  outputs = { self, nixpkgs, deploy-rs }:
    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
    {

      deploy.nodes.example = {
        hostname = "localhost";
        profiles.hello = {
          user = "balsoft";
          path = deploy-rs.lib.x86_64-linux.setActivate nixpkgs.legacyPackages.x86_64-linux.hello "./bin/hello";
        };
      };

      checks = { "x86_64-linux" = { jsonSchema = deploy-rs.lib.x86_64-linux.checkSchema self.deploy; }; };
    };
}