Add Vanguard back to syncthing

This commit is contained in:
Evie Litherland-Smith 2023-08-30 07:28:36 +01:00
parent 277cc638f1
commit 09e52ee595
5 changed files with 50 additions and 46 deletions

View file

@ -2,11 +2,9 @@
build: build:
sudo nixos-rebuild build --flake . sudo nixos-rebuild build --flake .
-nix run nixpkgs#home-manager -- build --flake .
switch: switch:
sudo nixos-rebuild switch --flake . sudo nixos-rebuild switch --flake .
-nix run nixpkgs#home-manager -- switch --flake .
test: test:
sudo nixos-rebuild test --flake . sudo nixos-rebuild test --flake .

View file

@ -1,4 +1,5 @@
{lib, ...}: let { ... }:
let
# generate via openvpn --genkey --secret openvpn-laptop.key # generate via openvpn --genkey --secret openvpn-laptop.key
client-key = "/root/openvpn.key"; client-key = "/root/openvpn.key";
domain = "vpn.xenia.me.uk"; domain = "vpn.xenia.me.uk";
@ -19,21 +20,20 @@ in {
]; ];
services.syncthing = let services.syncthing = let
user = "xenia"; user = "xenia";
group = "users";
dataDir = "/var/lib/syncthing"; dataDir = "/var/lib/syncthing";
in { in {
user = user; inherit user group dataDir;
group = "users";
dataDir = dataDir;
settings.folders = { settings.folders = {
"Archive".path = lib.mkForce (dataDir + "/Archive"); "Archive".path = dataDir + "/Archive";
"Books".path = lib.mkForce (dataDir + "/Books"); "Books".path = dataDir + "/Books";
"Comics".path = lib.mkForce (dataDir + "/Comics"); "Comics".path = dataDir + "/Comics";
"Documents".path = lib.mkForce (dataDir + "/Documents"); "Documents".path = dataDir + "/Documents";
"Exports".path = lib.mkForce (dataDir + "/Exports"); "Exports".path = dataDir + "/Exports";
"Notes".path = lib.mkForce (dataDir + "/Notes"); "Notes".path = dataDir + "/Notes";
"Pictures".path = lib.mkForce (dataDir + "/Pictures"); "Pictures".path = dataDir + "/Pictures";
"Tasks".path = lib.mkForce (dataDir + "/Tasks"); "Tasks".path = dataDir + "/Tasks";
"Zotero".path = lib.mkForce (dataDir + "/Zotero"); "Zotero".path = dataDir + "/Zotero";
}; };
}; };
@ -41,11 +41,11 @@ in {
nat = { nat = {
enable = true; enable = true;
externalInterface = "enp42s0"; externalInterface = "enp42s0";
internalInterfaces = [vpn-dev]; internalInterfaces = [ vpn-dev ];
}; };
firewall = { firewall = {
trustedInterfaces = [vpn-dev]; trustedInterfaces = [ vpn-dev ];
allowedUDPPorts = [port]; allowedUDPPorts = [ port ];
}; };
}; };

View file

@ -1,12 +1,11 @@
{...}: let {...}: let
user = "elitherl"; user = "elitherl";
group = "users";
dataDir = "/home/${user}"; dataDir = "/home/${user}";
in { in {
imports = [./syncthing]; imports = [./syncthing];
services.syncthing = { services.syncthing = {
user = user; inherit user group dataDir;
group = "users";
dataDir = dataDir;
settings.folders = { settings.folders = {
"Archive".enable = false; "Archive".enable = false;
"Books".enable = false; "Books".enable = false;

View file

@ -1 +1,18 @@
{ ... }: { imports = [ ./sshd ]; } { ... }:
let
user = "xenia";
group = "users";
dataDir = "/home/${user}";
in {
imports = [ ./sshd ./syncthing ];
services.syncthing = {
inherit user group dataDir;
settings.folders = {
"Archive".enable = false;
"Books".enable = false;
"Comics".enable = false;
"Exports".enable = false;
"Pictures".enable = false;
};
};
}

View file

@ -1,11 +1,7 @@
{ lib, ... }: { lib, ... }:
let let
defaultDataDir = "/var/lib/syncthing"; defaultDataDir = "/var/lib/syncthing";
deviceGroups = { devices = [ "Ion" "Legion" "Monarch" "Ronin" "Vanguard" ];
all = [ "Ion" "Legion" "Monarch" ];
personal = [ "Legion" "Monarch" ];
work = [ "Ion" "Legion" "Monarch" "Ronin" ];
};
in { in {
services.syncthing = { services.syncthing = {
enable = true; enable = true;
@ -14,66 +10,60 @@ in {
openDefaultPorts = true; openDefaultPorts = true;
settings = { settings = {
devices = { devices = {
"Ion".id = "Ion".id = "7DD4NPH-6T2ET5A-4FCLFWW-CS6UR2W-IO5XQXC-DM5B2Q4-6X7DGU2-UKKVEAB";
"7DD4NPH-6T2ET5A-4FCLFWW-CS6UR2W-IO5XQXC-DM5B2Q4-6X7DGU2-UKKVEAB"; "Legion".id = "6OX54CG-EAQMXKA-K7TXB5P-G5A27HB-52JE2FA-XNAYZU6-YMIDBXP-RKPBJQV";
"Legion".id = "Monarch".id = "CJSUZQY-67XBLEZ-VKVHQHI-BLEUZNF-G4237AV-AW44CGH-F3JDKXU-CWT3RQZ";
"6OX54CG-EAQMXKA-K7TXB5P-G5A27HB-52JE2FA-XNAYZU6-YMIDBXP-RKPBJQV"; "Ronin".id = "ZOL5YHK-ZZZULIE-UHGVKHW-H5E4BP7-S4CZBOX-OIZVUCV-RZUXOKA-QVBUBAJ";
"Monarch".id = "Vanguard".id = "I366QNQ-D3FTDRX-RNOTXMW-YITZXOF-DSCDMQD-63Q72LI-ME2Y4HZ-T34RMQK";
"CJSUZQY-67XBLEZ-VKVHQHI-BLEUZNF-G4237AV-AW44CGH-F3JDKXU-CWT3RQZ";
# "Nortstar".id = "";
"Ronin".id =
"ZOL5YHK-ZZZULIE-UHGVKHW-H5E4BP7-S4CZBOX-OIZVUCV-RZUXOKA-QVBUBAJ";
"Vanguard".id =
"I366QNQ-D3FTDRX-RNOTXMW-YITZXOF-DSCDMQD-63Q72LI-ME2Y4HZ-T34RMQK";
}; };
folders = { folders = {
"Archive" = { "Archive" = {
inherit devices;
id = "hwnqy-xzcdx"; id = "hwnqy-xzcdx";
path = lib.mkDefault "~/Documents/Archive"; path = lib.mkDefault "~/Documents/Archive";
ignorePerms = true; ignorePerms = true;
devices = deviceGroups.personal;
}; };
"Books" = { "Books" = {
inherit devices;
id = "zjmxy-ycmbq"; id = "zjmxy-ycmbq";
path = lib.mkDefault "~/Documents/Books"; path = lib.mkDefault "~/Documents/Books";
ignorePerms = true; ignorePerms = true;
devices = deviceGroups.personal;
}; };
"Comics" = { "Comics" = {
inherit devices;
id = "kc2h0-q3wot"; id = "kc2h0-q3wot";
path = lib.mkDefault "~/Documents/Comics"; path = lib.mkDefault "~/Documents/Comics";
ignorePerms = true; ignorePerms = true;
devices = deviceGroups.personal;
}; };
"Documents" = { "Documents" = {
inherit devices;
id = "qc6qa-bipsd"; id = "qc6qa-bipsd";
path = lib.mkDefault "~/Documents/Sync"; path = lib.mkDefault "~/Documents/Sync";
ignorePerms = true; ignorePerms = true;
devices = deviceGroups.personal;
}; };
"Exports" = { "Exports" = {
inherit devices;
id = "tof2e-pdtde"; id = "tof2e-pdtde";
path = lib.mkDefault "~/Documents/Exports"; path = lib.mkDefault "~/Documents/Exports";
ignorePerms = true; ignorePerms = true;
devices = deviceGroups.personal;
}; };
"Notes" = { "Notes" = {
inherit devices;
id = "4ggjz-5dyop"; id = "4ggjz-5dyop";
path = lib.mkDefault "~/Notes"; path = lib.mkDefault "~/Notes";
ignorePerms = true; ignorePerms = true;
devices = deviceGroups.work;
}; };
"Pictures" = { "Pictures" = {
inherit devices;
id = "ziuj8-rm6dn"; id = "ziuj8-rm6dn";
path = lib.mkDefault "~/Pictures"; path = lib.mkDefault "~/Pictures";
ignorePerms = true; ignorePerms = true;
devices = deviceGroups.all;
}; };
"Zotero" = { "Zotero" = {
inherit devices;
id = "huyvn-liwc9"; id = "huyvn-liwc9";
path = lib.mkDefault "~/Documents/Zotero"; path = lib.mkDefault "~/Documents/Zotero";
ignorePerms = true; ignorePerms = true;
devices = deviceGroups.work;
}; };
}; };
}; };