diff --git a/README.md b/README.md index f42e53f..45957f2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # emilys Nix Infra +[Build Status](https://hydra.kyouma.net/jobset/nixfiles/main#tabs-jobs) + ## First deployment ### remote hosts @@ -10,7 +12,6 @@ $ nix run github:nix-community/nixos-anywhere -- --flake ".#" roo ### desktops - ```console $ nix --extra-experimental-features nix-command run github:nix-community/nixos-anywhere -- --flake "git+https://git.bsd.gay/snaki/nixfiles.git#" --no-reboot --build-on-target root@127.0.0.1 $ nixos-enter @@ -20,20 +21,15 @@ $ git clone https://git.bsd.gay/snaki/nixfiles.git $ colmena apply-local --sudo --node ``` +## Todo -## Deploy changes on ... + - tomate (router dus) + - kartoffel + - most services + - brokkoli2 (router ams) + - alucard + - merge hetzner hosts -### all hosts - -```console -$ colmena apply --on @production -``` - -### routers only - -```console -$ colmena apply --on @router -``` ## Structure ``` nixfiles diff --git a/pkgs/update-nixfiles/default.nix b/pkgs/update-nixfiles/default.nix new file mode 100644 index 0000000..4c4355c --- /dev/null +++ b/pkgs/update-nixfiles/default.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: + +pkgs.writeShellApplication { + name = "update-nixfiles"; + text = builtins.readFile ./update-nixfiles.sh; + runtimeInputs = with pkgs; [ + curl + jq + nix + gnugrep + ]; +} diff --git a/pkgs/update-nixfiles/update-nixfiles.sh b/pkgs/update-nixfiles/update-nixfiles.sh new file mode 100644 index 0000000..7bc64a5 --- /dev/null +++ b/pkgs/update-nixfiles/update-nixfiles.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -euo pipefail + +BRANCH="update-inputs" +HYDRA_URL="https://hydra.kyouma.net" +JOBSET_URL="${HYDRA_URL}/jobset/nixfiles/update-inputs" +ROOT="$(mktemp -d)" + +test_build () { + local build_jobs + build_jobs="$(curl --fail -s -L -H "Accept: application/json" "${JOBSET_URL}/latest-eval" | jq -r ".builds | .[]")" + for build in ${build_jobs}; do + local build_url + build_status="$(curl -s -L -H "Accept: application/json" "https://hydra.kyouma.net/build/${build}" | jq -r ".buildstatus")" + [[ $build_status != 0 ]] && exit 1 + done +} + +git clone git@git.bsd.gay:snaki/nixfiles.git + +git checkout -b "${BRANCH}" + +nix flake update --commit-lock-file + +git push --set-upstream origin "${BRANCH}"