Merge branch 'syncthing'

This commit is contained in:
wi11-holdsworth 2025-08-20 14:33:13 +10:00
commit adfb09bb0c
5 changed files with 92 additions and 1 deletions

View file

@ -19,6 +19,7 @@ in
radarr.enable = true; radarr.enable = true;
radicale.enable = true; radicale.enable = true;
sonarr.enable = true; sonarr.enable = true;
syncthing.enable = true;
qbittorrent.enable = true; qbittorrent.enable = true;
vaultwarden.enable = true; vaultwarden.enable = true;
vscode-server.enable = true; vscode-server.enable = true;

View file

@ -20,6 +20,7 @@ in
nix-settings.enable = lib.mkDefault true; nix-settings.enable = lib.mkDefault true;
nixpkgs.enable = lib.mkDefault true; nixpkgs.enable = lib.mkDefault true;
nixvim.enable = lib.mkDefault true; nixvim.enable = lib.mkDefault true;
syncthing.enable = lib.mkDefault true;
systemd-boot.enable = lib.mkDefault true; systemd-boot.enable = lib.mkDefault true;
tailscale.enable = lib.mkDefault true; tailscale.enable = lib.mkDefault true;

View file

@ -38,7 +38,11 @@ in
services.borgbackup.jobs = services.borgbackup.jobs =
let let
srv = location: { srv = location: {
paths = "/srv"; paths = [
"/srv"
"/home/srv/.config/syncthing"
"/home/srv/Sync"
];
compression = "auto,zstd"; compression = "auto,zstd";

View file

@ -190,6 +190,13 @@ in
"href" = "https://radicale.fi33.buzz/"; "href" = "https://radicale.fi33.buzz/";
}; };
} }
{
"Syncthing" = {
"description" = "Decentralised file synchronisation";
"icon" = "syncthing.svg";
"href" = "https://syncthing.fi33.buzz/";
};
}
{ {
"qBittorrent" = { "qBittorrent" = {
"description" = "BitTorrent client"; "description" = "BitTorrent client";

View file

@ -0,0 +1,78 @@
{
config,
lib,
userName,
hostName,
...
}:
let
feature = "syncthing";
port = "5008";
devicesList = [
{
device = "desktop";
id = "SKDADYB-DQVC2EG-BZ67OJR-DO25ZUR-URP2G5U-FXRNC65-OWPEKHN-STTRRQG";
}
{
device = "laptop";
id = "XDDGWB2-5OFYWSY-7LN652V-3WNQMWV-4WCVHCR-2EXLDW7-FUL2MC4-MMLO4QV";
}
{
device = "phone";
id = "DF56S5M-2EDKAML-LZBB35J-MNNK7UE-WAYE2QW-EKUGKXN-U5JW3RX-S3FUGA4";
}
{
device = "server";
id = "OP7EU3A-7A4CCMY-D4T3ND7-YWMRBNJ-KVE34FG-ZJQFSLS-WMLRWB4-FL2O7AZ";
}
];
devices = builtins.listToAttrs (
map (
{ device, id }:
{
name = device;
value = {
addresses = [
"tcp://${device}:22000"
];
autoAcceptFolders = true;
inherit id;
};
}
) (builtins.filter (deviceSet: deviceSet.device != hostName) devicesList)
);
in
{
config = lib.mkIf config.${feature}.enable {
services = {
# service
syncthing = {
enable = true;
guiAddress = "0.0.0.0:${port}";
openDefaultPorts = true;
user = "${userName}";
dataDir = "/home/${userName}";
overrideDevices = true;
settings = {
inherit devices;
};
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
};
};
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}