alpha
Login
or
Join now
lass.pds.lassul.us
/
superconfig
Star
0
Fork
1
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
1
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
1
Pipelines
rework syncthing to not use stockholm
author
lassulus
date
2 years ago
(Apr 8, 2024, 7:52 PM CEST)
commit
1a7019e0
1a7019e004352dc8ed52baf39dd959f2a28c8a6e
parent
2c207b1b
2c207b1bf87645ed89cd72ccdcbe256e0a01fccf
+16
-8
1 changed file
Expand all
Collapse all
Unified
Split
2configs
syncthing.nix
+16
-8
2configs/syncthing.nix
View file
Reviewed
···
2
2
let
3
3
4
4
shares = {
5
5
-
"/home/lass/sync" = [ "mors" "xerxes" "green" "blue" "coaxmetal" "aergia" "ignavia" ];
6
6
-
"/home/lass/tmp/the_playlist" = [ "mors" "phone" "prism" "omo" "radio" ];
5
5
+
"/home/lass/sync" = [ "mors" "green" "coaxmetal" "ignavia" ]; # TODO add aergia
6
6
+
"/home/lass/tmp/the_playlist" = [ "mors" "prism" "radio" ];
7
7
# "/home/lass/.weechat" = [ "green" "mors" ];
8
8
-
"/home/lass/decsync" = [ "mors" "blue" "green" "phone" "massulus" ];
8
8
+
"/home/lass/decsync" = [ "mors" "green" "massulus" "massulus2" ];
9
9
};
10
10
11
11
-
mk_peers = lib.mapAttrs (n: v: { id = v.syncthing.id; });
11
11
+
machine_peers = lib.foldr (host: acc:
12
12
+
if builtins.pathExists ../machines/${host}/facts/syncthing.pub then
13
13
+
acc // { ${host}.id = lib.removeSuffix "\n" (builtins.readFile ../machines/${host}/facts/syncthing.pub); }
14
14
+
else
15
15
+
acc
16
16
+
) {} (lib.attrNames (builtins.readDir ../machines));
12
17
13
13
-
all_peers = lib.filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts;
18
18
+
all_peers = machine_peers // {
19
19
+
"massulus".id = "R2EGJ5S-PQMETUP-C2UGXQG-A6VP7TB-NGSN3MV-C7OGSWT-SZ34L3X-H6IF6AQ";
20
20
+
"massulus2".id = "OTJBJNO-VHBCVDL-QSELUS7-S6JDMYR-7WLE36A-6XSRSLP-VKYOYJJ-AHFGZAG";
21
21
+
};
22
22
+
14
23
used_peer_names = lib.unique (lib.filter lib.isString (lib.flatten (lib.mapAttrsToList (n: v: v.devices) config.services.syncthing.settings.folders)));
15
15
-
used_peers = lib.filterAttrs (n: v: lib.elem n used_peer_names) all_peers;
24
24
+
used_peers = lib.filterAttrs (n: v: lib.elem n used_peer_names) (lib.traceValSeq all_peers);
16
25
in {
17
26
services.syncthing = {
18
27
enable = true;
···
20
29
configDir = "/var/lib/syncthing";
21
30
key = "${config.krebs.secret.directory}/syncthing.key";
22
31
cert = "${config.krebs.secret.directory}/syncthing.cert";
23
23
-
# workaround for infinite recursion on unstable, remove in 23.11
24
24
-
settings.devices = mk_peers used_peers;
32
32
+
settings.devices = used_peers;
25
33
settings.folders = lib.mapAttrs (share: devices: {
26
34
enable = lib.elem config.networking.hostName devices;
27
35
path = share;