30 lines
640 B
Nix
30 lines
640 B
Nix
{
|
|
inputs,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
fleet = lib.attrsets.foldlAttrs (
|
|
acc: name: nixos:
|
|
acc
|
|
++ (
|
|
if
|
|
nixos.config.khscodes.infrastructure.hetzner-instance.enable
|
|
|| nixos.config.khscodes.infrastructure.khs-openstack-instance.enable
|
|
then
|
|
[ ">&2 echo \"Updating ${name}\n\"\nupdate-instance ${lib.escapeShellArg name}" ]
|
|
else
|
|
[ ]
|
|
)
|
|
) [ ] inputs.self.nixosConfigurations;
|
|
in
|
|
pkgs.writeShellApplication {
|
|
name = "update-fleet";
|
|
runtimeInputs = [
|
|
pkgs.khscodes.update-instance
|
|
];
|
|
text = ''
|
|
${lib.strings.concatStringsSep "\n>&2 echo \"\"\n" fleet}
|
|
'';
|
|
}
|