From de36958760df0b606dbb311c900e9cfea0838292 Mon Sep 17 00:00:00 2001 From: coolneng Date: Thu, 7 Nov 2019 14:25:27 +0100 Subject: [PATCH] Set up Syncthing --- Timeline.org | 20 +++++++++++--------- configuration.nix | 7 +++++++ modules/datasync.nix | 42 ++++++++++++++++++++++++++++++++++++++++++ modules/networking.nix | 2 +- 4 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 modules/datasync.nix diff --git a/Timeline.org b/Timeline.org index 61b4a03..7baedb0 100644 --- a/Timeline.org +++ b/Timeline.org @@ -29,8 +29,15 @@ - [ ] VPN setup *** TODO Wireguard [0/1] [0%] - [ ] Encrypted DNS -** LEMP stack [0/8] [0%] -*** TODO Nginx +** Data sync [0/2] [0%] +*** IN-PROGRESS Syncthing [0/3] [0%] + - [ ] Basic configuration + - [ ] Relay server + - [ ] Discovery server +*** TODO Radicale +** Web stack [0/7] [0%] +*** TODO Nginx [0/1] [0%] + - [ ] Radicale reverse proxy *** TODO PHP [0/1] [0%] - [ ] Php-fpm *** TODO PostgreSQL [0/1] [0%] @@ -38,18 +45,13 @@ *** TODO Certbot [0/2] [0%] - [ ] Obtain certs - [ ] Script to renew certs -*** TODO Syncthing [0/2] [0%] - - [ ] Relay server - - [ ] Discovery server -*** TODO Radicale *** TODO Wallabag *** TODO Miniflux *** TODO Hugo [0/2] [0%] - [ ] Blog website - [ ] Ox-hugo ** Software development [0/2] [0%] -*** TODO Git [0/2] [0%] - - [ ] Gitea +*** TODO Gitea [0/1] [0%] - [ ] Import existing repositories *** TODO Drone ** Backup [0/2] [0%] @@ -64,7 +66,7 @@ ** Workflow [0/1] [0%] *** TODO Automate nix files deployment [0/2] [0%] - [ ] Send local file to Zion - - [ ] Rebuild + - [ ] Hook to rebuild ** Communication [0/2] [0%] *** TODO Matrix *** TODO Mail [0/1] [0%] diff --git a/configuration.nix b/configuration.nix index eeb2fa1..14fc87a 100644 --- a/configuration.nix +++ b/configuration.nix @@ -89,6 +89,12 @@ }; }; + # Run Nix garbage collector daily + nix.gc = { + automatic = true; + dates = "03:15"; + }; + # Configure fish shell #programs.fish.enable = true; @@ -99,6 +105,7 @@ imports = [ ./modules/printing.nix ./modules/networking.nix + ./modules/datasync.nix ]; } diff --git a/modules/datasync.nix b/modules/datasync.nix new file mode 100644 index 0000000..7d977a4 --- /dev/null +++ b/modules/datasync.nix @@ -0,0 +1,42 @@ +# Syncthing and Radicale configuration +{ config, pkgs, lib, ... }: +{ + + environment.systemPackages = with pkgs; [ + syncthing + syncthing-relay + syncthing-discovery + radicale + ]; + + # Enable Syncthing + services.syncthing = { + enable = true; + openDefaultPorts = true; + guiAddress = "0.0.0.0:8384"; + dataDir = "/vault/syncthing"; + declarative = { + devices = { + monolith = { id = "QGDGEZQ-INE7XDY-DNX2QI4-QI7ANQJ-57REEO2-FUMH545-FZS5RYU-ULF7HA2"; }; + }; + #cert = ""; + #key = ""; + folders = {}; + }; + #relay = { + #enable = true; + #pools = ""; + #}; + }; + + # Enable Radicale + services.radicale = { + enable = true; + config = '' + + ''; + }; + + + +} diff --git a/modules/networking.nix b/modules/networking.nix index 651302d..c1e5839 100644 --- a/modules/networking.nix +++ b/modules/networking.nix @@ -32,7 +32,7 @@ # Firewall configuration networking.firewall = { - allowedTCPPorts = [ 631 6566 ]; + allowedTCPPorts = [ 631 6566 22067 8384 ]; autoLoadConntrackHelpers = true; connectionTrackingModules = [ "sane" ]; };