2024-09-21 21:30:46 +02:00
|
|
|
{ config, lib, pkgs, ...}:
|
|
|
|
|
2024-09-27 17:04:03 +02:00
|
|
|
# todo: portable service and system-manager
|
|
|
|
|
2024-09-21 21:30:46 +02:00
|
|
|
let
|
|
|
|
inherit (config.services.syncthing)
|
|
|
|
dataDir
|
|
|
|
;
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
environment.systemPackages = lib.mkIf config.services.syncthing.enable [
|
|
|
|
(pkgs.makeDesktopItem {
|
|
|
|
desktopName = "Open Syncthing";
|
|
|
|
name = "Syncthing";
|
|
|
|
exec = "${pkgs.xdg-utils}/bin/xdg-open ${config.services.syncthing.guiAddress}";
|
|
|
|
icon = "${pkgs.syncthing.src}/assets/logo-512.png";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
services.syncthing = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
user = lib.mkDefault "pbsds";
|
|
|
|
group = lib.mkDefault "pbsds";
|
2024-09-27 11:13:26 +02:00
|
|
|
dataDir = lib.mkDefault (config.users.users.pbsds.home + "/syncthing");
|
2024-09-21 21:30:46 +02:00
|
|
|
|
|
|
|
overrideDevices = true; # overrides devices from WebUI
|
|
|
|
overrideFolders = true; # overrides folders from WebUI
|
|
|
|
|
|
|
|
settings = {
|
2024-09-22 02:51:30 +02:00
|
|
|
options.urAccepted = -1; # disable telemetry
|
2024-09-22 02:14:49 +02:00
|
|
|
|
2024-09-21 21:30:46 +02:00
|
|
|
# TODO: nox
|
|
|
|
# TODO: somehow disable gui
|
|
|
|
# TODO: somehow auto-make a gui user+password
|
|
|
|
# TODO: somehow don't create ~/Sync
|
|
|
|
|
|
|
|
# nix run -- nixpkgs#syncthing generate --config="$HOME"/syncthing/.config/syncthing
|
|
|
|
devices."bjarte".id = "C7QQYJU-PMJDP2Z-CKTAV4A-V6IFEG5-YFBGCNU-PJPCZFC-QSXKZY3-NC5WRAL";
|
2024-09-27 17:04:03 +02:00
|
|
|
devices."rocm".id = "UFW6V4E-LMEDTYR-23BU6BP-2HEMWYB-2ARCJ4X-T67WHZX-BNCCHZ4-5GPSZQV";
|
2024-09-21 21:30:46 +02:00
|
|
|
devices."sopp".id = "ZQJEWAX-GALDJDO-FBOE5ON-M5XKXNT-PRZD3CY-S7L3XDR-PR27NYL-RZ6O7QW";
|
|
|
|
/* devices."sopp".autoAcceptFolders = true; # TODO */
|
|
|
|
|
|
|
|
folders."ntnu" = {
|
|
|
|
path = "${dataDir}/ntnu";
|
2024-09-27 17:04:03 +02:00
|
|
|
devices = [ "bjarte" "sopp" "rocm" ];
|
2024-09-21 21:30:46 +02:00
|
|
|
/* ignorePerms = false; # `false` means sync file permissions */
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|