From bb2660792f2e1dd63bd152b08095d9bf3879d569 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 9 Mar 2023 17:06:57 +0100 Subject: wgautomesh persist state to file --- nix/deuxfleurs.nix | 1 + nix/wgautomesh.nix | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) 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" '' -- cgit v1.2.3