-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdefault.nix
60 lines (45 loc) · 1.31 KB
/
default.nix
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{ pkgs ? import <nixpkgs> {} }:
let
kind = pkgs.callPackage ./nix/kind.nix {};
helloApp = pkgs.callPackage ./hello-app {};
kubenix = pkgs.callPackage ./nix/kubenix.nix {};
wait-for-deployment = pkgs.callPackage ./nix/wait-for-deployment.nix {};
buildConfig = t: kubenix.buildResources { configuration = import ./configuration.nix { type = t; }; };
appImage = pkgs.dockerTools.buildLayeredImage {
name = "hello-app";
tag = "latest";
config.Cmd = [ "${helloApp}/bin/hello-app" ];
};
in
rec {
app = helloApp;
test-deployment = pkgs.callPackage ./nix/test-deployment.nix {
inherit kind;
};
deploy-to-kind = pkgs.callPackage ./nix/deploy-to-kind.nix {
config = buildConfig "dev";
inherit kind;
inherit appImage;
};
deploy-and-test = pkgs.mkShell {
buildInputs = [ kind deploy-to-kind test-deployment wait-for-deployment ];
shellHook = ''
deploy-to-kind
export KUBECONFIG=$(kind get kubeconfig-path)
wait-for-deployment hello
test-deployment
kind delete cluster
'';
};
shell = pkgs.mkShell {
buildInputs = [
kind
deploy-to-kind
test-deployment
wait-for-deployment
pkgs.curl
pkgs.docker
pkgs.kubectl
];
};
}