mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
19 lines
634 B
Nix
19 lines
634 B
Nix
{ pkgs, hosts, groups }:
|
|
|
|
with pkgs.lib;
|
|
|
|
(mapAttrs (name: hosts:
|
|
''
|
|
#!${pkgs.runtimeShell}
|
|
export PATH=
|
|
nix build --no-link ${concatMapStringsSep " " (host: builtins.unsafeDiscardStringContext host.config.system.build.toplevel.drvPath) hosts}
|
|
${concatMapStrings (host: ''
|
|
echo "deploying ${host.config.networking.hostName}..."
|
|
${host.config.system.build.deployScript} $1 &
|
|
PID_LIST+=" $!"
|
|
'') hosts}
|
|
# FIXME: remove jobs from PIDLIST once they finish
|
|
trap "kill $PID_LIST" SIGINT
|
|
wait $PID_LIST
|
|
'') groups)
|
|
// (mapAttrs (name: host: host.config.system.build.deployScript) hosts)
|