2024-12-12 14:41:43 +01:00
|
|
|
# SPDX-FileCopyrightText: 2024 Ryan Lahfa <ryan.lahfa@dgnum.eu>
|
|
|
|
# SPDX-FileCopyrightText: 2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: EUPL-1.2
|
|
|
|
|
2024-11-14 22:01:58 +01:00
|
|
|
set -o errexit
|
|
|
|
set -o nounset
|
|
|
|
set -o pipefail
|
|
|
|
shopt -s lastpipe
|
2024-10-09 21:32:38 +02:00
|
|
|
|
2024-12-08 15:16:21 +01:00
|
|
|
# Remove the `nixpkgs=` default input.
|
|
|
|
export NIX_PATH="nixpkgs="
|
|
|
|
|
2024-12-08 15:15:29 +01:00
|
|
|
system_type="$(colmena eval -E "{ nodes, ... }: nodes.${BUILD_NODE}.config.deployment.systemType" --show-trace)"
|
2024-12-08 12:20:10 +01:00
|
|
|
# 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"
|
|
|
|
;;
|
2024-12-15 21:22:02 +01:00
|
|
|
netconf)
|
|
|
|
toplevel_path="config.netconf.rpc"
|
|
|
|
;;
|
2024-12-08 12:20:10 +01:00
|
|
|
*)
|
|
|
|
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)
|
2024-10-11 14:53:00 +02:00
|
|
|
|
|
|
|
# Build the derivation and send it to the great beyond
|
2024-12-21 14:01:10 +01:00
|
|
|
push-to-cache "$(nix-store --realise "$drv")"
|