forked from zentralwerk/network
nixos-module/network.nix: add defaults
This commit is contained in:
parent
7109ae50cb
commit
511b4df85e
|
@ -10,6 +10,7 @@ in {
|
|||
imports = [
|
||||
../lib/config/options.nix
|
||||
./defaults.nix
|
||||
./network.nix
|
||||
]
|
||||
++ optionals (hostConfig.role == "server") [
|
||||
./server/lxc-containers.nix
|
||||
|
|
27
nix/nixos-module/network.nix
Normal file
27
nix/nixos-module/network.nix
Normal 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;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user