{ config, lib, pkgs, ...}: 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"; dataDir = lib.mkDefault config.users.users.pbsds.home + "/syncthing"; overrideDevices = true; # overrides devices from WebUI overrideFolders = true; # overrides folders from WebUI settings = { /* options.urAccepted = false; */ # 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"; devices."sopp".id = "ZQJEWAX-GALDJDO-FBOE5ON-M5XKXNT-PRZD3CY-S7L3XDR-PR27NYL-RZ6O7QW"; /* devices."sopp".autoAcceptFolders = true; # TODO */ folders."ntnu" = { path = "${dataDir}/ntnu"; devices = [ "bjarte" "sopp" ]; /* ignorePerms = false; # `false` means sync file permissions */ }; }; }; }