diff options
author | Karel Kočí <cynerd@email.cz> | 2023-01-08 11:25:01 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2023-01-08 11:25:01 +0100 |
commit | d5dc7479c489d17e6dcacf081c0f1b5242d99bd9 (patch) | |
tree | c12d18231cacb81ff5b69a2073894d228e3c81e7 /nixos/modules/syncthing.nix | |
parent | c7a226a92d65cedd384fa29083efdbb07a6084b0 (diff) | |
download | nixos-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.nix | 53 |
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 }; }; - } |