setup wireguard on rico2

This commit is contained in:
Adithya 2023-10-08 15:36:04 +05:30
parent b6e5604c02
commit 4e249f3a3b
Signed by: adtya
GPG key ID: 48FC9915FFD326D0
2 changed files with 23 additions and 0 deletions

View file

@ -1,4 +1,5 @@
{lib, ...}: { {lib, ...}: {
imports = [./wireguard.nix];
networking = { networking = {
hostName = "Rico2"; hostName = "Rico2";
useDHCP = lib.mkDefault false; useDHCP = lib.mkDefault false;

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

@ -0,0 +1,22 @@
{
config,
secrets,
...
}: let
inherit (secrets.wireguard_config) peers Proxy Skipper;
in {
networking.wireguard = {
enable = true;
interfaces = {
wg0 = {
inherit (peers."${config.networking.hostName}") ips;
privateKeyFile = "/etc/wireguard/private.key";
generatePrivateKeyFile = true;
peers = [
Proxy
Skipper
];
};
};
};
}