Files
infrastructure/packages/ssh_to_hosts.nix
kalipso 44cbc96e0d
Check flake syntax / flake-check (push) Successful in 7m26s
Hydra callback / on_push (pull_request) Skipped
Hydra callback / on_pr (pull_request) Successful in 8m32s
[scripts] init malobeo ssh commands
they are not yet working, its just placeholders
2026-11-03 18:16:06 +01:00

36 lines
1.0 KiB
Nix

{ malobeo, peers, pkgs, lib, ... }:
#mapAttrs' (name: value: nameValuePair ("foo_" + name) ("bar-" + value))
let
get_ip = hostname: malobeo.hosts.${hostname}.network.address;
generate_ssh_command = hostname: hostConfig: (
if hostConfig.network.local == true then
if hostname == "fanny" then
"ssh admin@${malobeo.hosts."fanny".network.address}"
else
"ssh -J admin@${malobeo.hosts."fanny".network.address} admin@${get_ip hostname}"
else
"offsite"
);
in
(lib.attrsets.mapAttrs' (hostname: hostConfig: lib.nameValuePair
("malobeo-ssh-${hostname}")
(pkgs.writeShellScriptBin "malobeo-ssh-${hostname}"
''
#!/bin/sh
echo "${hostname} ${generate_ssh_command hostname hostConfig}"
'')) malobeo.hosts )
#{
# test-pkg = pkgs.writeShellScriptBin "run-vm" (builtins.readFile ../scripts/run-vm.sh);
#}
# microvm
# - local:
# - yes: ssh through fanny
# - no: if in peers.nix -> ssh through vpn, else not possible
# not microvm:
# - local:
# - yes: ssh through fanny (except for fanny)
# - no: not supported