rico*: enable wireguard

This commit is contained in:
Adithya 2024-06-30 17:54:04 +05:30
parent feeb2dba32
commit f78ec1bc61
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
6 changed files with 93 additions and 0 deletions

View file

@ -1,4 +1,5 @@
{ lib, ... }: { { lib, ... }: {
imports = [ ./wireguard.nix ];
networking = { networking = {
nameservers = [ nameservers = [
"2620:fe::fe#dns.quad9.net" "2620:fe::fe#dns.quad9.net"

30
hosts/rico0/wireguard.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, ... }: {
networking.firewall.trustedInterfaces = [ "wg0" ];
networking.wireguard = {
enable = true;
interfaces = {
wg0 = {
ips = [
"10.10.10.10/24"
"fd7c:585c:c4ae::10/64"
];
listenPort = 51822;
privateKeyFile = "/persist/secrets/wireguard/private.key";
generatePrivateKeyFile = true;
peers = [
{
name = "Proxy";
endpoint = "165.232.180.97:51821";
publicKey = "NNw/iDMCTq8mpHncrecEh4UlvtINX/UUDtCJf2ToFR4=";
presharedKeyFile = config.sops.secrets."wireguard/psk/rico0".path;
persistentKeepalive = 20;
allowedIPs = [
"10.10.10.0/24"
"fd7c:585c:c4ae::0/64"
];
}
];
};
};
};
}

View file

@ -1,4 +1,5 @@
{ lib, ... }: { { lib, ... }: {
imports = [ ./wireguard.nix ];
networking = { networking = {
nameservers = [ nameservers = [
"2620:fe::fe#dns.quad9.net" "2620:fe::fe#dns.quad9.net"

30
hosts/rico1/wireguard.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, ... }: {
networking.firewall.trustedInterfaces = [ "wg0" ];
networking.wireguard = {
enable = true;
interfaces = {
wg0 = {
ips = [
"10.10.10.11/24"
"fd7c:585c:c4ae::11/64"
];
listenPort = 51822;
privateKeyFile = "/persist/secrets/wireguard/private.key";
generatePrivateKeyFile = true;
peers = [
{
name = "Proxy";
endpoint = "165.232.180.97:51821";
publicKey = "NNw/iDMCTq8mpHncrecEh4UlvtINX/UUDtCJf2ToFR4=";
presharedKeyFile = config.sops.secrets."wireguard/psk/rico1".path;
persistentKeepalive = 20;
allowedIPs = [
"10.10.10.0/24"
"fd7c:585c:c4ae::0/64"
];
}
];
};
};
};
}

View file

@ -1,4 +1,5 @@
{ lib, ... }: { { lib, ... }: {
imports = [ ./wireguard.nix ];
networking = { networking = {
nameservers = [ nameservers = [
"2620:fe::fe#dns.quad9.net" "2620:fe::fe#dns.quad9.net"

30
hosts/rico2/wireguard.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, ... }: {
networking.firewall.trustedInterfaces = [ "wg0" ];
networking.wireguard = {
enable = true;
interfaces = {
wg0 = {
ips = [
"10.10.10.12/24"
"fd7c:585c:c4ae::12/64"
];
listenPort = 51822;
privateKeyFile = "/persist/secrets/wireguard/private.key";
generatePrivateKeyFile = true;
peers = [
{
name = "Proxy";
endpoint = "165.232.180.97:51821";
publicKey = "NNw/iDMCTq8mpHncrecEh4UlvtINX/UUDtCJf2ToFR4=";
presharedKeyFile = config.sops.secrets."wireguard/psk/rico2".path;
persistentKeepalive = 20;
allowedIPs = [
"10.10.10.0/24"
"fd7c:585c:c4ae::0/64"
];
}
];
};
};
};
}