backwards: Add enable option to syncthing module
This commit is contained in:
@@ -1,88 +1,99 @@
|
||||
{ config, ... }:
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
enabled = config.mod.syncthing.enable;
|
||||
in
|
||||
{
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
openDefaultPorts = true;
|
||||
options = {
|
||||
mod.syncthing = {
|
||||
enable = lib.mkEnableOption "Enable syncthing module";
|
||||
};
|
||||
};
|
||||
|
||||
cert = config.age.secrets.syncthing-cert.path;
|
||||
key = config.age.secrets.syncthing-key.path;
|
||||
config = lib.mkIf enabled {
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
openDefaultPorts = true;
|
||||
|
||||
user = "alex";
|
||||
group = "users";
|
||||
cert = config.age.secrets.syncthing-cert.path;
|
||||
key = config.age.secrets.syncthing-key.path;
|
||||
|
||||
dataDir = "/home/alex/sync";
|
||||
user = "alex";
|
||||
group = "users";
|
||||
|
||||
guiAddress = "0.0.0.0:8384";
|
||||
dataDir = "/home/alex/sync";
|
||||
|
||||
settings = {
|
||||
devices = {
|
||||
phone.id = config.lib.syncthing.phone;
|
||||
pinwheel.id = config.lib.syncthing.pinwheel;
|
||||
};
|
||||
guiAddress = "0.0.0.0:8384";
|
||||
|
||||
folders = {
|
||||
org = {
|
||||
path = "/home/alex/sync/org";
|
||||
devices = [ "phone" "pinwheel" ];
|
||||
versioning = {
|
||||
type = "staggered";
|
||||
params = {
|
||||
maxage = "2592000"; # 30 days
|
||||
};
|
||||
};
|
||||
settings = {
|
||||
devices = {
|
||||
phone.id = config.lib.syncthing.phone;
|
||||
pinwheel.id = config.lib.syncthing.pinwheel;
|
||||
};
|
||||
|
||||
personal = {
|
||||
path = "/home/alex/sync/personal";
|
||||
devices = [ "pinwheel" ];
|
||||
versioning = {
|
||||
type = "staggered";
|
||||
params = {
|
||||
maxAge = "2592000"; # 30 days
|
||||
folders = {
|
||||
org = {
|
||||
path = "/home/alex/sync/org";
|
||||
devices = [ "phone" "pinwheel" ];
|
||||
versioning = {
|
||||
type = "staggered";
|
||||
params = {
|
||||
maxage = "2592000"; # 30 days
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
work = {
|
||||
path = "/home/alex/sync/work";
|
||||
devices = [ "pinwheel" ];
|
||||
versioning = {
|
||||
type = "staggered";
|
||||
params = {
|
||||
maxAge = "2592000"; # 30 days
|
||||
personal = {
|
||||
path = "/home/alex/sync/personal";
|
||||
devices = [ "pinwheel" ];
|
||||
versioning = {
|
||||
type = "staggered";
|
||||
params = {
|
||||
maxAge = "2592000"; # 30 days
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
books = {
|
||||
path = "/home/alex/sync/books";
|
||||
devices = [ "pinwheel" ];
|
||||
versioning = {
|
||||
type = "staggered";
|
||||
params = {
|
||||
maxAge = "2592000"; # 30 days
|
||||
work = {
|
||||
path = "/home/alex/sync/work";
|
||||
devices = [ "pinwheel" ];
|
||||
versioning = {
|
||||
type = "staggered";
|
||||
params = {
|
||||
maxAge = "2592000"; # 30 days
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
"phone-gps" = {
|
||||
path = "/home/alex/sync/phone-gps";
|
||||
devices = [ "phone" ];
|
||||
versioning = {
|
||||
type = "staggered";
|
||||
params = {
|
||||
maxage = "2592000"; # 30 days
|
||||
books = {
|
||||
path = "/home/alex/sync/books";
|
||||
devices = [ "pinwheel" ];
|
||||
versioning = {
|
||||
type = "staggered";
|
||||
params = {
|
||||
maxAge = "2592000"; # 30 days
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
"phone-gps" = {
|
||||
path = "/home/alex/sync/phone-gps";
|
||||
devices = [ "phone" ];
|
||||
versioning = {
|
||||
type = "staggered";
|
||||
params = {
|
||||
maxage = "2592000"; # 30 days
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
age = {
|
||||
secrets = {
|
||||
"syncthing-cert".file = ../../../../secrets/backwards/syncthing-cert.age;
|
||||
"syncthing-key".file = ../../../../secrets/backwards/syncthing-key.age;
|
||||
age = {
|
||||
secrets = {
|
||||
"syncthing-cert".file = ../../../../secrets/backwards/syncthing-cert.age;
|
||||
"syncthing-key".file = ../../../../secrets/backwards/syncthing-key.age;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user