syncthing: init
This commit is contained in:
parent
84849d5b2d
commit
8e84af98ac
9 changed files with 91 additions and 6 deletions
52
modules/nixos/base/syncthing.nix
Normal file
52
modules/nixos/base/syncthing.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (config.networking) hostName;
|
||||
inherit (config.ooknet.host) admin syncthing;
|
||||
inherit (config.ooknet.secrets) devices;
|
||||
|
||||
key = config.age.secrets."${hostName}-syncthing-key";
|
||||
cert = config.age.secrets."${hostName}-syncthing-cert";
|
||||
in {
|
||||
config = mkIf syncthing.enable {
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
user = admin.name;
|
||||
group = "users";
|
||||
openDefaultPorts = true;
|
||||
configDir = "/home/${admin.name}/.config/syncthing";
|
||||
|
||||
# host credentials
|
||||
key = key.path;
|
||||
cert = cert.path;
|
||||
|
||||
settings = {
|
||||
# obfuscating device ids is not necessary, but i do it anyway
|
||||
devices = {
|
||||
"ooksdesk" = {
|
||||
inherit (devices.ooksdesk) id addresses;
|
||||
};
|
||||
"ooksmedia" = {
|
||||
inherit (devices.ooksmedia) id addresses;
|
||||
};
|
||||
};
|
||||
folders = {
|
||||
"Summit" = {
|
||||
path = "/home/${admin.name}/Summit";
|
||||
devices = [
|
||||
"ooksdesk"
|
||||
"ooksmedia"
|
||||
];
|
||||
ignorePerms = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
# Dont create default ~/Sync folder
|
||||
# https://wiki.nixos.org/wiki/Syncthing
|
||||
systemd.services.syncthing.environment.STNODEFAULTFOLDER = "true";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue