blob: e8cbc195c286aca5f608f8ac3acf3676985c1305 (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
{ channel ? "stable", pkgs ? import <nixpkgs> {} }:
let
helloService = pkgs.callPackage ./service-hello {};
worldService = pkgs.callPackage ./service-world {};
joinerService = pkgs.callPackage ./service-joiner {};
kubenix = pkgs.callPackage ./nix/kubenix.nix {};
buildConfig = t: kubenix.buildResources { configuration = import ./configuration.nix { type = t; }; };
helloImage = pkgs.dockerTools.buildLayeredImage {
name = "hello-service";
tag = "latest";
config.Cmd = [ "${helloService}/bin/service-hello" ];
};
worldImage = pkgs.dockerTools.buildLayeredImage {
name = "world-service";
tag = "latest";
config.Cmd = [ "${worldService}/bin/service-world" ];
};
joinerImage = pkgs.dockerTools.buildLayeredImage {
name = "joiner-service";
tag = "latest";
config.Cmd = [ "${joinerService}/bin/service-joiner" ];
};
in rec {
inherit helloImage worldImage joinerImage;
test-deployment = pkgs.callPackage ./nix/test-deployment.nix { };
deploy-to-kind = pkgs.callPackage ./nix/deploy-to-kind.nix {
inherit helloImage worldImage joinerImage;
config = buildConfig "dev";
};
config = buildConfig "dev";
redeploy = pkgs.writeScriptBin "redeploy" ''
cat ${config} | ${pkgs.kubectl}/bin/kubectl apply -f -
'';
deploy-and-test = pkgs.mkShell {
buildInputs = [ pkgs.kind deploy-to-kind test-deployment ];
shellHook = ''
deploy-to-kind
export KUBECONFIG=$(kind get kubeconfig-path)
wait-for-deployment hello
test-deployment
kind delete cluster
'';
};
shell = let
moz_overlay = import (
builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz
);
pkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
rustchannel = pkgs.rustChannelOf { inherit channel; };
in
pkgs.mkShell {
buildInputs = with pkgs; [
kind
deploy-to-kind
test-deployment
redeploy
curl
docker
kubectl
rustchannel.rust-std
rustchannel.rust
rustchannel.rustc
rustchannel.cargo
cmake
curl
gcc
openssl
pkgconfig
];
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang}/lib";
};
}
|