Compare commits

...

4 commits

7 changed files with 65 additions and 84 deletions

View file

@ -1,32 +1,50 @@
{ {
config, config,
lib, lib,
pkgs,
... ...
}: let }: let
cfg = config.module.syncthing; cfg = config.module.syncthing;
in { in {
# NOTE: Access at `http://localhost:8384`. config = lib.mkIf cfg.enable {
options.module.syncthing = { environment.systemPackages = with pkgs; [ syncthing ];
enable = lib.mkEnableOption "the file sync."; services.syncthing = {
dataDir = lib.mkOption { inherit (cfg) enable dataDir user group openDefaultPorts;
default = "/home/${cfg.user}/sync"; systemService = true;
type = lib.types.str; 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"; };
}; };
settings = lib.mkOption { folders = let
default = { }; everyone = lib.mapAttrsToList (n: v: n) config.services.syncthing.settings.devices;
type = lib.types.attrs; 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;
}; };
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

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

View file

@ -23,7 +23,7 @@
}; };
extraApps = { extraApps = {
inherit (config.services.nextcloud.package.packages.apps) inherit (config.services.nextcloud.package.packages.apps)
contacts calendar onlyoffice; contacts calendar;
}; };
settings = { settings = {
allow_local_remote_servers = true; 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" "invidious"
"mattermost" "mattermost"
"nextcloud" "nextcloud"
"onlyoffice"
"paperless" "paperless"
"privatebin" "privatebin"
]; ];

View file

@ -1,48 +1,32 @@
{ {
config, config,
lib, lib,
pkgs,
... ...
}: let }: let
cfg = config.module.syncthing; cfg = config.module.syncthing;
in { in {
config = lib.mkIf cfg.enable { # NOTE: Access at `http://localhost:8384`.
environment.systemPackages = with pkgs; [ syncthing ]; options.module.syncthing = {
services.syncthing = { enable = lib.mkEnableOption "the file sync.";
inherit (cfg) enable dataDir user group openDefaultPorts; dataDir = lib.mkOption {
systemService = true; default = "/home/${cfg.user}/sync";
settings = lib.recursiveUpdate { type = lib.types.str;
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 = { settings = lib.mkOption {
"save" = { default = { };
path = "${cfg.dataDir}/save"; type = lib.types.attrs;
devices = [
"desktop"
"home"
# "work"
];
}; };
"photo" = { user = lib.mkOption {
path = "${cfg.dataDir}/photo"; default = "voronind";
devices = [ type = lib.types.str;
"home"
"phone"
];
}; };
"tmp" = { group = lib.mkOption {
path = "${cfg.dataDir}/tmp"; default = "users";
devices = [ type = lib.types.str;
"desktop"
"home"
"phone"
];
}; };
}; openDefaultPorts = lib.mkOption {
} cfg.settings; default = true;
type = lib.types.bool;
}; };
}; };
} }

View file

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