mirror of
https://github.com/Smaug123/PulumiConfig
synced 2025-10-30 19:28:57 +00:00
Syncthing (#47)
This commit is contained in:
@@ -105,6 +105,7 @@ type WellKnownSubdomain =
|
|||||||
| PureGym
|
| PureGym
|
||||||
| Whisper
|
| Whisper
|
||||||
| Robocop
|
| Robocop
|
||||||
|
| Syncthing
|
||||||
|
|
||||||
override this.ToString () =
|
override this.ToString () =
|
||||||
match this with
|
match this with
|
||||||
@@ -119,6 +120,7 @@ type WellKnownSubdomain =
|
|||||||
| WellKnownSubdomain.PureGym -> "puregym"
|
| WellKnownSubdomain.PureGym -> "puregym"
|
||||||
| WellKnownSubdomain.Whisper -> "whisper"
|
| WellKnownSubdomain.Whisper -> "whisper"
|
||||||
| WellKnownSubdomain.Robocop -> "robocop"
|
| WellKnownSubdomain.Robocop -> "robocop"
|
||||||
|
| WellKnownSubdomain.Syncthing -> "syncthing"
|
||||||
|
|
||||||
static member Parse (s : string) =
|
static member Parse (s : string) =
|
||||||
match s with
|
match s with
|
||||||
@@ -133,6 +135,7 @@ type WellKnownSubdomain =
|
|||||||
| "puregym" -> WellKnownSubdomain.PureGym
|
| "puregym" -> WellKnownSubdomain.PureGym
|
||||||
| "whisper" -> WellKnownSubdomain.Whisper
|
| "whisper" -> WellKnownSubdomain.Whisper
|
||||||
| "robocop" -> WellKnownSubdomain.Robocop
|
| "robocop" -> WellKnownSubdomain.Robocop
|
||||||
|
| "syncthing" -> WellKnownSubdomain.Syncthing
|
||||||
| _ -> failwith $"Failed to deserialise: {s}"
|
| _ -> failwith $"Failed to deserialise: {s}"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ in {
|
|||||||
./sops.nix
|
./sops.nix
|
||||||
./apps/apps.nix
|
./apps/apps.nix
|
||||||
./radicale/radicale-config.nix
|
./radicale/radicale-config.nix
|
||||||
|
./syncthing/syncthing-config.nix
|
||||||
./gitea/gitea-config.nix
|
./gitea/gitea-config.nix
|
||||||
./miniflux/miniflux.nix
|
./miniflux/miniflux.nix
|
||||||
./userconfig.nix
|
./userconfig.nix
|
||||||
@@ -48,6 +49,8 @@ in {
|
|||||||
services.apps-config.domain = userConfig.domain;
|
services.apps-config.domain = userConfig.domain;
|
||||||
# services.whisper-config.domain = userConfig.domain;
|
# services.whisper-config.domain = userConfig.domain;
|
||||||
# services.whisper-config.subdomain = "whisper";
|
# services.whisper-config.subdomain = "whisper";
|
||||||
|
services.syncthing-config.subdomain = "syncthing";
|
||||||
|
services.syncthing-config.domain = userConfig.domain;
|
||||||
|
|
||||||
services.journald.extraConfig = "SystemMaxUse=100M";
|
services.journald.extraConfig = "SystemMaxUse=100M";
|
||||||
|
|
||||||
|
|||||||
41
PulumiWebServer/Nix/syncthing/syncthing-config.nix
Normal file
41
PulumiWebServer/Nix/syncthing/syncthing-config.nix
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
options = {
|
||||||
|
services.syncthing-config = {
|
||||||
|
domain = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
example = "example.com";
|
||||||
|
description = lib.mdDoc "Top-level domain to configure";
|
||||||
|
};
|
||||||
|
subdomain = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
example = "syncthing";
|
||||||
|
description = lib.mdDoc "Subdomain in which to put Syncthing";
|
||||||
|
};
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
description = lib.mdDoc "Syncthing localhost port";
|
||||||
|
default = 8384;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = let
|
||||||
|
filesystem_folder = "/preserve/syncthing/";
|
||||||
|
in {
|
||||||
|
services.syncthing = {
|
||||||
|
enable = true;
|
||||||
|
user = "syncthing";
|
||||||
|
dataDir = "${filesystem_folder}/data"; # Default folder for new synced folders
|
||||||
|
configDir = "${filesystem_folder}/config"; # Folder for Syncthing's settings and keys
|
||||||
|
openDefaultPorts = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.syncthing.serviceConfig.ReadWritePaths = [filesystem_folder];
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = ["d ${filesystem_folder} 0750 syncthing syncthing -"];
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user