syncthing refactor

This commit is contained in:
Lilith 2026-01-15 14:45:26 +01:00
parent c9cb613280
commit 155dfacc13
No known key found for this signature in database
GPG key ID: 272C807BD91F8446
4 changed files with 61 additions and 50 deletions

View file

@ -17,6 +17,11 @@ in
}; };
}; };
syncthing = {
enable = true;
dataDir = "/data/sync";
};
hardware.nvidia = { hardware.nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.stable; package = config.boot.kernelPackages.nvidiaPackages.stable;
nvidiaSettings = true; nvidiaSettings = true;

View file

@ -7,6 +7,7 @@ in
audio.enable = true; audio.enable = true;
desktop.enable = true; desktop.enable = true;
syncthing.enable = true;
home-manager.users."lilith".desktop.touchSupport = true; home-manager.users."lilith".desktop.touchSupport = true;
nfs.client.enable = true; nfs.client.enable = true;

View file

@ -8,6 +8,7 @@ in
audio.enable = true; audio.enable = true;
desktop.enable = true; desktop.enable = true;
gaming.enable = true; gaming.enable = true;
syncthing.enable = true;
nfs.client.enable = true; nfs.client.enable = true;
auto_styling.enable = true; auto_styling.enable = true;
# ollama.enable = true; # ollama.enable = true;

View file

@ -1,64 +1,68 @@
{ config, ... }: { config, lib, ... }:
let let
host = config.networking.hostName; host = config.networking.hostName;
in in
{ {
options.syncthing.enable = lib.mkEnableOption "Enables Syncthing";
options.syncthing.dataDir = lib.mkOption { default = "/home/lilith"; };
sops.secrets."syncthing/key.pem" = { config = lib.mkIf config.syncthing.enable {
sopsFile = ../../hosts/${host}/secrets/default.yaml; sops.secrets."syncthing/key.pem" = {
}; sopsFile = ../../hosts/${host}/secrets/default.yaml;
sops.secrets."syncthing/cert.pem" = { };
sopsFile = ../../hosts/${host}/secrets/default.yaml; sops.secrets."syncthing/cert.pem" = {
}; sopsFile = ../../hosts/${host}/secrets/default.yaml;
};
services.syncthing = { services.syncthing = {
enable = true; enable = true;
user = "lilith"; user = "lilith";
dataDir = "/home/lilith"; dataDir = config.syncthing.dataDir;
configDir = "/home/lilith/.config/syncthing"; configDir = "/home/lilith/.config/syncthing";
overrideDevices = true; overrideDevices = true;
overrideFolders = true; overrideFolders = true;
key = config.sops.secrets."syncthing/key.pem".path; key = config.sops.secrets."syncthing/key.pem".path;
cert = config.sops.secrets."syncthing/cert.pem".path; cert = config.sops.secrets."syncthing/cert.pem".path;
settings = { settings = {
devices = { devices = {
"lilith-phone" = { "lilith-phone" = {
id = "N3VHPZJ-DARZYPM-TIBLRAZ-KN6QWYJ-VU6FP2N-INYVJZ3-ZSUD63P-NSXLIQ6"; id = "N3VHPZJ-DARZYPM-TIBLRAZ-KN6QWYJ-VU6FP2N-INYVJZ3-ZSUD63P-NSXLIQ6";
};
"lilith-lab" = {
id = "DW6GTZ3-3JPAHLO-UEB3LBL-AWOX3BT-QPI7ODT-OZ6Q4YR-K3KK22C-5RY3XQZ";
};
"lilith-pc" = {
id = "ZXFUFLA-MJJCNE4-SJTGTYD-SEJZUCX-3KIFTL6-LFIWBBU-HD2LX2F-7FQ5VAF";
};
"lilith-pad" = {
id = "GQJA6WA-G5YZZSN-4OOQMVE-JPIR22N-VFHPY4O-XMRG37D-DALH4R2-7DCTMQK";
};
}; };
"lilith-lab" = { folders = {
id = "DW6GTZ3-3JPAHLO-UEB3LBL-AWOX3BT-QPI7ODT-OZ6Q4YR-K3KK22C-5RY3XQZ"; "sync" = {
}; id = "rdcj2-mfyb4";
"lilith-pc" = { path = "${config.syncthing.dataDir}/sync";
id = "ZXFUFLA-MJJCNE4-SJTGTYD-SEJZUCX-3KIFTL6-LFIWBBU-HD2LX2F-7FQ5VAF"; devices = [
}; "lilith-phone"
"lilith-pad" = { "lilith-lab"
id = "GQJA6WA-G5YZZSN-4OOQMVE-JPIR22N-VFHPY4O-XMRG37D-DALH4R2-7DCTMQK"; "lilith-pad"
}; "lilith-pc"
}; ];
folders = { };
"sync" = { "keepass" = {
id = "rdcj2-mfyb4"; id = "sdpfs-2beqd";
path = "/home/lilith/sync"; path = "${config.syncthing.dataDir}/.keepass";
devices = [ devices = [
"lilith-phone" "lilith-phone"
"lilith-lab" "lilith-lab"
"lilith-pad" "lilith-pad"
"lilith-pc" "lilith-pc"
]; ];
}; };
"keepass" = {
id = "sdpfs-2beqd";
path = "/home/lilith/.keepass";
devices = [
"lilith-phone"
"lilith-lab"
"lilith-pad"
"lilith-pc"
];
}; };
}; };
}; };