Compare commits

...

4 commits

7 changed files with 65 additions and 84 deletions

View file

@ -1,32 +1,50 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.module.syncthing;
in {
# NOTE: Access at `http://localhost:8384`.
options.module.syncthing = {
enable = lib.mkEnableOption "the file sync.";
dataDir = lib.mkOption {
default = "/home/${cfg.user}/sync";
type = lib.types.str;
};
settings = lib.mkOption {
default = { };
type = lib.types.attrs;
};
user = lib.mkOption {
default = "voronind";
type = lib.types.str;
};
group = lib.mkOption {
default = "users";
type = lib.types.str;
};
openDefaultPorts = lib.mkOption {
default = true;
type = lib.types.bool;
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ syncthing ];
services.syncthing = {
inherit (cfg) enable dataDir user group openDefaultPorts;
systemService = true;
settings = lib.recursiveUpdate cfg.settings {
devices = {
"desktop" = { id = "767Z675-SOCY4FL-JNYEBB6-5E2RG5O-XTZR6OP-BGOBZ7G-XVRLMD6-DQEB2AT"; };
"home" = { id = "L5A5IPE-2FPJPHP-RJRV2PV-BLMLC3F-QPHSCUQ-4U3NM2I-AFPOE2A-HOPQZQF"; };
"phone" = { id = "6RO5JXW-2XO4S3E-VCDAHPD-4ADK6LL-HQGMZHU-GD6DE2O-6KNHWXJ-BCSBGQ7"; };
};
folders = let
everyone = lib.mapAttrsToList (n: v: n) config.services.syncthing.settings.devices;
in {
"save" = {
path = "${cfg.dataDir}/save";
devices = [
"desktop"
"home"
# "work"
];
};
"photo" = {
path = "${cfg.dataDir}/photo";
devices = [
"home"
"phone"
];
};
"tmp" = {
path = "${cfg.dataDir}/tmp";
devices = everyone;
};
"document" = {
path = "${cfg.dataDir}/document";
devices = everyone;
};
};
};
};
};
}

View file

@ -26,9 +26,8 @@
# dns.enable = true;
socksListenAddress = {
IsolateDestAddr = true;
addr = "0.0.0.0";
port = 9050;
# addr = cfg.address;
# port = cfg.torport;
};
};
};

View file

@ -23,7 +23,7 @@
};
extraApps = {
inherit (config.services.nextcloud.package.packages.apps)
contacts calendar onlyoffice;
contacts calendar;
};
settings = {
allow_local_remote_servers = true;

View file

@ -1,20 +0,0 @@
# NOTE: Imperative part:
# 1. You need to change PSQL tables owner from root to onlyoffice, too. They don't do that automatically for some reason.
# 2. TODO: Generate JWT secret at /var/lib/onlyoffice/jwt, i.e. 9wLfMGha1YrfvWpb5hyYjZf8pvJQ3swS
# SEE: https://git.voronind.com/voronind/nixos/issues/74
{
config,
lib,
...
}: {
# services.onlyoffice = {
# enable = true;
# hostname = "office.voronind.com";
# jwtSecretFile = "/var/www/onlyoffice/jwt";
#
# postgresName = "onlyoffice";
# postgresUser = "onlyoffice";
# # postgresPasswordFile = "${pkgs.writeText "OfficeDbPassword" dbName}";
# # rabbitmqUrl = "amqp://guest:guest@${config.container.module.rabbitmq.address}:${toString config.container.module.rabbitmq.port}";
# };
}

View file

@ -11,7 +11,6 @@
"invidious"
"mattermost"
"nextcloud"
"onlyoffice"
"paperless"
"privatebin"
];

View file

@ -1,48 +1,32 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.module.syncthing;
in {
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ syncthing ];
services.syncthing = {
inherit (cfg) enable dataDir user group openDefaultPorts;
systemService = true;
settings = lib.recursiveUpdate {
devices = {
"desktop" = { id = "767Z675-SOCY4FL-JNYEBB6-5E2RG5O-XTZR6OP-BGOBZ7G-XVRLMD6-DQEB2AT"; };
"home" = { id = "L5A5IPE-2FPJPHP-RJRV2PV-BLMLC3F-QPHSCUQ-4U3NM2I-AFPOE2A-HOPQZQF"; };
"phone" = { id = "6RO5JXW-2XO4S3E-VCDAHPD-4ADK6LL-HQGMZHU-GD6DE2O-6KNHWXJ-BCSBGQ7"; };
};
folders = {
"save" = {
path = "${cfg.dataDir}/save";
devices = [
"desktop"
"home"
# "work"
];
};
"photo" = {
path = "${cfg.dataDir}/photo";
devices = [
"home"
"phone"
];
};
"tmp" = {
path = "${cfg.dataDir}/tmp";
devices = [
"desktop"
"home"
"phone"
];
};
};
} cfg.settings;
# NOTE: Access at `http://localhost:8384`.
options.module.syncthing = {
enable = lib.mkEnableOption "the file sync.";
dataDir = lib.mkOption {
default = "/home/${cfg.user}/sync";
type = lib.types.str;
};
settings = lib.mkOption {
default = { };
type = lib.types.attrs;
};
user = lib.mkOption {
default = "voronind";
type = lib.types.str;
};
group = lib.mkOption {
default = "users";
type = lib.types.str;
};
openDefaultPorts = lib.mkOption {
default = true;
type = lib.types.bool;
};
};
}

View file

@ -29,6 +29,7 @@
(mkLink "Camera" "fa-camera" "https://camera.voronind.com")
(mkLink "Printer" "fa-print" "https://printer.voronind.com")
(mkLink "Router" "fa-route" "https://router.voronind.com")
(mkLink "Sync" "fa-sync" "https://sync.voronind.com")
])
(mkGroup "Bookmark" "fa-bookmark" [
(mkLink "2gis" "fa-map-location-dot" "https://2gis.ru")