From d5dc7479c489d17e6dcacf081c0f1b5242d99bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sun, 8 Jan 2023 11:25:01 +0100 Subject: Format using Alejandra --- nixos/modules/syncthing.nix | 53 ++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 22 deletions(-) (limited to 'nixos/modules/syncthing.nix') 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 }; }; - } -- cgit v1.2.3