panacea/modules/networking.nix

46 lines
1002 B
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
{
environment.systemPackages = with pkgs; [ avahi wireguard ];
# Set hostname, hostid and enable WiFi
networking = {
hostName = "panacea";
2020-05-08 21:53:52 +02:00
hostId = "8feb0bb8";
wireless.enable = true;
};
# Enable zeroconf
services.avahi = {
enable = true;
nssmdns = true;
};
# Wireguard setup
networking.wg-quick.interfaces = {
wg0 = {
address = [ "10.8.0.4/32" ];
privateKeyFile = "/home/coolneng/.wg/keys/privatekey";
dns = [ "198.100.148.224" "151.80.222.79" ];
peers = [
# zion
{
publicKey = "GN8lqPBZYOulh6xD4GhkoEWI65HMMCpSxJSH5871YnU=";
allowedIPs = [ "0.0.0.0/0" ];
endpoint = "coolneng.duckdns.org:1194";
persistentKeepalive = 25;
}
];
};
};
# Enable localhost SSH
services.openssh = {
enable = true;
permitRootLogin = "yes";
passwordAuthentication = false;
openFirewall = false;
startWhenNeeded = true;
};
}