Commit 9a93582d7523
Changed files (5)
bin/__dispatch.sh
@@ -19,6 +19,9 @@ case "${TARGET_TOOL}" in
bus)
attr="tools.bus"
;;
+ k8s.infra)
+ attr="tools.k8s_infra"
+ ;;
*)
echo "The tool '${TARGET_TOOL}' is currently not installed in this repository."
exit 1
bin/k8s.infra
@@ -0,0 +1,1 @@
+__dispatch.sh
\ No newline at end of file
tools/k8s.infra/default.nix
@@ -0,0 +1,11 @@
+{ stdenv }:
+
+stdenv.mkDerivation {
+ name = "k8s.infra";
+ src = ./.;
+ phases = [ "installPhase" "fixupPhase" ];
+ installPhase = ''
+ mkdir -p $out $out/bin
+ cp $src/k8s.infra.sh $out/bin/k8s.infra
+ '';
+}
tools/k8s.infra/k8s.infra.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+# univ: update niv (and generate a nice commit)
+
+set -euo pipefail
+
+HOST=${HOST:-wakasu.home}
+RSYNC_COMMAND="rsync -avzHXShPse ssh --progress"
+
+main() {
+ for n in k8sn1 k8sn2 k8sn3; do
+ logs=$(mktemp)
+ output=$(mktemp)
+ echo "Build ${n} node (logs: ${logs})…"
+ nixos-generate -f qcow -c ./systems/hosts/${n}.nix 2>${logs} 1>${output}
+ echo "Syncthing image to ${HOST}…"
+ ${RSYNC_COMMAND} $(cat ${output} | tr -d '\n') root@${HOST}:/var/lib/libvirt/images/${n}.qcow2 --dry-run
+ done
+}
+
+main $@
default.nix
@@ -11,4 +11,5 @@ in
tools.bus = pkgs.callPackage ./tools/bus { };
tools.univ = pkgs.callPackage ./tools/univ { };
tools.system = pkgs.callPackage ./tools/system { };
+ tools.k8s_infra = pkgs.callPackage ./tools/k8s.infra { };
}