ignore sync conflicts and reconfigure syncthing settings

This commit is contained in:
Joseph Hanson 2024-11-07 22:21:32 -06:00
parent 98378ae285
commit 5bf9930b16
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o
7 changed files with 32 additions and 30 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
**/*.tmp.sops.yaml **/*.tmp.sops.yaml
**/*.sops.tmp.yaml **/*.sops.tmp.yaml
**/*sync-conflict*
age.key age.key
result* result*
.direnv .direnv

View file

@ -107,13 +107,13 @@ in
}; };
"syncthing/publicCert" = { "syncthing/publicCert" = {
sopsFile = ./secrets.sops.yaml; sopsFile = ./secrets.sops.yaml;
owner = "syncthing"; owner = "jahanson";
mode = "400"; mode = "400";
restartUnits = [ "syncthing.service" ]; restartUnits = [ "syncthing.service" ];
}; };
"syncthing/privateKey" = { "syncthing/privateKey" = {
sopsFile = ./secrets.sops.yaml; sopsFile = ./secrets.sops.yaml;
owner = "syncthing"; owner = "jahanson";
mode = "400"; mode = "400";
restartUnits = [ "syncthing.service" ]; restartUnits = [ "syncthing.service" ];
}; };
@ -170,6 +170,7 @@ in
# Syncthing # Syncthing
syncthing = { syncthing = {
enable = true; enable = true;
user = "jahanson";
publicCertPath = config.sops.secrets."syncthing/publicCert".path; publicCertPath = config.sops.secrets."syncthing/publicCert".path;
privateKeyPath = config.sops.secrets."syncthing/privateKey".path; privateKeyPath = config.sops.secrets."syncthing/privateKey".path;
}; };

View file

@ -120,13 +120,13 @@ in
sops.secrets = { sops.secrets = {
"syncthing/publicCert" = { "syncthing/publicCert" = {
sopsFile = ./secrets.sops.yaml; sopsFile = ./secrets.sops.yaml;
owner = "syncthing"; owner = "jahanson";
mode = "400"; mode = "400";
restartUnits = [ "syncthing.service" ]; restartUnits = [ "syncthing.service" ];
}; };
"syncthing/privateKey" = { "syncthing/privateKey" = {
sopsFile = ./secrets.sops.yaml; sopsFile = ./secrets.sops.yaml;
owner = "syncthing"; owner = "jahanson";
mode = "400"; mode = "400";
restartUnits = [ "syncthing.service" ]; restartUnits = [ "syncthing.service" ];
}; };
@ -167,6 +167,7 @@ in
# Syncthing # Syncthing
syncthing = { syncthing = {
enable = true; enable = true;
user = "jahanson";
publicCertPath = config.sops.secrets."syncthing/publicCert".path; publicCertPath = config.sops.secrets."syncthing/publicCert".path;
privateKeyPath = config.sops.secrets."syncthing/privateKey".path; privateKeyPath = config.sops.secrets."syncthing/privateKey".path;
}; };

View file

@ -49,13 +49,13 @@
sops.secrets = { sops.secrets = {
"syncthing/publicCert" = { "syncthing/publicCert" = {
sopsFile = ./secrets.sops.yaml; sopsFile = ./secrets.sops.yaml;
owner = "syncthing"; owner = "jahanson";
mode = "400"; mode = "400";
restartUnits = [ "syncthing.service" ]; restartUnits = [ "syncthing.service" ];
}; };
"syncthing/privateKey" = { "syncthing/privateKey" = {
sopsFile = ./secrets.sops.yaml; sopsFile = ./secrets.sops.yaml;
owner = "syncthing"; owner = "jahanson";
mode = "400"; mode = "400";
restartUnits = [ "syncthing.service" ]; restartUnits = [ "syncthing.service" ];
}; };
@ -67,6 +67,7 @@
services.syncthing = { services.syncthing = {
enable = true; enable = true;
user = "jahanson";
publicCertPath = config.sops.secrets."syncthing/publicCert".path; publicCertPath = config.sops.secrets."syncthing/publicCert".path;
privateKeyPath = config.sops.secrets."syncthing/privateKey".path; privateKeyPath = config.sops.secrets."syncthing/privateKey".path;
}; };

View file

@ -1,6 +1,5 @@
{ sops, ... }: { sops, ... }:
{ {
settings = {
gui = { gui = {
user = sops.secrets.username; user = sops.secrets.username;
password = sops.secrets.password; password = sops.secrets.password;
@ -15,12 +14,12 @@
shadowfax = { shadowfax = {
name = "shadowfax"; name = "shadowfax";
id = "U3DS7CW-GBZT44M-IFP3MOB-AV6SHVY-YFVEL5P-HE3ACC5-NDDGAOB-HOTKJAC"; id = "U3DS7CW-GBZT44M-IFP3MOB-AV6SHVY-YFVEL5P-HE3ACC5-NDDGAOB-HOTKJAC";
addresses = [ "tcp://10.1.1.61:22000" "dynamic" ]; addresses = [ "tcp://10.1.1.61:22000" ];
}; };
gandalf = { gandalf = {
name = "gandalf"; name = "gandalf";
id = "2VYHSOB-4QE3UIJ-EFKAD4D-J7YTLYG-4KF36C2-3SOLD4G-MFR6NK3-C2VSAQV"; id = "2VYHSOB-4QE3UIJ-EFKAD4D-J7YTLYG-4KF36C2-3SOLD4G-MFR6NK3-C2VSAQV";
addresses = [ "tcp://10.1.1.13:22000" "dynamic" ]; addresses = [ "tcp://10.1.1.13:22000" ];
}; };
telchar = { telchar = {
name = "telchar"; name = "telchar";
@ -30,15 +29,9 @@
}; };
folders = { folders = {
"Documents" = { "~/projects" = {
path = "/home/jahanson/projects"; id = "projects";
devices = [ devices = [ "legiondary" "shadowfax" "gandalf" "telchar" ];
"legiondary"
"shadowfax"
"gandalf"
"telchar"
];
};
}; };
}; };
} }

View file

@ -17,6 +17,10 @@ in
type = lib.types.path; type = lib.types.path;
description = "The private key for Syncthing"; description = "The private key for Syncthing";
}; };
user = lib.mkOption {
type = lib.types.str;
description = "The user to run Syncthing as";
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -24,13 +28,13 @@ in
sops.secrets = { sops.secrets = {
"username" = { "username" = {
sopsFile = ./secrets.sops.yaml; sopsFile = ./secrets.sops.yaml;
owner = "syncthing"; owner = "jahanson";
mode = "400"; mode = "400";
restartUnits = [ "syncthing.service" ]; restartUnits = [ "syncthing.service" ];
}; };
"password" = { "password" = {
sopsFile = ./secrets.sops.yaml; sopsFile = ./secrets.sops.yaml;
owner = "syncthing"; owner = "jahanson";
mode = "400"; mode = "400";
restartUnits = [ "syncthing.service" ]; restartUnits = [ "syncthing.service" ];
}; };
@ -39,9 +43,11 @@ in
services = { services = {
syncthing = { syncthing = {
enable = true; enable = true;
user = cfg.user;
dataDir = "/home/${cfg.user}/";
openDefaultPorts = true; openDefaultPorts = true;
key = lib.mkIf (cfg.privateKeyPath != null) "${cfg.privateKeyPath}"; key = "${cfg.privateKeyPath}";
cert = lib.mkIf (cfg.publicCertPath != null) "${cfg.publicCertPath}"; cert = "${cfg.publicCertPath}";
settings = import ./config { inherit (config) sops; }; settings = import ./config { inherit (config) sops; };
}; };
}; };

View file

@ -41,7 +41,6 @@ in
"libvirtd" "libvirtd"
"wireshark" "wireshark"
"minecraft" "minecraft"
"syncthing"
]; ];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [