add radish configuration
This commit is contained in:
33
freun.dev/syncthing.nix
Normal file
33
freun.dev/syncthing.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{ pkgs, config, lib, ... }:
|
||||
let
|
||||
storage_dir = "/mnt/storage/syncthing";
|
||||
in
|
||||
{
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
dataDir = "/mnt/storage/syncthing";
|
||||
openDefaultPorts = true;
|
||||
};
|
||||
|
||||
services.caddy.virtualHosts = {
|
||||
"sync.freun.dev".extraConfig = ''
|
||||
reverse_proxy localhost:8384 {
|
||||
header_up Host {upstream_hostport}
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
fileSystems."${storage_dir}" = {
|
||||
device = "//u407959.your-storagebox.de/backup/syncthing";
|
||||
fsType = "cifs";
|
||||
options = let
|
||||
# this line prevents hanging on network split
|
||||
automount_opts = "x-systemd.automount,auto,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
|
||||
uid = builtins.toString config.users.users.syncthing.uid;
|
||||
gid = builtins.toString config.users.groups.syncthing.gid;
|
||||
in ["${automount_opts},credentials=/var/secrets/smb-storage,uid=${uid},gid=${gid}"];
|
||||
};
|
||||
|
||||
|
||||
environment.systemPackages = [ pkgs.cifs-utils ];
|
||||
}
|
||||
Reference in New Issue
Block a user