36 lines
1.0 KiB
Nix
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
|
|
|