diff options
author | Azat Bahawi <azat@bahawi.net> | 2024-03-31 21:29:27 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2024-03-31 21:29:27 +0300 |
commit | 9a5427e3a0c0ccf2a82dc503149a26b23fbd6004 (patch) | |
tree | f28beec29deeea36038615a8fb98a810891940b5 /modules/common/openssh.nix | |
parent | 2024-03-19 (diff) |
2024-03-31
Diffstat (limited to '')
-rw-r--r-- | modules/common/openssh.nix | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/modules/common/openssh.nix b/modules/common/openssh.nix index ecaf4de..f60a1ef 100644 --- a/modules/common/openssh.nix +++ b/modules/common/openssh.nix @@ -4,11 +4,12 @@ pkgs, ... }: -with lib; let +with lib; +let cfg = config.nixfiles.modules.openssh; -in { - options.nixfiles.modules.openssh.client.enable = - mkEnableOption "OpenSSH client"; +in +{ + options.nixfiles.modules.openssh.client.enable = mkEnableOption "OpenSSH client"; config = mkIf cfg.client.enable { hm = { @@ -29,26 +30,35 @@ in { serverAliveCountMax = 30; serverAliveInterval = 60; - matchBlocks = let - mkBlock = name: { - hostname ? name, - port ? 22022, # NOTE This is not the default OpenSSH port. - user ? my.username, - identityFile ? "${config.my.home}/.ssh/${my.username}_${my.ssh.type}", - extraAttrs ? {}, - }: - nameValuePair name ({inherit hostname port user identityFile;} - // extraAttrs); + matchBlocks = + let + mkBlock = + name: + { + hostname ? name, + port ? 22022, # NOTE This is not the default OpenSSH port. + user ? my.username, + identityFile ? "${config.my.home}/.ssh/${my.username}_${my.ssh.type}", + extraAttrs ? { }, + }: + nameValuePair name ( + { + inherit + hostname + port + user + identityFile + ; + } + // extraAttrs + ); - internalServers = - mapAttrs' mkBlock - (mapAttrs (name: _: { - hostname = "${name}.${my.domain.shire}"; - }) (filterAttrs (_: attr: - hasAttr "wireguard" attr - && attr.isHeadless) - my.configurations)); - in + internalServers = mapAttrs' mkBlock ( + mapAttrs (name: _: { hostname = "${name}.${my.domain.shire}"; }) ( + filterAttrs (_: attr: hasAttr "wireguard" attr && attr.isHeadless) my.configurations + ) + ); + in internalServers // (mapAttrs' mkBlock { gitolite = { |