krebs: move retiolum-hosts to dedicated file
This commit is contained in:
parent
da79d23ebb
commit
799f132d58
@ -43,6 +43,7 @@ let
|
|||||||
./Reaktor.nix
|
./Reaktor.nix
|
||||||
./realwallpaper.nix
|
./realwallpaper.nix
|
||||||
./retiolum-bootstrap.nix
|
./retiolum-bootstrap.nix
|
||||||
|
./retiolum-hosts.nix
|
||||||
./rtorrent.nix
|
./rtorrent.nix
|
||||||
./secret.nix
|
./secret.nix
|
||||||
./setuid.nix
|
./setuid.nix
|
||||||
@ -147,29 +148,6 @@ let
|
|||||||
) cfg.hosts
|
) cfg.hosts
|
||||||
));
|
));
|
||||||
|
|
||||||
# TODO dedup with networking.extraHosts
|
|
||||||
nixpkgs.config.packageOverrides = oldpkgs:
|
|
||||||
let
|
|
||||||
domains = attrNames (filterAttrs (_: eq "hosts") cfg.dns.providers);
|
|
||||||
check = hostname: any (domain: hasSuffix ".${domain}" hostname) domains;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
retiolum-hosts = oldpkgs.writeText "retiolum-hosts" ''
|
|
||||||
${concatStringsSep "\n" (flatten (
|
|
||||||
map (host:
|
|
||||||
let
|
|
||||||
net = host.nets.retiolum;
|
|
||||||
aliases = longs;
|
|
||||||
longs = filter check net.aliases;
|
|
||||||
in
|
|
||||||
optionals
|
|
||||||
(aliases != [])
|
|
||||||
(map (addr: "${addr} ${toString aliases}") net.addrs)
|
|
||||||
) (filter (host: hasAttr "retiolum" host.nets)
|
|
||||||
(attrValues cfg.hosts))))}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
services.openssh.hostKeys =
|
services.openssh.hostKeys =
|
||||||
let inherit (config.krebs.build.host.ssh) privkey; in
|
let inherit (config.krebs.build.host.ssh) privkey; in
|
||||||
mkIf (privkey != null) (mkForce [privkey]);
|
mkIf (privkey != null) (mkForce [privkey]);
|
||||||
|
28
krebs/3modules/retiolum-hosts.nix
Normal file
28
krebs/3modules/retiolum-hosts.nix
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
with import <stockholm/lib>;
|
||||||
|
{ config, ... }: let
|
||||||
|
# TODO dedup functions with networking.extraHosts
|
||||||
|
check = hostname: any (domain: hasSuffix ".${domain}" hostname) domains;
|
||||||
|
domains = attrNames (filterAttrs (_: eq "hosts") config.krebs.dns.providers);
|
||||||
|
in {
|
||||||
|
nixpkgs.config.packageOverrides = super: {
|
||||||
|
retiolum-hosts =
|
||||||
|
super.writeText "retiolum-hosts" ''
|
||||||
|
${
|
||||||
|
concatStringsSep
|
||||||
|
"\n"
|
||||||
|
(flatten
|
||||||
|
(map
|
||||||
|
(host: let
|
||||||
|
net = host.nets.retiolum;
|
||||||
|
aliases = longs;
|
||||||
|
longs = filter check net.aliases;
|
||||||
|
in
|
||||||
|
optionals
|
||||||
|
(aliases != [])
|
||||||
|
(map (addr: "${addr} ${toString aliases}") net.addrs))
|
||||||
|
(filter (host: hasAttr "retiolum" host.nets)
|
||||||
|
(attrValues config.krebs.hosts))))
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user