Generalize and split up more files
This commit is contained in:
parent
9c03712908
commit
13d24f42ea
27 changed files with 161 additions and 156 deletions
|
@ -1,6 +1,9 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [ ./wireless ];
|
||||
imports = [
|
||||
./wireless
|
||||
./wireguard
|
||||
];
|
||||
|
||||
networking = {
|
||||
wireless.enable = false;
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
options.system.wireguard.client.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Enable the wireguard client";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.system.wireguard.client.enable {
|
||||
networking = {
|
||||
firewall = {
|
||||
allowedUDPPorts = [ 51820 ];
|
||||
trustedInterfaces = [ "wgc" ];
|
||||
};
|
||||
|
||||
wireguard.interfaces.wgc = {
|
||||
listenPort = 51820;
|
||||
privateKey = config.secrets.wgClientPriv;
|
||||
peers = [
|
||||
{ # Cyberspark Server
|
||||
publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8=";
|
||||
allowedIPs = [ "10.100.0.0/24" ];
|
||||
endpoint = "sv.${config.domains.jim1}:51820";
|
||||
persistentKeepalive = 25;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
7
modules/system/devices/networking/wireguard/default.nix
Normal file
7
modules/system/devices/networking/wireguard/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./client
|
||||
./server
|
||||
];
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
options.system.wireguard.server.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Enable the wireguard server";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.system.wireguard.server.enable {
|
||||
networking = {
|
||||
firewall.allowedUDPPorts = [ 51820 ];
|
||||
|
||||
nat = {
|
||||
enable = config.system.wireguard.server.enable;
|
||||
externalInterface = "eno1";
|
||||
internalInterfaces = [ "wgs" ];
|
||||
};
|
||||
|
||||
wireguard.interfaces.wgs = {
|
||||
ips = [ "10.100.0.1/24" ];
|
||||
listenPort = 51820;
|
||||
privateKey = config.secrets.wgServerPriv;
|
||||
peers = [
|
||||
{ # NixOS Config Key
|
||||
publicKey = "OKUH/h6YSURI4vgeTZKQD15QsqaygdbTn1mAWzQp9S0=";
|
||||
allowedIPs = [ "10.100.0.16/28" ];
|
||||
}
|
||||
{ # Pixel 9
|
||||
publicKey = "dPCtjm67adMZCnyL1O2L+uUOk0RbjA9T/tht1r+qcE4=";
|
||||
allowedIPs = [ "10.100.0.2/32" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,11 +1,9 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
options.system.wireless = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Enable Wifi with iwd";
|
||||
};
|
||||
options.system.wireless.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Enable Wifi with iwd";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.system.wireless.enable {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue