modularized syncthing
This commit is contained in:
parent
272bcb75f4
commit
a3ab33a34a
8 changed files with 53 additions and 176 deletions
|
@ -14,11 +14,19 @@
|
||||||
./minecraft.nix
|
./minecraft.nix
|
||||||
./nfs.nix
|
./nfs.nix
|
||||||
./radicale.nix
|
./radicale.nix
|
||||||
./syncthing.nix
|
|
||||||
|
|
||||||
../../modules/common
|
../../modules/common
|
||||||
../../modules/server
|
../../modules/server
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
common.syncthing = {
|
||||||
|
enable = true;
|
||||||
|
devices = {
|
||||||
|
Lenni = { id = "XS6NR2Q-DHVB5G4-P43CHWR-TVBIY5A-FCIS7CU-S5UVNZA-5YPJYST-2EO2GAG"; };
|
||||||
|
Puenktchen = { id = "VP3YVIM-JNSZTXV-7AS7FA2-3W5QKH6-XOWXX7N-STUR4JR-PR6SPCV-HJZMAAN"; };
|
||||||
|
Damin = { id = "HAGKFGG-EMCPKHG-Y7V2ACJ-DJVAIIA-A6TNGTQ-VWPB3F5-PES673W-W2YBJAD"; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
services.syncthing = {
|
|
||||||
enable = true;
|
|
||||||
dataDir = "/mnt/data/services/syncthing/data";
|
|
||||||
configDir = "/mnt/data/services/syncthing/config";
|
|
||||||
overrideDevices = true;
|
|
||||||
overrideFolders = true;
|
|
||||||
openDefaultPorts = true;
|
|
||||||
guiAddress = "0.0.0.0:8384";
|
|
||||||
settings = {
|
|
||||||
gui = {
|
|
||||||
user = "willifan";
|
|
||||||
password = "temppassword";
|
|
||||||
};
|
|
||||||
devices = {
|
|
||||||
Lenni = { id = "XS6NR2Q-DHVB5G4-P43CHWR-TVBIY5A-FCIS7CU-S5UVNZA-5YPJYST-2EO2GAG"; };
|
|
||||||
Puenktchen = { id = "VP3YVIM-JNSZTXV-7AS7FA2-3W5QKH6-XOWXX7N-STUR4JR-PR6SPCV-HJZMAAN"; };
|
|
||||||
Damin = { id = "HAGKFGG-EMCPKHG-Y7V2ACJ-DJVAIIA-A6TNGTQ-VWPB3F5-PES673W-W2YBJAD"; };
|
|
||||||
};
|
|
||||||
folders = {
|
|
||||||
"Documents" = {
|
|
||||||
id = "jtl6g-qjmwo";
|
|
||||||
path = "/mnt/data/services/syncthing/data/Documents";
|
|
||||||
devices = [ "Lenni" "Puenktchen" ];
|
|
||||||
};
|
|
||||||
"Enpass" = {
|
|
||||||
id = "ciksm-xsw4m";
|
|
||||||
path = "/mnt/data/services/syncthing/data/Enpass";
|
|
||||||
devices = [ "Lenni" "Puenktchen" "Damin" ];
|
|
||||||
};
|
|
||||||
"Pictures" = {
|
|
||||||
id = "po4qj-q9t0t";
|
|
||||||
path = "/mnt/data/services/syncthing/data/Pictures";
|
|
||||||
devices = [ "Lenni" "Puenktchen" ];
|
|
||||||
};
|
|
||||||
"Videos" = {
|
|
||||||
id = "4wqf5-xasng";
|
|
||||||
path = "/mnt/data/services/syncthing/data/Videos";
|
|
||||||
devices = [ "Lenni" "Puenktchen" ];
|
|
||||||
};
|
|
||||||
"Notes" = {
|
|
||||||
id = "oc61n-iewgj";
|
|
||||||
path = "/mnt/data/services/syncthing/data/Notes";
|
|
||||||
devices = [ "Lenni" "Puenktchen" ];
|
|
||||||
};
|
|
||||||
"Music" = {
|
|
||||||
id = "xxh8a-3y2tq";
|
|
||||||
path = "/mnt/data/services/syncthing/data/Music";
|
|
||||||
devices = [ "Lenni" "Puenktchen" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -3,9 +3,16 @@
|
||||||
imports = [
|
imports = [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
#./disko.nix
|
#./disko.nix
|
||||||
./syncthing.nix
|
|
||||||
|
|
||||||
../../modules/common
|
../../modules/common
|
||||||
../../modules/desktop
|
../../modules/desktop
|
||||||
];
|
];
|
||||||
|
|
||||||
|
common.syncthing = {
|
||||||
|
enable = true;
|
||||||
|
devices = {
|
||||||
|
Anton = { id = "WCDBADD-UPKCACI-X2YJOIO-5QC44PL-DBCR6TS-ADVQV33-HSMF32O-FOKMKAU"; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
services.syncthing = {
|
|
||||||
enable = true;
|
|
||||||
user = "willifan";
|
|
||||||
dataDir = "/mnt/data";
|
|
||||||
configDir = "/mnt/data/.config/syncthing";
|
|
||||||
overrideDevices = true;
|
|
||||||
overrideFolders = true;
|
|
||||||
settings = {
|
|
||||||
gui = {
|
|
||||||
user = "willifan";
|
|
||||||
password = "temppassword";
|
|
||||||
};
|
|
||||||
devices = {
|
|
||||||
Anton = { id = "WCDBADD-UPKCACI-X2YJOIO-5QC44PL-DBCR6TS-ADVQV33-HSMF32O-FOKMKAU"; };
|
|
||||||
};
|
|
||||||
folders = {
|
|
||||||
"Documents" = {
|
|
||||||
id = "jtl6g-qjmwo";
|
|
||||||
path = "/mnt/data/Documents";
|
|
||||||
devices = [ "Anton" ];
|
|
||||||
};
|
|
||||||
"Enpass" = {
|
|
||||||
id = "ciksm-xsw4m";
|
|
||||||
path = "/mnt/data/Enpass";
|
|
||||||
devices = [ "Anton" ];
|
|
||||||
};
|
|
||||||
"Pictures" = {
|
|
||||||
id = "po4qj-q9t0t";
|
|
||||||
path = "/mnt/data/Pictures";
|
|
||||||
devices = [ "Anton" ];
|
|
||||||
};
|
|
||||||
"Videos" = {
|
|
||||||
id = "4wqf5-xasng";
|
|
||||||
path = "/mnt/data/Videos";
|
|
||||||
devices = [ "Anton" ];
|
|
||||||
};
|
|
||||||
"Notes" = {
|
|
||||||
id = "oc61n-iewgj";
|
|
||||||
path = "/mnt/data/Notes";
|
|
||||||
devices = [ "Anton" ];
|
|
||||||
};
|
|
||||||
"Music" = {
|
|
||||||
id = "xxh8a-3y2tq";
|
|
||||||
path = "/mnt/data/Music";
|
|
||||||
devices = [ "Anton" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -9,4 +9,11 @@
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
common.syncthing = {
|
||||||
|
enable = true;
|
||||||
|
devices = {
|
||||||
|
Anton = { id = "WCDBADD-UPKCACI-X2YJOIO-5QC44PL-DBCR6TS-ADVQV33-HSMF32O-FOKMKAU"; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
services.syncthing = {
|
|
||||||
enable = true;
|
|
||||||
user = "willifan";
|
|
||||||
dataDir = "/mnt/data";
|
|
||||||
configDir = "/mnt/data/.config/syncthing";
|
|
||||||
overrideDevices = true;
|
|
||||||
overrideFolders = true;
|
|
||||||
settings = {
|
|
||||||
gui = {
|
|
||||||
user = "willifan";
|
|
||||||
password = "temppassword";
|
|
||||||
};
|
|
||||||
devices = {
|
|
||||||
Anton = { id = "WCDBADD-UPKCACI-X2YJOIO-5QC44PL-DBCR6TS-ADVQV33-HSMF32O-FOKMKAU"; };
|
|
||||||
};
|
|
||||||
folders = {
|
|
||||||
"Documents" = {
|
|
||||||
id = "jtl6g-qjmwo";
|
|
||||||
path = "/mnt/data/Documents";
|
|
||||||
devices = [ "Anton" ];
|
|
||||||
};
|
|
||||||
"Enpass" = {
|
|
||||||
id = "ciksm-xsw4m";
|
|
||||||
path = "/mnt/data/Enpass";
|
|
||||||
devices = [ "Anton" ];
|
|
||||||
};
|
|
||||||
"Pictures" = {
|
|
||||||
id = "po4qj-q9t0t";
|
|
||||||
path = "/mnt/data/Pictures";
|
|
||||||
devices = [ "Anton" ];
|
|
||||||
};
|
|
||||||
"Videos" = {
|
|
||||||
id = "4wqf5-xasng";
|
|
||||||
path = "/mnt/data/Videos";
|
|
||||||
devices = [ "Anton" ];
|
|
||||||
};
|
|
||||||
"Notes" = {
|
|
||||||
id = "oc61n-iewgj";
|
|
||||||
path = "/mnt/data/Notes";
|
|
||||||
devices = [ "Anton" ];
|
|
||||||
};
|
|
||||||
"Music" = {
|
|
||||||
id = "xxh8a-3y2tq";
|
|
||||||
path = "/mnt/data/Music";
|
|
||||||
devices = [ "Anton" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -7,6 +7,7 @@
|
||||||
./mimetype.nix
|
./mimetype.nix
|
||||||
./optimise.nix
|
./optimise.nix
|
||||||
./sops.nix
|
./sops.nix
|
||||||
|
./syncthing.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
|
|
|
@ -1,12 +1,27 @@
|
||||||
{ lib, config, ... }:
|
{ lib, types, config, ... }:
|
||||||
|
let
|
||||||
|
deviceList = builtins.attrNames config.common.syncthing.devices;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
options.common.syncthing = {
|
|
||||||
enable = lib.mkEnableOption;
|
options = {
|
||||||
|
common.syncthing = {
|
||||||
|
|
||||||
|
enable = lib.mkEnableOption "enable syncthing";
|
||||||
|
|
||||||
|
devices = lib.mkOption {
|
||||||
|
type = lib.types.attrsOf (lib.types.submodule {
|
||||||
|
|
||||||
|
options.id = lib.mkOption { type = lib.types.str; };
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
#devices.*.id;
|
|
||||||
|
|
||||||
config.services.syncthing = lib.mkIf config.common.syncthing.enable {
|
config.services.syncthing = lib.mkIf config.common.syncthing.enable {
|
||||||
enable = lib.mkDefault false;
|
enable = lib.mkDefault true;
|
||||||
user = lib.mkDefault "willifan";
|
user = lib.mkDefault "willifan";
|
||||||
dataDir = lib.mkDefault "/mnt/data";
|
dataDir = lib.mkDefault "/mnt/data";
|
||||||
configDir = lib.mkDefault "/mnt/data/.config/syncthing";
|
configDir = lib.mkDefault "/mnt/data/.config/syncthing";
|
||||||
|
@ -17,39 +32,37 @@
|
||||||
user = lib.mkDefault "willifan";
|
user = lib.mkDefault "willifan";
|
||||||
password = lib.mkDefault "temppassword";
|
password = lib.mkDefault "temppassword";
|
||||||
};
|
};
|
||||||
devices = {
|
devices = config.common.syncthing.devices;
|
||||||
Anton = { id = "WCDBADD-UPKCACI-X2YJOIO-5QC44PL-DBCR6TS-ADVQV33-HSMF32O-FOKMKAU"; };
|
|
||||||
};
|
|
||||||
folders = lib.mkDefault {
|
folders = lib.mkDefault {
|
||||||
"Documents" = {
|
"Documents" = {
|
||||||
id = "jtl6g-qjmwo";
|
id = "jtl6g-qjmwo";
|
||||||
path = "/mnt/data/Documents";
|
path = "/mnt/data/Documents";
|
||||||
devices = [ ];
|
devices = deviceList;
|
||||||
};
|
};
|
||||||
"Enpass" = lib.mkDefault {
|
"Enpass" = lib.mkDefault {
|
||||||
id = "ciksm-xsw4m";
|
id = "ciksm-xsw4m";
|
||||||
path = "/mnt/data/Enpass";
|
path = "/mnt/data/Enpass";
|
||||||
devices = [ ];
|
devices = deviceList;
|
||||||
};
|
};
|
||||||
"Pictures" = lib.mkDefault {
|
"Pictures" = lib.mkDefault {
|
||||||
id = "po4qj-q9t0t";
|
id = "po4qj-q9t0t";
|
||||||
path = "/mnt/data/Pictures";
|
path = "/mnt/data/Pictures";
|
||||||
devices = [ ];
|
devices = deviceList;
|
||||||
};
|
};
|
||||||
"Videos" = lib.mkDefault {
|
"Videos" = lib.mkDefault {
|
||||||
id = "4wqf5-xasng";
|
id = "4wqf5-xasng";
|
||||||
path = "/mnt/data/Videos";
|
path = "/mnt/data/Videos";
|
||||||
devices = [ ];
|
devices = deviceList;
|
||||||
};
|
};
|
||||||
"Notes" = lib.mkDefault {
|
"Notes" = lib.mkDefault {
|
||||||
id = "oc61n-iewgj";
|
id = "oc61n-iewgj";
|
||||||
path = "/mnt/data/Notes";
|
path = "/mnt/data/Notes";
|
||||||
devices = [ ];
|
devices = deviceList;
|
||||||
};
|
};
|
||||||
"Music" = lib.mkDefault {
|
"Music" = lib.mkDefault {
|
||||||
id = "xxh8a-3y2tq";
|
id = "xxh8a-3y2tq";
|
||||||
path = "/mnt/data/Music";
|
path = "/mnt/data/Music";
|
||||||
devices = [ ];
|
devices = deviceList;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue