From 59bb47345114d5241e983e947178022485cc8c23 Mon Sep 17 00:00:00 2001 From: coolneng Date: Tue, 9 Jun 2020 21:53:20 +0200 Subject: [PATCH] Retire monolith from all services --- modules/datasync.nix | 29 +++++++++++++++-------------- modules/networking.nix | 27 +++++++++------------------ modules/printing.nix | 22 ++++++++-------------- 3 files changed, 32 insertions(+), 46 deletions(-) diff --git a/modules/datasync.nix b/modules/datasync.nix index 4e32803..688e8d3 100644 --- a/modules/datasync.nix +++ b/modules/datasync.nix @@ -1,11 +1,7 @@ # Syncthing and Radicale configuration -{ config, pkgs, lib, ... }: -{ +{ config, pkgs, lib, ... }: { - environment.systemPackages = with pkgs; [ - syncthing - radicale - ]; + environment.systemPackages = with pkgs; [ syncthing radicale ]; # Enable syncthing services.syncthing = { @@ -15,44 +11,49 @@ dataDir = "/vault/syncthing"; declarative = { devices = { - monolith = { id = "64P2YDH-S5V7PKM-XXBOSXC-WEXUSC7-B553ELI-6IJ3CPJ-ZFB3YA5-MTKAFAH"; }; - roamer = { id = "7CDUG25-KGBOIA7-Y73TZGA-NEHYLZP-OEOEWVN-DMS5U7K-QNNMPKY-YNGEWQL"; }; - panacea = { id = "UNZIABR-GEQ4AWT-XKFADLW-HW3SQ3Y-BEYZ56A-W530DLS-DXGQWKK-2QQ4RQ6"; }; + roamer = { + id = + "7CDUG25-KGBOIA7-Y73TZGA-NEHYLZP-OEOEWVN-DMS5U7K-QNNMPKY-YNGEWQL"; + }; + panacea = { + id = + "UNZIABR-GEQ4AWT-XKFADLW-HW3SQ3Y-BEYZ56A-W530DLS-DXGQWKK-2QQ4RQ6"; + }; }; folders = { Documents = { id = "wusdj-bfjkr"; type = "receiveonly"; path = "/vault/syncthing/Documents"; - devices = [ "monolith" "roamer" "panacea" ]; + devices = [ "roamer" "panacea" ]; }; Notes = { id = "kafhz-bfmzm"; type = "receiveonly"; path = "/vault/syncthing/Notes"; - devices = [ "monolith" "roamer" "panacea" ]; + devices = [ "roamer" "panacea" ]; }; Music = { id = "2aqt7-vpprc"; type = "receiveonly"; path = "/vault/syncthing/Music"; - devices = [ "monolith" "roamer" "panacea" ]; + devices = [ "roamer" "panacea" ]; }; Photos = { id = "mjibc-ustcg"; type = "receiveonly"; path = "/vault/syncthing/Photos"; - devices = [ "monolith" "roamer" "panacea" ]; + devices = [ "roamer" "panacea" ]; }; Projects = { id = "cjhmu-avy9v"; type = "receiveonly"; path = "/vault/syncthing/Projects"; - devices = [ "monolith" "panacea" ]; + devices = [ "panacea" ]; }; }; }; diff --git a/modules/networking.nix b/modules/networking.nix index ac28d8d..11b04ae 100644 --- a/modules/networking.nix +++ b/modules/networking.nix @@ -1,15 +1,10 @@ { config, pkgs, lib, ... }: - let password = builtins.readFile /var/lib/ddclient/token; +let password = builtins.readFile /var/lib/ddclient/token; - in -{ +in { - environment.systemPackages = with pkgs; [ - avahi - ddclient - wireguard - ]; + environment.systemPackages = with pkgs; [ avahi ddclient wireguard mbuffer ]; # Enable zeroconf services.avahi = { @@ -18,11 +13,12 @@ publish = { enable = true; userServices = true; + domain = true; + workstation = true; }; reflector = true; }; - # Dynamic DNS configuration services.ddclient = { enable = true; @@ -46,8 +42,8 @@ autoLoadConntrackHelpers = true; connectionTrackingModules = [ "sane" ]; extraCommands = '' - iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE - ''; + iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE + ''; }; # Disable IPv6 @@ -67,9 +63,9 @@ listenPort = 1194; privateKeyFile = "/home/coolneng/.wg/keys/privatekey"; peers = [ - # Monolith + # Panacea { - publicKey = "ka9a/VB49XMtrMw/ZJmZHThfk2Y5D/8wErLPtN+KvHE="; + publicKey = "XMkTztU2Y8hw6Fu/2o4Gszij+EmNacvFMXuZyHS1n38="; allowedIPs = [ "10.8.0.2/32" ]; } # Roamer @@ -77,11 +73,6 @@ publicKey = "gS5VIUFL74kTs3zxVNT/ijWyOjeAFLEqWynD0Pefh1o="; allowedIPs = [ "10.8.0.3/32" ]; } - # Panacea - { - publicKey = "XMkTztU2Y8hw6Fu/2o4Gszij+EmNacvFMXuZyHS1n38="; - allowedIPs = [ "10.8.0.4/32" ]; - } ]; }; }; diff --git a/modules/printing.nix b/modules/printing.nix index a8cfc78..1cad746 100644 --- a/modules/printing.nix +++ b/modules/printing.nix @@ -1,11 +1,7 @@ # CUPS and SANE configuration -{ config, pkgs, lib, ... }: -{ +{ config, pkgs, lib, ... }: { - environment.systemPackages = with pkgs; [ - cups - sane-backends - ]; + environment.systemPackages = with pkgs; [ cups sane-backends ]; # Enable CUPS with Zeroconf services.printing = { @@ -18,20 +14,18 @@ # Enable SANE hardware.sane = { - enable = true; - extraBackends = with pkgs; [ hplip ]; + enable = true; + extraBackends = with pkgs; [ hplip ]; }; services.saned = { - enable = true; - extraConfig = '' + enable = true; + extraConfig = '' 192.168.1.0/24 10.8.0.2/32 - ''; + ''; }; - users.users.scanner = { - extraGroups = [ "lp" ]; - }; + users.users.scanner = { extraGroups = [ "lp" ]; }; }