summaryrefslogtreecommitdiff
path: root/system/vpn.nix
diff options
context:
space:
mode:
Diffstat (limited to 'system/vpn.nix')
-rw-r--r--system/vpn.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/system/vpn.nix b/system/vpn.nix
new file mode 100644
index 0000000..c336f32
--- /dev/null
+++ b/system/vpn.nix
@@ -0,0 +1,38 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}: let
+ inherit (lib) mkIf;
+ cfg = config.vpn;
+in {
+ config = mkIf cfg.enable {
+ environment.systemPackages = with pkgs; [
+ wireguard-tools
+ ];
+
+ networking.wg-quick.interfaces = {
+ freyanet = {
+ address = [cfg.ip];
+ dns = ["10.2.0.1"];
+ privateKeyFile = config.sops.secrets.freyanetWg.path;
+ autostart = false;
+
+ peers = [
+ {
+ publicKey = "x0ykwakpYCvI/pG+nR83lNUyeOE9m54thnX3bvZ+FUk=";
+ allowedIPs = ["10.0.0.0/8"];
+ endpoint = "freya.cat:3000";
+ persistentKeepalive = 25;
+ }
+ ];
+ };
+ };
+
+ sops = {
+ enable = true;
+ secrets.freyanetWg = {};
+ };
+ };
+}