From 104d64f23ff25edeaf75b1d57dfb6f9539560d3a Mon Sep 17 00:00:00 2001 From: Ryan Lahfa Date: Sun, 8 Dec 2024 12:20:10 +0100 Subject: [PATCH] feat(scripts/cache-node): support non-NixOS systems Signed-off-by: Ryan Lahfa --- scripts/cache-node.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) mode change 100644 => 100755 scripts/cache-node.sh diff --git a/scripts/cache-node.sh b/scripts/cache-node.sh old mode 100644 new mode 100755 index 590a605..410403c --- a/scripts/cache-node.sh +++ b/scripts/cache-node.sh @@ -3,7 +3,25 @@ set -o nounset set -o pipefail shopt -s lastpipe -drv=$(colmena eval --instantiate -E "{ nodes, ... }: nodes.${BUILD_NODE}.config.system.build.toplevel") +system_type="$(colmena eval -E "{ nodes, ... }: nodes.${BUILD_NODE}.config.deployment.systemType")" +# Get rid of surrounding quotes. +system_type="${system_type%\"}" +system_type="${system_type#\"}" + +case "$system_type" in + nixos) + toplevel_path="config.system.build.toplevel" + ;; + zyxel-nwa50ax) + toplevel_path="config.system.outputs.zyxel-nwa-fit" + ;; + *) + echo "Unsupported system type '$system_type' for caching; add an entry in 'scripts/cache-node.sh'" + exit 1 + ;; +esac + +drv=$(colmena eval --instantiate -E "{ nodes, ... }: nodes.${BUILD_NODE}.${toplevel_path}" --show-trace) # Build the derivation and send it to the great beyond nix-store --query --requisites --force-realise --include-outputs "$drv" | grep -v '.*\.drv' >paths.txt