aboutsummaryrefslogtreecommitdiff
path: root/nixos
diff options
context:
space:
mode:
Diffstat (limited to 'nixos')
-rw-r--r--nixos/configurations/errol.nix8
-rw-r--r--nixos/configurations/lipwig.nix23
-rw-r--r--nixos/configurations/ridcully.nix8
-rw-r--r--nixos/modules/syncthing.nix161
4 files changed, 76 insertions, 124 deletions
diff --git a/nixos/configurations/errol.nix b/nixos/configurations/errol.nix
index 0ece262..f986631 100644
--- a/nixos/configurations/errol.nix
+++ b/nixos/configurations/errol.nix
@@ -94,15 +94,7 @@ in {
services = {
syncthing = {
enable = true;
- user = mkDefault "cynerd";
- group = mkDefault "cynerd";
- openDefaultPorts = true;
-
- overrideDevices = false;
- overrideFolders = false;
-
dataDir = "/home/cynerd";
- configDir = "/home/cynerd/.config/syncthing";
};
home-assistant = {
diff --git a/nixos/configurations/lipwig.nix b/nixos/configurations/lipwig.nix
index c70bedd..4dc51c7 100644
--- a/nixos/configurations/lipwig.nix
+++ b/nixos/configurations/lipwig.nix
@@ -20,10 +20,6 @@
hw = false;
drives = false;
};
- syncthing = {
- enable = false;
- baseDir = "/nas";
- };
wireguard = true;
borgjobs = {
postgresql.dumpCommand = pkgs.writeScript "postgreqsl-backup.sh" ''
@@ -236,7 +232,6 @@
previewgenerator
spreed
tasks
- #twofactor_nextcloud_notification
twofactor_webauthn
;
# Additional modules can be fetched with:
@@ -252,13 +247,13 @@
license = "agpl3Plus";
};
money = pkgs.fetchNextcloudApp {
- url = "https://github.com/powerpaul17/nc_money/releases/download/v0.29.0/money.tar.gz";
- hash = "sha256-EXcY69z5h6rT0RdkmOhQYKSWmVBr2zaWuSRj/m5dMkI=";
+ url = "https://github.com/powerpaul17/nc_money/releases/download/v0.29.1/money.tar.gz";
+ hash = "sha256-6ZCVcJRmE2gNsp+Tg7Jcddwv6yqmNFATFHn9x6UJL7c=";
license = "agpl3Plus";
};
passwords = pkgs.fetchNextcloudApp {
- url = "https://git.mdns.eu/api/v4/projects/45/packages/generic/passwords/2024.12.1/passwords.tar.gz";
- hash = "sha256-I0+w8H56Lam9CChAPrGbA6VvEmkNi3FhmBuOUgvlTaE=";
+ url = "https://git.mdns.eu/api/v4/projects/45/packages/generic/passwords/2025.2.0/passwords.tar.gz";
+ hash = "sha256-Nu6WViFawQWby9CEEezAwoBNdp7O5O8a9IhDp/me/E0=";
license = "agpl3Plus";
};
};
@@ -354,16 +349,12 @@
};
users.groups.searx.members = ["nginx"];
- # Old Syncthing ############################################################
+ # Syncthing ################################################################
services.syncthing = {
enable = true;
- openDefaultPorts = true;
-
- overrideDevices = false;
- overrideFolders = false;
-
+ user = "syncthing";
+ group = "syncthing";
dataDir = "/nas/sync";
- configDir = "/nas/sync/.syncthing";
};
};
}
diff --git a/nixos/configurations/ridcully.nix b/nixos/configurations/ridcully.nix
index 310b5b0..0b2705c 100644
--- a/nixos/configurations/ridcully.nix
+++ b/nixos/configurations/ridcully.nix
@@ -75,15 +75,7 @@ in {
services.syncthing = {
enable = true;
- user = mkDefault "cynerd";
- group = mkDefault "cynerd";
- openDefaultPorts = true;
-
- overrideDevices = false;
- overrideFolders = false;
-
dataDir = "/home/cynerd";
- configDir = "/home/cynerd/.config/syncthing";
};
# Force nix to use less jobs
diff --git a/nixos/modules/syncthing.nix b/nixos/modules/syncthing.nix
index 91736ca..1148da6 100644
--- a/nixos/modules/syncthing.nix
+++ b/nixos/modules/syncthing.nix
@@ -3,119 +3,96 @@
lib,
...
}: let
- inherit (lib) filterAttrs mkOption types mkIf any mkDefault recursiveUpdate genAttrs;
- cnf = config.cynerd.syncthing;
- inherit (config.networking) hostName;
+ inherit (lib) elem filterAttrs mkIf any mkDefault recursiveUpdate genAttrs;
+
allDevices = [
- "albert"
"binky"
"errol"
"lipwig"
"ridcully"
- "spt-omnia"
- ];
- mediaDevices = [
- "lipwig"
- "binky"
- "errol"
- "ridcully"
- "spt-omnia"
];
bigStorageDevices = [
"errol"
"ridcully"
- "spt-omnia"
];
+
+ inherit (config.networking) hostName;
+ baseDir = config.services.syncthing.dataDir;
filterDevice = filterAttrs (_: v: any (d: d == hostName) v.devices);
in {
- options = {
- cynerd.syncthing = {
- enable = mkOption {
- type = types.bool;
- default = false;
- description = "My personal Syncthing configuration";
- };
-
- baseDir = mkOption {
- type = types.str;
- default = "/home/cynerd";
- description = "Base directory for all folders being synced.";
- };
- };
- };
-
- config = mkIf cnf.enable {
+ config = mkIf (config.services.syncthing.enable && elem hostName allDevices) {
services.syncthing = {
- enable = any (n: n == hostName) allDevices;
user = mkDefault "cynerd";
+ group = mkDefault "cynerd";
+
key = "/run/secrets/syncthing.key.pem";
cert = "/run/secrets/syncthing.cert.pem";
openDefaultPorts = true;
-
overrideFolders = true;
- folders = filterDevice {
- "${cnf.baseDir}/documents" = {
- label = "Documents";
- id = "documents";
- devices = allDevices;
- ignorePerms = false;
- };
- "${cnf.baseDir}/notes" = {
- label = "Notes";
- id = "notes";
- devices = allDevices;
- ignorePerms = false;
- };
- "${cnf.baseDir}/projects" = {
- label = "Projects";
- id = "projects";
- devices = allDevices;
- ignorePerms = false;
- };
- "${cnf.baseDir}/pictures" = {
- label = "Pictures";
- id = "pictures";
- devices = mediaDevices;
- ignorePerms = false;
- };
- # TODO phone-photos
- "${cnf.baseDir}/music/primary" = {
- label = "Music-primary";
- id = "music-primary";
- devices = mediaDevices;
- ignorePerms = false;
- };
- "${cnf.baseDir}/music/secondary" = {
- label = "Music-secondary";
- id = "music-secondary";
- devices = bigStorageDevices;
- ignorePerms = false;
- };
- "${cnf.baseDir}/music/flac" = {
- label = "Music-flac";
- id = "music-flac";
- devices = bigStorageDevices;
- ignorePerms = false;
- };
- "${cnf.baseDir}/video" = {
- label = "Video";
- id = "video";
- devices = bigStorageDevices;
- ignorePerms = false;
- };
- };
-
overrideDevices = true;
- devices =
- recursiveUpdate
- (genAttrs allDevices (name: {
- id = config.secrets.syncthingIDs."${name}";
- }))
- {
- lipwig.addresses = ["tcp://cynerd.cz"];
+
+ settings = {
+ folders = filterDevice {
+ "${baseDir}/documents" = {
+ label = "Documents";
+ id = "documents";
+ devices = allDevices;
+ ignorePerms = false;
+ };
+ "${baseDir}/notes" = {
+ label = "Notes";
+ id = "notes";
+ devices = allDevices;
+ ignorePerms = false;
+ };
+ "${baseDir}/projects" = {
+ label = "Projects";
+ id = "projects";
+ devices = allDevices;
+ ignorePerms = false;
+ };
+ "${baseDir}/elektroline" = {
+ label = "Elektroline";
+ id = "elektroline";
+ devices = allDevices;
+ ignorePerms = false;
+ };
+ "${baseDir}/pictures" = {
+ label = "Pictures";
+ id = "pictures";
+ devices = bigStorageDevices;
+ ignorePerms = false;
+ };
+ "${baseDir}/music" = {
+ label = "Music";
+ id = "music";
+ devices = bigStorageDevices;
+ ignorePerms = false;
+ };
+ "${baseDir}/video" = {
+ label = "Video";
+ id = "video";
+ devices = bigStorageDevices;
+ ignorePerms = false;
+ };
+ "${baseDir}/turris" = {
+ label = "Turris";
+ id = "turris";
+ devices = bigStorageDevices;
+ ignorePerms = false;
+ };
};
- # TODO phone
+
+ devices =
+ recursiveUpdate
+ (genAttrs allDevices (name: {
+ id = config.secrets.syncthingIDs."${name}";
+ }))
+ {
+ lipwig.addresses = ["tcp://cynerd.cz"];
+ };
+ };
};
};
}