update
This commit is contained in:
parent
a18e244ba5
commit
05a9d96d4e
26 changed files with 861 additions and 182 deletions
31
system/optional/wireguard.nix
Normal file
31
system/optional/wireguard.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
options.wireguard.enable = lib.mkEnableOption "Enable wireguard";
|
||||
options.wireguard.ip = lib.mkOption {
|
||||
type = with lib.types; uniq string;
|
||||
descriptions = "Wireguard ip";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.wireguard.enable {
|
||||
sops.secrets."wireguard/private" = {
|
||||
sopsFile = ../../hosts/${config.networking.hostname}/secrets/networking.yaml;
|
||||
};
|
||||
|
||||
networking.wireguard.interfaces = {
|
||||
server-wg = {
|
||||
ips = [ config.wireguard.ip ];
|
||||
listenPort = 51821;
|
||||
privateKeyFile = config.sops.secrets."wireguard/private".path;
|
||||
|
||||
peers = [
|
||||
{
|
||||
publicKey = "kYJn39tFStvzJ6QOMy3NabNWrJREaYdxwo/GdYD0MRk=";
|
||||
allowedIPs = [ "10.0.1.2/32" ];
|
||||
endpoint = "95.217.79.106:51821";
|
||||
persistentKeepalive = 25;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue