nixfiles/nixos/modules/network.nix

34 lines
825 B
Nix
Raw Normal View History

{ lib, config, ... }:
let
inherit (lib) flatten optional mkIf mkDefault mkMerge;
in
{
config = mkMerge [
{
networking = {
domain = mkDefault "int.nul.ie";
useDHCP = false;
enableIPv6 = mkDefault true;
useNetworkd = mkDefault true;
};
2022-05-18 23:29:52 +01:00
2022-05-23 00:57:25 +01:00
services.resolved = {
domains = [ config.networking.domain ];
# Explicitly unset fallback DNS (Nix module will not allow for a blank config)
extraConfig = ''
FallbackDNS=
'';
};
}
(mkIf config.my.build.isDevVM {
networking.interfaces.eth0.useDHCP = mkDefault true;
virtualisation = {
forwardPorts = flatten [
(optional config.services.openssh.openFirewall { from = "host"; host.port = 2222; guest.port = 22; })
];
};
})
];
}