From 04490dceb83d43db3304109eb3b0e569e77ad4ad Mon Sep 17 00:00:00 2001 From: Anish L Date: Tue, 14 Jun 2022 17:29:17 +1000 Subject: [PATCH] converted to working wireguard module --- flake.nix | 6 +++--- hosts/box/default.nix | 8 ++++++++ hosts/curve/default.nix | 8 ++++++++ modules/wireguard.nix | 24 ++++++++++++------------ 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/flake.nix b/flake.nix index 60585b0c..75f0a2fc 100644 --- a/flake.nix +++ b/flake.nix @@ -122,10 +122,10 @@ }; suites = with profiles; rec { base = [ core users.root users.anish ]; - sealight = [ base server ]; # matrix rsshub backup wireguard - mossnet = [ base server taskd wireguard-box shaarli wallabag dns backup monitoring nfs rss-bridge gonic headphones radicale ]; # hpi syncthing + sealight = [ base server ]; # matrix rsshub backup wireguard-server + mossnet = [ base server taskd wireguard-box shaarli wallabag dns monitoring nfs rss-bridge gonic headphones radicale ]; # hpi syncthing cube = [ base site server ]; # backup - graphical = [ base bluetooth music sync wireguard wifi desktop ]; + graphical = [ base bluetooth music sync wifi desktop ]; curve = [ graphical secrets ]; # backup? work = [ base ]; }; diff --git a/hosts/box/default.nix b/hosts/box/default.nix index 4fa0242b..b8e8792d 100644 --- a/hosts/box/default.nix +++ b/hosts/box/default.nix @@ -32,4 +32,12 @@ # seafile? # syncthing }; + + #age.secrets.box-wg.file = "${self}/secrets/curve-wg.age"; + #age.secrets.box-wg.owner = "anish"; + #mossnet.wg = { + # enable = true; + # ips = [ "10.0.69.4/24" ]; + # privateKeyFile = "/run/agenix/box-wg"; + #}; } diff --git a/hosts/curve/default.nix b/hosts/curve/default.nix index 09cb4798..26489b9c 100644 --- a/hosts/curve/default.nix +++ b/hosts/curve/default.nix @@ -28,6 +28,14 @@ boot.supportedFilesystems = [ "ntfs" ]; + age.secrets.curve-wg.file = "${self}/secrets/curve-wg.age"; + age.secrets.curve-wg.owner = "anish"; + mossnet.wg = { + enable = true; + ips = [ "10.0.69.2/24" ]; + privateKeyFile = "/run/agenix/curve-wg"; + }; + age.secrets.borg-password.file = "${self}/secrets/borg-password.age"; mossnet.backup = { enable = true; diff --git a/modules/wireguard.nix b/modules/wireguard.nix index 1bb0ebd1..5e9e9b52 100644 --- a/modules/wireguard.nix +++ b/modules/wireguard.nix @@ -6,7 +6,7 @@ in { options = { mossnet.wg = { - enable = mkEnableOption "Gain access to all mossnet systems through wireguard, but only if it's already included in the server config"; + enable = mkEnableOption "Gain access to all mossnet systems through wireguard"; ips = lib.mkOption { type = with types; listOf str; default = { }; @@ -16,17 +16,17 @@ in description = '' The IP this machine is allowed to connect to ''; - privateKeyFile = lib.mkOption { - type = types.path; - default = { }; - example = literalExample '' - /run/agenix/wg-curve - ''; - description = '' - The private ssh key file to use to connect! - Remember set age.secrets.*.file and age.secrets.*.user - ''; - }; + }; + privateKeyFile = lib.mkOption { + type = types.path; + default = { }; + example = literalExample '' + /run/agenix/wg-curve + ''; + description = '' + The private ssh key file to use to connect! + Remember set age.secrets.*.file and age.secrets.*.user + ''; }; }; };