about summary refs log tree commit diff stats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/build.sh7
-rwxr-xr-xscripts/check.sh20
-rwxr-xr-xscripts/system_info.sh25
-rwxr-xr-xscripts/test.sh12
4 files changed, 64 insertions, 0 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
new file mode 100755
index 0000000..a3ff064
--- /dev/null
+++ b/scripts/build.sh
@@ -0,0 +1,7 @@
+#! /usr/bin/env sh
+
+for host in "server2" "server3"; do
+    nix build ".#nixosConfigurations.$host.config.system.build.toplevel" --print-out-paths --no-link --option max-jobs 1
+done
+
+# vim: ft=sh
diff --git a/scripts/check.sh b/scripts/check.sh
new file mode 100755
index 0000000..f152cbb
--- /dev/null
+++ b/scripts/check.sh
@@ -0,0 +1,20 @@
+#! /usr/bin/env sh
+
+# --log-format multiline-with-logs \
+nix build \
+    --option max-jobs 1 \
+    --print-out-paths --no-link \
+    .#checks.x86_64-linux.atuin-sync \
+    .#checks.x86_64-linux.back \
+    .#checks.x86_64-linux.deploy-activate \
+    .#checks.x86_64-linux.deploy-schema \
+    .#checks.x86_64-linux.dns \
+    .#checks.x86_64-linux.formatting \
+    .#checks.x86_64-linux.git-server \
+    .#checks.x86_64-linux.rust-motd \
+    .#checks.x86_64-linux.sharkey \
+    .#checks.x86_64-linux.sharkey-cpu \
+    .#checks.x86_64-linux.taskchampion-sync
+# .#checks.x86_64-linux.email-dns \
+# .#checks.x86_64-linux.email-http \
+# .#checks.x86_64-linux.email-ip \
diff --git a/scripts/system_info.sh b/scripts/system_info.sh
new file mode 100755
index 0000000..940406a
--- /dev/null
+++ b/scripts/system_info.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env sh
+
+# Take a host name and return the nix store path to the host's system info.
+# Type
+# _system_info :: String -> Path
+_system_info() {
+    nix --option warn-dirty false build .#nixosConfigurations."$1".config.vhack.system-info.markdown --print-out-paths --no-link
+}
+
+_glow() {
+    if command -v glow >/dev/null; then
+        glow --width 0
+    else
+        cat
+    fi
+}
+
+# The expression is not meant to be expanded by the shell
+# shellcheck disable=SC2016
+nix eval --expr '"${builtins.concatStringsSep "\n" (builtins.attrNames (builtins.fromTOML (builtins.readFile ./hosts/host-names.toml)))}\n"' --impure --raw | while read -r host; do
+    echo "# $host" | _glow
+    _glow <"$(_system_info "$host")"
+done
+
+# vim: ft=sh
diff --git a/scripts/test.sh b/scripts/test.sh
new file mode 100755
index 0000000..58c3343
--- /dev/null
+++ b/scripts/test.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env sh
+
+test_target="$1"
+
+[ -z "$test_target" ] && {
+    echo "You need to select a test target!" 1>&2
+    echo "Usage: test_interactive TEST_TARGET" 1>&2
+    exit 1
+}
+
+nix build --log-format multiline-with-logs .#checks.x86_64-linux."$test_target"
+# vim: ft=sh