dotfiles/hosts/groceries/services/sync/syncthing.nix
eriedaberrie ef322634fe Initial commit
Note: not the actual initial commit.

I swear I will stop repeatedly force pushing to this single commit eventually
ok.
2024-09-08 15:51:41 -07:00

40 lines
886 B
Nix

{ config, ... }:
let
sockDir = "/run/syncthing";
cfg = config.services.syncthing;
in {
my.syncthing.enable = true;
services = {
nginx = let
upstream = "syncthing";
in {
virtualHosts."sync.eriedaberrie.me" = {
locations."/syncthing/".proxyPass = "http://${upstream}/";
};
upstreams.${upstream}.servers."unix:${cfg.guiAddress}" = { };
};
syncthing = {
guiAddress = "${sockDir}/syncthing.sock";
settings = {
gui = {
address = cfg.guiAddress;
unixSocketPermissions = "666";
user = "serverie";
password = "$2a$10$sSOgRCl5kB0ixakiVidWI.IH26tkoNZHqf9eUwoHmHxPEDRdYDZ06";
};
};
};
};
systemd.tmpfiles.rules = let
inherit (cfg) user group;
in [
"d '${sockDir}' 0755 ${user} ${group} - -"
"z '${sockDir}' 0755 ${user} ${group} - -"
];
}