modules/nixfiles: add modules for system hydra sync
This commit is contained in:
parent
b59909b155
commit
d0c88d4e6a
@ -13,6 +13,7 @@
|
|||||||
./monitoring
|
./monitoring
|
||||||
./nginx-port-forward
|
./nginx-port-forward
|
||||||
./nixfiles
|
./nixfiles
|
||||||
|
./nixfiles/system-auto-sync-to-hydra.nix
|
||||||
./update-from-hydra
|
./update-from-hydra
|
||||||
./wg-clerie
|
./wg-clerie
|
||||||
./wireguard-initrd
|
./wireguard-initrd
|
||||||
|
29
modules/nixfiles/system-auto-sync-to-hydra.nix
Normal file
29
modules/nixfiles/system-auto-sync-to-hydra.nix
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{ pkgs, lib, config, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.clerie.nixfiles.system-auto-sync-to-hydra;
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
clerie.nixfiles.system-auto-sync-to-hydra = {
|
||||||
|
enable = mkEnableOption "clerie nixfiles tools";
|
||||||
|
allowReboot = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Monitor NixOS";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
systemd.services.nixfiles-system-auto-sync-to-hydra = {
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = pkgs.nixfiles-system-sync-to-hydra + "/bin/nixfiles-system-sync-to-hydra${optionalString cfg.allowReboot " --allow-reboot"}";
|
||||||
|
};
|
||||||
|
startAt = "*-*-* 06:47:00";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -17,7 +17,7 @@ while [[ $# -gt 0 ]]; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
HYDRA_JOB_URL="https://hydra.clerie.de/job/nixfiles/nixfiles/nixosConfigurations.$(hostname)/latest-finished"
|
HYDRA_JOB_URL="https://hydra.clerie.de/job/nixfiles/nixfiles/nixosConfigurations.${HOSTNAME}/latest-finished"
|
||||||
|
|
||||||
echo "Fetching job output from ${HYDRA_JOB_URL}"
|
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")"
|
STORE_PATH="$(curl --fail -s -L -H "Accept: application/json" "${HYDRA_JOB_URL}" | jq -r ".buildoutputs.out.path")"
|
||||||
|
Loading…
Reference in New Issue
Block a user