feat(syncthing): adding syncthing host to sobotka
This commit is contained in:
@@ -9,6 +9,11 @@
|
|||||||
uid = 994;
|
uid = 994;
|
||||||
gid = 993;
|
gid = 993;
|
||||||
|
|
||||||
|
mounts = {
|
||||||
|
fast = "/mnt/user";
|
||||||
|
config = "/persist/opt/services";
|
||||||
|
};
|
||||||
|
|
||||||
unbound = {
|
unbound = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -129,6 +129,7 @@
|
|||||||
./server/lidarr
|
./server/lidarr
|
||||||
./server/radarr
|
./server/radarr
|
||||||
./server/sonarr
|
./server/sonarr
|
||||||
|
./server/syncthing
|
||||||
./server/jellyseerr
|
./server/jellyseerr
|
||||||
./server/jellyfin
|
./server/jellyfin
|
||||||
./server/podman
|
./server/podman
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
home.services.syncthing.enable = mkEnableOption "Enables syncthing";
|
home.services.syncthing = {
|
||||||
|
enable = mkEnableOption "Enables syncthing";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
services.syncthing = {
|
services.syncthing = {
|
||||||
|
|||||||
@@ -11,6 +11,20 @@ in
|
|||||||
{
|
{
|
||||||
options.server = {
|
options.server = {
|
||||||
enable = lib.mkEnableOption "The server services and configuration variables";
|
enable = lib.mkEnableOption "The server services and configuration variables";
|
||||||
|
mounts.fast = lib.mkOption {
|
||||||
|
default = "/mnt/cache";
|
||||||
|
type = lib.types.path;
|
||||||
|
description = ''
|
||||||
|
Path to the 'fast' tier mount
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
mounts.config = lib.mkOption {
|
||||||
|
default = "/persist/opt/services";
|
||||||
|
type = lib.types.path;
|
||||||
|
description = ''
|
||||||
|
Path to the service configuration files
|
||||||
|
'';
|
||||||
|
};
|
||||||
email = mkOption {
|
email = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
@@ -53,7 +67,6 @@ in
|
|||||||
GID to run the server services as
|
GID to run the server services as
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
timeZone = lib.mkOption {
|
timeZone = lib.mkOption {
|
||||||
default = "Europe/Stockholm";
|
default = "Europe/Stockholm";
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
@@ -62,6 +75,7 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
users = {
|
users = {
|
||||||
groups.${cfg.group} = {
|
groups.${cfg.group} = {
|
||||||
|
|||||||
68
modules/server/syncthing/default.nix
Normal file
68
modules/server/syncthing/default.nix
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
unit = "syncthing";
|
||||||
|
srv = config.server;
|
||||||
|
cfg = config.server.${unit};
|
||||||
|
dir = [
|
||||||
|
"${srv.mounts.config}/syncthing"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.server.${unit} = {
|
||||||
|
enable = lib.mkEnableOption {
|
||||||
|
description = "Enable ${unit}";
|
||||||
|
};
|
||||||
|
url = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "${unit}.${srv.domain}";
|
||||||
|
};
|
||||||
|
homepage.name = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "Syncthing";
|
||||||
|
};
|
||||||
|
homepage.description = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "Continuous file synchronization program.";
|
||||||
|
};
|
||||||
|
homepage.icon = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "syncthing.svg";
|
||||||
|
};
|
||||||
|
homepage.category = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "Services";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
systemd.tmpfiles.rules = map (x: "d ${x} 0775 share share - -") dir;
|
||||||
|
networking.firewall = {
|
||||||
|
allowedTCPPorts = [
|
||||||
|
8384
|
||||||
|
22000
|
||||||
|
];
|
||||||
|
allowedUDPPorts = [
|
||||||
|
22000
|
||||||
|
21027
|
||||||
|
];
|
||||||
|
};
|
||||||
|
services.${unit} = {
|
||||||
|
enable = true;
|
||||||
|
user = srv.user;
|
||||||
|
group = srv.group;
|
||||||
|
overrideFolders = false;
|
||||||
|
overrideDevices = false;
|
||||||
|
dataDir = "${srv.mounts.fast}/Syncthing";
|
||||||
|
configDir = "${srv.mounts.config}/syncthing";
|
||||||
|
};
|
||||||
|
services.caddy.virtualHosts."${cfg.url}" = {
|
||||||
|
useACMEHost = srv.domain;
|
||||||
|
extraConfig = ''
|
||||||
|
reverse_proxy http://127.0.0.1:8384}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user