This commit is contained in:
Sandro - 2021-10-03 00:22:01 +02:00
parent 469c2e9393
commit 2ab3e1bdb4
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
2 changed files with 32 additions and 30 deletions

View File

@ -1,4 +1,4 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
{
imports = [

View File

@ -253,36 +253,38 @@ in {
};
};
programs.vim.defaultEditor = true;
programs = {
ssh.knownHosts = with builtins;
let
hostNames = hostRegistry.hqLocal;
intersectKeys = intersectAttrs {
publicKey = null;
publicKeyFile = null;
};
list = map (name:
let
host = getAttr name hostRegistry.hosts;
sshAttrs = intersectKeys host;
in if sshAttrs == { } then
null
else {
inherit name;
value = let
ip6 = if hasAttr "ip6" host then
host.ip6
else
toHqPrivateAddress name;
in {
publicKey = null;
publicKeyFile = null;
hostNames = [ ip6 "${name}.hq.c3d2.de" "${name}.hq" name ];
} // sshAttrs;
}) hostNames;
keyedHosts = filter (x: x != null) list;
in listToAttrs keyedHosts;
programs.ssh.knownHosts = with builtins;
let
hostNames = hostRegistry.hqLocal;
intersectKeys = intersectAttrs {
publicKey = null;
publicKeyFile = null;
};
list = map (name:
let
host = getAttr name hostRegistry.hosts;
sshAttrs = intersectKeys host;
in if sshAttrs == { } then
null
else {
inherit name;
value = let
ip6 = if hasAttr "ip6" host then
host.ip6
else
toHqPrivateAddress name;
in {
publicKey = null;
publicKeyFile = null;
hostNames = [ ip6 "${name}.hq.c3d2.de" "${name}.hq" name ];
} // sshAttrs;
}) hostNames;
keyedHosts = filter (x: x != null) list;
in listToAttrs keyedHosts;
vim.defaultEditor = true;
};
services.mpd.extraConfig = lib.mkIf cfg.hq.enableMpdProxy ''
database {