1
0
Fork 0
nixfiles/pkgs/nixfiles/nixfiles-system-sync-to-hyd...

20 lines
623 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
HYDRA_JOB_URL="https://hydra.clerie.de/job/nixfiles/nixfiles/nixosConfigurations.$(hostname)/latest-finished"
echo "Fetching job output from ${HYDRA_JOB_URL}"
STORE_PATH="$(curl --fail -s -L -H "Accept: application/json" "${HYDRA_JOB_URL}" | jq -r ".buildoutputs.out.path")"
echo "Download ${STORE_PATH}"
nix copy --from "https://nix-cache.clerie.de" "${STORE_PATH}"
echo "Add to system profile"
nix-env -p "/nix/var/nix/profiles/system" --set "${STORE_PATH}"
echo "Activate system"
/nix/var/nix/profiles/system/bin/switch-to-configuration switch
echo "Finished system upgrade"