2024-09-24 13:09:36 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
username,
|
|
|
|
hostname,
|
|
|
|
...
|
2024-09-24 21:47:52 +00:00
|
|
|
}: let
|
2024-08-25 19:58:12 +00:00
|
|
|
homeDir = "/home/${username}";
|
|
|
|
devices = import ./devices.nix;
|
2024-09-24 21:47:52 +00:00
|
|
|
otherDevices = builtins.removeAttrs devices [hostname];
|
|
|
|
in {
|
2024-08-25 19:58:12 +00:00
|
|
|
services = {
|
|
|
|
syncthing = {
|
|
|
|
enable = true;
|
|
|
|
user = "${username}";
|
|
|
|
dataDir = "${homeDir}/Documents";
|
2024-09-24 13:09:36 +00:00
|
|
|
configDir = "${homeDir}/.config/syncthing"; # Folder for Syncthing's settings and keys
|
2024-08-25 19:58:12 +00:00
|
|
|
key = "${config.sops.secrets."syncthing/${hostname}/key".path}";
|
|
|
|
cert = "${config.sops.secrets."syncthing/${hostname}/cert".path}";
|
|
|
|
settings = {
|
|
|
|
devices = otherDevices;
|
|
|
|
folders = {
|
|
|
|
"Documents" = {
|
|
|
|
path = "${homeDir}/Documents";
|
|
|
|
devices = builtins.attrNames otherDevices;
|
|
|
|
};
|
|
|
|
"Pictures" = {
|
|
|
|
path = "${homeDir}/Pictures";
|
|
|
|
devices = builtins.attrNames otherDevices;
|
|
|
|
};
|
|
|
|
"Music" = {
|
|
|
|
path = "${homeDir}/Music";
|
|
|
|
devices = builtins.attrNames otherDevices;
|
|
|
|
};
|
|
|
|
"Videos" = {
|
|
|
|
path = "${homeDir}/Videos";
|
|
|
|
devices = builtins.attrNames otherDevices;
|
|
|
|
};
|
|
|
|
"Projects" = {
|
|
|
|
path = "${homeDir}/Projects";
|
|
|
|
devices = builtins.attrNames otherDevices;
|
|
|
|
};
|
2024-08-28 13:46:53 +00:00
|
|
|
"Notes" = {
|
|
|
|
path = "${homeDir}/Notes";
|
|
|
|
devices = builtins.attrNames otherDevices;
|
|
|
|
};
|
2024-08-25 19:58:12 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
systemd.services.syncthing.environment.STNODEFAULTFOLDER = "true"; # Don't create default ~/Sync folder
|
|
|
|
}
|