diff options
author | Linnnus <[email protected]> | 2025-05-13 14:47:45 +0200 |
---|---|---|
committer | Linnnus <[email protected]> | 2025-05-13 14:51:02 +0200 |
commit | 3ac935d27f09d9d2cd516af0d114e56cb446a93b (patch) | |
tree | 8ea57da03f1a66ba11ee16f0aa769e60c1aab74e /hosts/muhammed | |
parent | 4dbd7ebf91ddeef00cca1536d206d4fa9ddab84c (diff) |
muhammed: Add syncthing keys
Diffstat (limited to 'hosts/muhammed')
-rw-r--r-- | hosts/muhammed/syncthing.nix | 19 | ||||
-rw-r--r-- | hosts/muhammed/wireguard/ahmed.nix | 24 |
2 files changed, 32 insertions, 11 deletions
diff --git a/hosts/muhammed/syncthing.nix b/hosts/muhammed/syncthing.nix index 15581a8..41613aa 100644 --- a/hosts/muhammed/syncthing.nix +++ b/hosts/muhammed/syncthing.nix @@ -1,4 +1,8 @@ -{...}: { +{ + config, + flakeInputs, + ... +}: { # Until nix-community/home-manager@45c07fc becomes part of the channel we're # following, I've just manually included it here. When that time comes, the # module should be removed. @@ -7,12 +11,18 @@ url = "https://github.com/nix-community/home-manager.git"; rev = "45c07fcf7d28b5fb3ee189c260dee0a2e4d14317"; }; - in ["${home-manager'}/modules/services/syncthing.nix"]; + in [ + "${home-manager'}/modules/services/syncthing.nix" + flakeInputs.agenix.homeManagerModules.age + ]; disabledModules = ["services/syncthing.nix"]; services.syncthing = { enable = true; + key = config.age.secrets.syncthing-key.path; + cert = config.age.secrets.syncthing-cert.path; + settings = { folders = { "ebooks" = { @@ -28,4 +38,9 @@ }; }; }; + + # We store the keys as part of the configuration since the device id is based + # on the key and we don't want that to change. + age.secrets.syncthing-key.file = ../../secrets/syncthing-keys/muhammed/key.pem.age; + age.secrets.syncthing-cert.file = ../../secrets/syncthing-keys/muhammed/cert.pem.age; } diff --git a/hosts/muhammed/wireguard/ahmed.nix b/hosts/muhammed/wireguard/ahmed.nix index 406ff7d..5e20813 100644 --- a/hosts/muhammed/wireguard/ahmed.nix +++ b/hosts/muhammed/wireguard/ahmed.nix @@ -1,4 +1,8 @@ -{metadata, config, ...}: { +{ + metadata, + config, + ... +}: { networking.wg-quick.interfaces.wg0 = { # Use the address assigned for us in `hosts/ahmed/wireguard-vpn/default.nix`. address = ["10.100.0.2"]; @@ -8,14 +12,16 @@ privateKeyFile = config.age.secrets.wireguard-key.path; - peers = [(let - peerInfo = metadata.hosts.ahmed.wireguard; - in { - publicKey = peerInfo.pubkey; - allowedIPs = ["0.0.0.0/0" "::/0"]; - endpoint = "${peerInfo.ipv4Address}:${toString peerInfo.port}"; - persistentKeepalive = 5; # We are a roaming client, they are static. - })]; + peers = [ + (let + peerInfo = metadata.hosts.ahmed.wireguard; + in { + publicKey = peerInfo.pubkey; + allowedIPs = ["0.0.0.0/0" "::/0"]; + endpoint = "${peerInfo.ipv4Address}:${toString peerInfo.port}"; + persistentKeepalive = 5; # We are a roaming client, they are static. + }) + ]; # table = "off"; }; |