diff --git a/hosts/bjarte/configuration.nix b/hosts/bjarte/configuration.nix index 2051804..55be4b9 100644 --- a/hosts/bjarte/configuration.nix +++ b/hosts/bjarte/configuration.nix @@ -15,6 +15,7 @@ #../../profiles/oci/distrobox.nix ../../users/pbsds + ../../users/pbsds/syncthing.nix #../../profiles/mounts/freon-nfs.nix #../../profiles/mounts/reidun-nfs.nix diff --git a/hosts/sopp/configuration.nix b/hosts/sopp/configuration.nix index 38c3e3a..81144f5 100644 --- a/hosts/sopp/configuration.nix +++ b/hosts/sopp/configuration.nix @@ -30,6 +30,7 @@ ../../profiles/oci/distrobox.nix ../../users/pbsds + ../../users/pbsds/syncthing.nix ../../profiles/mounts/freon-nfs.nix ../../profiles/mounts/reidun-nfs.nix diff --git a/users/pbsds/syncthing.nix b/users/pbsds/syncthing.nix new file mode 100644 index 0000000..2c0bd19 --- /dev/null +++ b/users/pbsds/syncthing.nix @@ -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 */ + }; + + }; + }; +}