60 lines
1.5 KiB
Nix
60 lines
1.5 KiB
Nix
# SPDX-FileCopyrightText: 2025 Ethan Reece <contact@ethanreece.com>
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
{ flakeConfig, lib, ... }:
|
|
{
|
|
programs.ssh = {
|
|
matchBlocks =
|
|
let
|
|
baseDomain = flakeConfig.profiles.utdallas.domains.default;
|
|
user = flakeConfig.profiles.utdallas.shortNames.default;
|
|
proxyJump = "pubssh.${baseDomain}";
|
|
twoDigit =
|
|
n:
|
|
let
|
|
numStr = toString n;
|
|
in
|
|
if n < 10 then "0${numStr}" else numStr;
|
|
in
|
|
{
|
|
${proxyJump} = { inherit user; };
|
|
}
|
|
// builtins.listToAttrs (
|
|
lib.concatMap (
|
|
i:
|
|
let
|
|
hostname = "dc${twoDigit i}.${baseDomain}";
|
|
in
|
|
[
|
|
{
|
|
name = "dc${twoDigit i}";
|
|
value = { inherit hostname user; };
|
|
}
|
|
{
|
|
name = "dc${twoDigit i}-proxy";
|
|
value = { inherit hostname user proxyJump; };
|
|
}
|
|
]
|
|
) (lib.range 1 40)
|
|
)
|
|
// builtins.listToAttrs (
|
|
lib.concatMap (
|
|
i:
|
|
let
|
|
hostname = "cslinux${toString i}.${baseDomain}";
|
|
in
|
|
[
|
|
{
|
|
name = "utdallas${toString i}";
|
|
value = { inherit hostname user; };
|
|
}
|
|
{
|
|
name = "utdallas${toString i}-proxy";
|
|
value = { inherit hostname user proxyJump; };
|
|
}
|
|
]
|
|
) (lib.range 1 3)
|
|
);
|
|
};
|
|
}
|