From f2b1a68c7b6f2e583e20d13ce86b0fecb168b52c Mon Sep 17 00:00:00 2001 From: Trevor Vallender Date: Wed, 27 Sep 2023 12:58:32 +0100 Subject: [PATCH] Add SyncThing to kerighan Also move services to shared for better composability. --- system/kernighan/kernighan.nix | 3 ++- system/{kernighan => shared}/services/git.nix | 0 .../services/home_assistant.nix | 0 system/{kernighan => shared}/services/nginx.nix | 8 +++++--- system/shared/services/syncthing.nix | 16 ++++++++++++++++ 5 files changed, 23 insertions(+), 4 deletions(-) rename system/{kernighan => shared}/services/git.nix (100%) rename system/{kernighan => shared}/services/home_assistant.nix (100%) rename system/{kernighan => shared}/services/nginx.nix (74%) create mode 100644 system/shared/services/syncthing.nix diff --git a/system/kernighan/kernighan.nix b/system/kernighan/kernighan.nix index 8bbc213..32cc1f9 100644 --- a/system/kernighan/kernighan.nix +++ b/system/kernighan/kernighan.nix @@ -6,8 +6,9 @@ [ ../shared/shared-configuration.nix ./kernighan-hardware.nix + ../shared/services/syncthing.nix #./services/git.nix - #./services/nginx.nix + ../shared/services/nginx.nix ]; networking = { diff --git a/system/kernighan/services/git.nix b/system/shared/services/git.nix similarity index 100% rename from system/kernighan/services/git.nix rename to system/shared/services/git.nix diff --git a/system/kernighan/services/home_assistant.nix b/system/shared/services/home_assistant.nix similarity index 100% rename from system/kernighan/services/home_assistant.nix rename to system/shared/services/home_assistant.nix diff --git a/system/kernighan/services/nginx.nix b/system/shared/services/nginx.nix similarity index 74% rename from system/kernighan/services/nginx.nix rename to system/shared/services/nginx.nix index 2cab710..121f43c 100644 --- a/system/kernighan/services/nginx.nix +++ b/system/shared/services/nginx.nix @@ -9,17 +9,19 @@ recommendedProxySettings = true; recommendedTlsSettings = true; - virtualHosts."test.tsvallender.co.uk" = { + virtualHosts."syncthing.tsvallender.co.uk" = { forceSSL = true; enableACME = true; - root = "/var/www/tsvallender.co.uk"; + locations."/" = { + proxyPass = "http://localhost:8384"; + }; }; }; security.acme = { acceptTerms = true; defaults = { email = "t+acme@tsvallender.co.uk"; - }; + }; }; } diff --git a/system/shared/services/syncthing.nix b/system/shared/services/syncthing.nix new file mode 100644 index 0000000..bea460a --- /dev/null +++ b/system/shared/services/syncthing.nix @@ -0,0 +1,16 @@ +{ config, pkgs, inputs, ... }: + +{ + services.syncthing = { + enable = true; + user = "tsv"; + dataDir = "/home/tsv/storagebox"; + configDir = "/home/tsv/.config/syncthing"; + extraOptions = { + gui.user = "tsv"; + gui.password = "$2y$10$FQ.8RNztxQ1CvsnksTlYSOsgadHVc47yUhQQpc5X61BFVXXpDq..2"; + gui.insecureSkipHostcheck = true; + }; + }; +} +