aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/syncthing.nix
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2023-01-08 11:25:01 +0100
committerKarel Kočí <cynerd@email.cz>2023-01-08 11:25:01 +0100
commitd5dc7479c489d17e6dcacf081c0f1b5242d99bd9 (patch)
treec12d18231cacb81ff5b69a2073894d228e3c81e7 /nixos/modules/syncthing.nix
parentc7a226a92d65cedd384fa29083efdbb07a6084b0 (diff)
downloadnixos-personal-d5dc7479c489d17e6dcacf081c0f1b5242d99bd9.tar.gz
nixos-personal-d5dc7479c489d17e6dcacf081c0f1b5242d99bd9.tar.bz2
nixos-personal-d5dc7479c489d17e6dcacf081c0f1b5242d99bd9.zip
Format using Alejandra
Diffstat (limited to 'nixos/modules/syncthing.nix')
-rw-r--r--nixos/modules/syncthing.nix53
1 files changed, 31 insertions, 22 deletions
diff --git a/nixos/modules/syncthing.nix b/nixos/modules/syncthing.nix
index 44c1ac1..db8b6a8 100644
--- a/nixos/modules/syncthing.nix
+++ b/nixos/modules/syncthing.nix
@@ -1,28 +1,38 @@
-{ config, lib, pkgs, ... }:
-
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
with builtins;
-with lib;
-
-let
-
+with lib; let
cnf = config.cynerd.syncthing;
hostName = config.networking.hostName;
allDevices = [
- "albert" "binky" "errol" "lipwig" "ridcully" "susan" "spt-omnia"
+ "albert"
+ "binky"
+ "errol"
+ "lipwig"
+ "ridcully"
+ "susan"
+ "spt-omnia"
];
mediaDevices = [
- "lipwig" "binky" "errol" "ridcully" "spt-omnia"
+ "lipwig"
+ "binky"
+ "errol"
+ "ridcully"
+ "spt-omnia"
];
bigStorageDevices = [
- "errol" "ridcully" "spt-omnia"
+ "errol"
+ "ridcully"
+ "spt-omnia"
];
filterDevice = folders: filterAttrs (n: v: any (d: d == hostName) v.devices) folders;
-
in {
-
options = {
cynerd.syncthing = {
-
enable = mkOption {
type = types.bool;
default = false;
@@ -34,13 +44,12 @@ in {
default = "/home/cynerd";
description = "Base directory for all folders being synced.";
};
-
};
};
config = mkIf cnf.enable {
services.syncthing = {
- enable = any (n: n == hostName) allDevices;
+ enable = any (n: n == hostName) allDevices;
user = mkDefault "cynerd";
key = "/run/secrets/syncthing/key.pem";
cert = "/run/secrets/syncthing/cert.pem";
@@ -101,15 +110,15 @@ in {
};
overrideDevices = true;
- devices = recursiveUpdate
- (genAttrs allDevices (name: {
- id = config.secrets.syncthingIDs."${name}";
- }))
- {
- lipwig.addresses = ["tcp://cynerd.cz"];
- };
+ devices =
+ recursiveUpdate
+ (genAttrs allDevices (name: {
+ id = config.secrets.syncthingIDs."${name}";
+ }))
+ {
+ lipwig.addresses = ["tcp://cynerd.cz"];
+ };
# TODO phone
};
};
-
}