Commit a8e06920ada7
Changed files (3)
home/common/services/syncthing.nix
@@ -4,12 +4,11 @@
...
}:
{
- # warning = [ "${ttt}" ];
services.syncthing = {
enable = true;
extraOptions = [ "--no-default-folder" ];
- # guiAddress = cfg.guiAddress;
- # TODO This is only for kyushu, will need to migrate this later
+ overrideFolders = false; # Just in case, will probably set to true later
+ guiAddress = globals.fn.syncthingGuiAddress globals.machines."${hostname}";
settings = {
# FIXME this doesn't work, I wish it did.
# defaults = {
systems/common/services/syncthing.nix
@@ -1,10 +1,26 @@
-_: {
+{
+ globals,
+ hostname,
+ ...
+}:
+{
services.syncthing = {
enable = true;
user = "vincent";
+ # FIXME: change this
dataDir = "/home/vincent/.syncthing";
configDir = "/home/vincent/.syncthing";
- # guiAddress = cfg.guiAddress;
- settings = { };
+ guiAddress = globals.fn.syncthingGuiAddress globals.machines."${hostname}";
+ overrideFolders = false; # Just in case, will probably set to true later
+ settings = {
+ # FIXME this doesn't work, I wish it did.
+ # defaults = {
+ # ignores = { lines = [ "(?d).DS_Store" "**" ]; };
+ # };
+ devices = globals.fn.generateSyncthingDevices globals.machines;
+ folders =
+ globals.fn.generateSyncthingFolders globals.machines."${hostname}" globals.machines
+ globals.syncthingFolders;
+ };
};
}
globals.nix
@@ -423,5 +423,9 @@ in
(
lib.attrsets.filterAttrs (name: value: hasSyncthingFolders value && !(isCurrentHost name)) machines
);
+
+ syncthingGuiAddress =
+ machine:
+ (builtins.head (lib.attrsets.attrByPath [ "net" "vpn" "ips" ] [ "127.0.0.1" ] machine)) + ":8384";
};
}