Merge branch 'syncthing'
This commit is contained in:
commit
adfb09bb0c
5 changed files with 92 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ in
|
|||
radarr.enable = true;
|
||||
radicale.enable = true;
|
||||
sonarr.enable = true;
|
||||
syncthing.enable = true;
|
||||
qbittorrent.enable = true;
|
||||
vaultwarden.enable = true;
|
||||
vscode-server.enable = true;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ in
|
|||
nix-settings.enable = lib.mkDefault true;
|
||||
nixpkgs.enable = lib.mkDefault true;
|
||||
nixvim.enable = lib.mkDefault true;
|
||||
syncthing.enable = lib.mkDefault true;
|
||||
systemd-boot.enable = lib.mkDefault true;
|
||||
tailscale.enable = lib.mkDefault true;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,11 @@ in
|
|||
services.borgbackup.jobs =
|
||||
let
|
||||
srv = location: {
|
||||
paths = "/srv";
|
||||
paths = [
|
||||
"/srv"
|
||||
"/home/srv/.config/syncthing"
|
||||
"/home/srv/Sync"
|
||||
];
|
||||
|
||||
compression = "auto,zstd";
|
||||
|
||||
|
|
|
|||
|
|
@ -190,6 +190,13 @@ in
|
|||
"href" = "https://radicale.fi33.buzz/";
|
||||
};
|
||||
}
|
||||
{
|
||||
"Syncthing" = {
|
||||
"description" = "Decentralised file synchronisation";
|
||||
"icon" = "syncthing.svg";
|
||||
"href" = "https://syncthing.fi33.buzz/";
|
||||
};
|
||||
}
|
||||
{
|
||||
"qBittorrent" = {
|
||||
"description" = "BitTorrent client";
|
||||
|
|
|
|||
78
modules/nixos/features/syncthing.nix
Normal file
78
modules/nixos/features/syncthing.nix
Normal 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}";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue