From 50c4da612b4ec5df63902eba33c4689cb885f706 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Sun, 7 May 2023 13:01:02 +0100 Subject: [PATCH] Move syncthing config into dedicated directory Add SSH keys for tablet and phone to main auth --- Vanguard.nix | 55 ++----------------- syncthing/Vanguard.nix | 51 +++++++++++++++++ .../syncthing.nix => syncthing/default.nix | 1 + syncthing/devices/ion.nix | 4 ++ syncthing/devices/monarch.nix | 4 ++ syncthing/devices/northstar.nix | 4 ++ syncthing/devices/vanguard.nix | 4 ++ syncthing/folders/default.nix | 50 +++++++++++++++++ 8 files changed, 124 insertions(+), 49 deletions(-) create mode 100644 syncthing/Vanguard.nix rename hardware/syncthing.nix => syncthing/default.nix (81%) create mode 100644 syncthing/devices/ion.nix create mode 100644 syncthing/devices/monarch.nix create mode 100644 syncthing/devices/northstar.nix create mode 100644 syncthing/devices/vanguard.nix create mode 100644 syncthing/folders/default.nix diff --git a/Vanguard.nix b/Vanguard.nix index 7c835fd0..eb7af681 100644 --- a/Vanguard.nix +++ b/Vanguard.nix @@ -5,10 +5,10 @@ ./common.nix ./hardware/audio.nix ./hardware/bluetooth.nix - ./hardware/syncthing.nix ./locales/en_GB.nix ./desktop/hyprland.nix ./desktop/steam.nix + ./syncthing/Vanguard.nix ]; networking.hostName = "Vanguard"; # Define your hostname. @@ -28,7 +28,11 @@ description = "Evie Litherland-Smith"; extraGroups = [ "networkmanager" "wheel" ]; shell = pkgs.fish; - openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII1tJFdbiyJApuVZFvo9E9kjlBwvXZeySqVuS2qGdxha tux@monarch" ]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII1tJFdbiyJApuVZFvo9E9kjlBwvXZeySqVuS2qGdxha tux@monarch" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINI1dWlS16Keil0MGPWmMsBzx8F9ylfz+fRwxUr8/tZ/ ion" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGAcvAQ8W71Bn8pdMYst1hoVCmVJ+0h4HBlJzu1C6dwy xenia@Northstar" + ]; }; home-manager.users.xenia = { ... }: { imports = [ ./home/collections/personal ]; @@ -42,53 +46,6 @@ programs.fish.shellAbbrs.update = "sudo nixos-rebuild switch"; }; - services.syncthing = { - user = "xenia"; - group = "users"; - dataDir = "/mnt/secondary/syncthing"; - devices = { - "ion" = { id = "7DD4NPH-6T2ET5A-4FCLFWW-CS6UR2W-IO5XQXC-DM5B2Q4-6X7DGU2-UKKVEAB"; }; - "monarch" = { id = "CJSUZQY-67XBLEZ-VKVHQHI-BLEUZNF-G4237AV-AW44CGH-F3JDKXU-CWT3RQZ"; }; - "northstar" = { id = "DMQZNMB-BM3SSE4-5XV2GHE-IDRNFTS-QNZSICS-6JWHUCV-O3NHMWY-2OBC2QD"; }; - }; - folders = { - "archive" = { - id = "hwnqy-xzcdx"; - devices = [ "ion" "monarch northstar" ]; - ignorePerms = true; - }; - "Camera" = { - path = "/mnt/secondary/syncthing/camera"; - label = "Camera"; - id = "fp4_4j7w-photos"; - devices = [ "ion" ]; - type = "receiveonly"; - ignorePerms = true; - }; - "Pictures" = { - path = "/mnt/secondary/syncthing/pictures"; - label = "Pictures"; - id = "ziuj8-rm6dn"; - devices = [ "ion" "monarch" "northstar" ]; - ignorePerms = true; - }; - "Movies" = { - path = "/mnt/secondary/syncthing/movies"; - label = "Movies"; - id = "3f75o-4x6sq"; - devices = [ "ion" "monarch" "northstar" ]; - ignorePerms = true; - }; - "Documents" = { - path = "/mnt/secondary/syncthing/documents"; - label = "Documents"; - id = "qc6qa-bipsd"; - devices = [ "monarch" "northstar" ]; - ignorePerms = true; - }; - }; - }; - # Extra hardware configuration hardware.openrazer = { enable = true; diff --git a/syncthing/Vanguard.nix b/syncthing/Vanguard.nix new file mode 100644 index 00000000..c7374876 --- /dev/null +++ b/syncthing/Vanguard.nix @@ -0,0 +1,51 @@ +{ ... }: +{ + imports = [ + ./default.nix + ./devices/ion.nix + ./devices/monarch.nix + ./devices/northstar.nix + ]; + services.syncthing = { + user = "xenia"; + group = "users"; + dataDir = "/mnt/secondary/syncthing"; + folders = { + "Archive" = { + path = "/mnt/secondary/syncthing/archive"; + devices = [ "ion" "monarch" "northstar" ]; + enable = true; + }; + "Books" = { + path = "/mnt/secondary/syncthing/books"; + devices = [ "monarch" "northstar" ]; + enable = true; + }; + "Camera" = { + path = "/mnt/secondary/syncthing/camera"; + devices = [ "ion" ]; + enable = true; + }; + "Documents" = { + path = "/mnt/secondary/syncthing/documents"; + devices = [ "monarch" "northstar" ]; + enable = true; + }; + "Exports" = { + path = "/mnt/secondary/syncthing/exports"; + devices = [ "monarch"]; + enable = true; + }; + "Movies" = { + path = "/mnt/secondary/syncthing/movies"; + devices = [ "ion" "monarch" "northstar" ]; + enable = true; + }; + "Pictures" = { + path = "/mnt/secondary/syncthing/pictures"; + devices = [ "ion" "monarch" "northstar" ]; + enable = true; + }; + }; + }; +} diff --git a/hardware/syncthing.nix b/syncthing/default.nix similarity index 81% rename from hardware/syncthing.nix rename to syncthing/default.nix index 70ef403b..6070c6ea 100644 --- a/hardware/syncthing.nix +++ b/syncthing/default.nix @@ -1,5 +1,6 @@ { ... }: { + imports = [ ./folders ]; services.syncthing = { enable = true; systemService = true; diff --git a/syncthing/devices/ion.nix b/syncthing/devices/ion.nix new file mode 100644 index 00000000..462be82e --- /dev/null +++ b/syncthing/devices/ion.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + services.syncthing.devices."ion" = { id = "7DD4NPH-6T2ET5A-4FCLFWW-CS6UR2W-IO5XQXC-DM5B2Q4-6X7DGU2-UKKVEAB"; }; +} diff --git a/syncthing/devices/monarch.nix b/syncthing/devices/monarch.nix new file mode 100644 index 00000000..4db1adc8 --- /dev/null +++ b/syncthing/devices/monarch.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + services.syncthing.devices."monarch" = { id = "CJSUZQY-67XBLEZ-VKVHQHI-BLEUZNF-G4237AV-AW44CGH-F3JDKXU-CWT3RQZ"; }; +} diff --git a/syncthing/devices/northstar.nix b/syncthing/devices/northstar.nix new file mode 100644 index 00000000..7d0a34c9 --- /dev/null +++ b/syncthing/devices/northstar.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + services.syncthing.devices."northstar" = { id = "DMQZNMB-BM3SSE4-5XV2GHE-IDRNFTS-QNZSICS-6JWHUCV-O3NHMWY-2OBC2QD"; }; +} diff --git a/syncthing/devices/vanguard.nix b/syncthing/devices/vanguard.nix new file mode 100644 index 00000000..ec4d4bdc --- /dev/null +++ b/syncthing/devices/vanguard.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + services.syncthing.devices."vanguard" = { id = "YNGBLJP-TWY6Y3C-DPPYAWL-3ZQFNQH-RDPIU5T-L54UI62-FPPA3JQ-WYXBZQZ"; }; +} diff --git a/syncthing/folders/default.nix b/syncthing/folders/default.nix new file mode 100644 index 00000000..4ce9c61f --- /dev/null +++ b/syncthing/folders/default.nix @@ -0,0 +1,50 @@ +{ lib, ... }: +{ + services.syncthing = { + folders = { + "Archive" = { + label = "Archive"; + id = "hwnqy-xzcdx"; + ignorePerms = true; + enable = lib.mkDefault false; + }; + "Books" = { + label = "Books"; + id = "zjmxy-ycmbq"; + ignorePerms = true; + enable = lib.mkDefault false; + }; + "Camera" = { + label = "Camera"; + id = "fp4_4j7w-photos"; + type = "receiveonly"; + ignorePerms = true; + enable = lib.mkDefault false; + }; + "Documents" = { + label = "Documents"; + id = "qc6qa-bipsd"; + ignorePerms = true; + enable = lib.mkDefault false; + }; + "Exports" = { + label = "Exports"; + id = "tof2e-pdtde"; + ignorePerms = true; + enable = lib.mkDefault false; + }; + "Movies" = { + label = "Movies"; + id = "3f75o-4x6sq"; + ignorePerms = true; + enable = lib.mkDefault false; + }; + "Pictures" = { + label = "Pictures"; + id = "ziuj8-rm6dn"; + ignorePerms = true; + enable = lib.mkDefault false; + }; + }; + }; +}