hydra: output machine host key as base64 in the generated machines.conf

This commit is contained in:
Pierre Bourdon 2024-07-10 02:16:45 +02:00
parent f214da9228
commit f2c2bc5ab6
Signed by: delroth
GPG key ID: 6FB80DCD84DA0F1C

View file

@ -11,8 +11,10 @@ let
lib.mapAttrsToList (k: v: "${k}=${v}") settings
);
# XXX: to support Nix's dumb public host key syntax (base64'd), this outputs
# a string with shell-style command interpolations: $(...).
mkBaremetalBuilder = { nrCores, publicHostKey, host, speedFactor ? 1, user ? "builder", supportedSystems ? [ "i686-linux" "x86_64-linux" ], supportedFeatures ? [ "big-parallel" "kvm" "nixos-test" ] }:
"ssh://${user}@${host} ${lib.concatStringsSep "," supportedSystems} ${config.age.secrets.hydra-ssh-key-priv.path} ${toString nrCores} ${toString speedFactor} ${lib.concatStringsSep "," supportedFeatures} - ${publicHostKey}";
"ssh://${user}@${host} ${lib.concatStringsSep "," supportedSystems} ${config.age.secrets.hydra-ssh-key-priv.path} ${toString nrCores} ${toString speedFactor} ${lib.concatStringsSep "," supportedFeatures} - $(echo -n '${publicHostKey}' | base64 -w0)";
# TODO:
# - generalize to new architectures
@ -76,7 +78,11 @@ in {
package = pkgs.hydra;
buildMachinesFiles = [
(pkgs.writeText "hydra-builders.conf" baremetalBuilders)
(pkgs.runCommandNoCC "hydra-builders.conf" {} ''
cat >$out <<EOF
${baremetalBuilders}
EOF
'')
];
extraConfig = ''