nixos-module/network.nix: add defaults

This commit is contained in:
Astro 2021-03-24 23:37:09 +01:00
parent 7109ae50cb
commit 511b4df85e
2 changed files with 28 additions and 0 deletions

View File

@ -10,6 +10,7 @@ in {
imports = [
../lib/config/options.nix
./defaults.nix
./network.nix
]
++ optionals (hostConfig.role == "server") [
./server/lxc-containers.nix

View File

@ -0,0 +1,27 @@
{ hostName, config, lib, pkgs, ... }:
{
networking.firewall.enable = lib.mkDefault false;
networking.useHostResolvConf = false;
services.resolved.enable = false;
environment.etc."resolv.conf".text = ''
nameserver 172.20.73.8 9.9.9.9
'';
systemd.network = {
enable = true;
networks =
builtins.mapAttrs (ifName: { gw, gw6, ... }: {
matchConfig.Name = ifName;
# addresses = [ {
# addressConfig.Address = "127.0.0.1/8";
# } ];
# TODO: lookup hostname
gateway = with lib;
optional (gw != null) gw ++
optional (gw6 != null) gw6;
}) config.site.hosts.${hostName}.interfaces;
};
}