syncthing

This commit is contained in:
Peder Bergebakken Sundt 2024-09-21 21:30:46 +02:00
parent bc5139a8d0
commit 3f537af9db
3 changed files with 52 additions and 0 deletions

View File

@ -15,6 +15,7 @@
#../../profiles/oci/distrobox.nix #../../profiles/oci/distrobox.nix
../../users/pbsds ../../users/pbsds
../../users/pbsds/syncthing.nix
#../../profiles/mounts/freon-nfs.nix #../../profiles/mounts/freon-nfs.nix
#../../profiles/mounts/reidun-nfs.nix #../../profiles/mounts/reidun-nfs.nix

View File

@ -30,6 +30,7 @@
../../profiles/oci/distrobox.nix ../../profiles/oci/distrobox.nix
../../users/pbsds ../../users/pbsds
../../users/pbsds/syncthing.nix
../../profiles/mounts/freon-nfs.nix ../../profiles/mounts/freon-nfs.nix
../../profiles/mounts/reidun-nfs.nix ../../profiles/mounts/reidun-nfs.nix

50
users/pbsds/syncthing.nix Normal file
View File

@ -0,0 +1,50 @@
{ 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 */
};
};
};
}