Add network configuration in a different module
This commit is contained in:
43
modules/networking.nix
Normal file
43
modules/networking.nix
Normal file
@@ -0,0 +1,43 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
avahi
|
||||
wireguard
|
||||
];
|
||||
|
||||
# Set hostname and hostid
|
||||
networking = {
|
||||
hostName = "panacea";
|
||||
hostId = "";
|
||||
};
|
||||
|
||||
# Enable zeroconf
|
||||
services.avahi = {
|
||||
enable = true;
|
||||
nssmdns = true;
|
||||
publish = {
|
||||
enable = true;
|
||||
userServices = true;
|
||||
};
|
||||
reflector = true;
|
||||
};
|
||||
|
||||
# Wireguard setup
|
||||
networking.wireguard.interfaces = {
|
||||
wg0 = {
|
||||
ips = [ "10.8.0.4/32" ];
|
||||
privateKeyFile = "/home/coolneng/.wg/keys/privatekey";
|
||||
peers = [
|
||||
# zion
|
||||
{
|
||||
publicKey = "GN8lqPBZYOulh6xD4GhkoEWI65HMMCpSxJSH5871YnU=";
|
||||
allowedIPs = [ "0.0.0.0/0" ];
|
||||
endpoint = "coolneng.duckdns.org:1194";
|
||||
persistentKeepalive = 25;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user