aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-03-09 17:06:57 +0100
committerAlex Auvolat <alex@adnab.me>2023-03-17 17:17:56 +0100
commitbb2660792f2e1dd63bd152b08095d9bf3879d569 (patch)
tree4386bd97e69b5aa879085afc2c17ccb9e0a5dd6d
parent6664affaa0127123d9eeae54128f845246ec7194 (diff)
downloadnixcfg-bb2660792f2e1dd63bd152b08095d9bf3879d569.tar.gz
nixcfg-bb2660792f2e1dd63bd152b08095d9bf3879d569.zip
wgautomesh persist state to file
-rw-r--r--nix/deuxfleurs.nix1
-rw-r--r--nix/wgautomesh.nix8
2 files changed, 8 insertions, 1 deletions
diff --git a/nix/deuxfleurs.nix b/nix/deuxfleurs.nix
index e82e3f6..7c97ebf 100644
--- a/nix/deuxfleurs.nix
+++ b/nix/deuxfleurs.nix
@@ -250,6 +250,7 @@ in
interface = "wg0";
gossipPort = 1666;
gossipSecretFile = "/var/lib/wgautomesh/gossip_secret";
+ persistFile = "/var/lib/wgautomesh/state";
upnpForwardPublicPort =
let
us = filter ({ hostname, ...}: hostname == config.networking.hostName) cfg.cluster_nodes;
diff --git a/nix/wgautomesh.nix b/nix/wgautomesh.nix
index c09b874..0e0b7b3 100644
--- a/nix/wgautomesh.nix
+++ b/nix/wgautomesh.nix
@@ -1,7 +1,7 @@
let
src = builtins.fetchGit {
url = "https://git.deuxfleurs.fr/lx/wgautomesh";
- rev = "43eced6e9aa5935b4553251604207f72bf0214c1";
+ rev = "65e979de801daa5f6ef77ed875e6505aa902fd9c";
};
wgautomesh = (import src).packages.x86_64-linux.default;
in
@@ -27,6 +27,10 @@ in
type = types.nullOr types.str;
description = "File containing the gossip secret encryption key";
};
+ persistFile = mkOption {
+ type = types.nullOr types.str;
+ description = "Path where to persist known peer addresses";
+ };
lanDiscovery = mkOption {
type = types.bool;
default = true;
@@ -78,6 +82,8 @@ in
extraDefs = (if cfg.lanDiscovery then ["lan_discovery = true"] else [])
++ (if (cfg.gossipSecretFile != null)
then [''gossip_secret_file = "${cfg.gossipSecretFile}"''] else [])
+ ++ (if (cfg.persistFile != null)
+ then [''persist_file = "${cfg.persistFile}"''] else [])
++ (if (cfg.upnpForwardPublicPort != null)
then [''upnp_forward_external_port = ${toString cfg.upnpForwardPublicPort}''] else []);
configfile = pkgs.writeText "wgautomesh.toml" ''