-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
38 lines (33 loc) · 995 Bytes
/
flake.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
{
description = "Kubernetes lab";
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
outputs = inputs:
let
system = "x86_64-linux";
pkgs = import inputs.nixpkgs { inherit system; };
cluster-name = "k8s-tanka-starter";
k8s-tanka-init = pkgs.writeShellScriptBin "k8s-tanka-init" ''
${pkgs.tanka}/bin/tk tool charts vendor
${pkgs.kind}/bin/kind create cluster --name ${cluster-name} --config cluster.yaml --kubeconfig .kubecfg
${pkgs.tanka}/bin/tk apply environments/kind --auto-approve always
'';
k8s-tanka-cleanup = pkgs.writeShellScriptBin "k8s-tanka-cleanup" ''
${pkgs.kind}/bin/kind delete cluster --name ${cluster-name}
'';
dependencies = with pkgs; [
k8s-tanka-init
k8s-tanka-cleanup
jsonnet-bundler
kind
kubectl
kubernetes-helm-wrapped
tanka
];
in
{
devShells.${system}.default = pkgs.mkShell {
packages = dependencies;
KUBECONFIG = ".kubecfg";
};
};
}