add share syncthing folder

This commit is contained in:
Ingolf Wagner 2024-06-10 15:11:48 +02:00
parent 5b9761c903
commit f764b038bf
Signed by: palo
GPG key ID: 76BF5F1928B9618B
5 changed files with 50 additions and 48 deletions

View file

@ -1,7 +1,5 @@
{ config, lib, pkgs, factsGenerator, clanLib, ... }:
let
syncthingPub = clanLib.readFact "syncthing.pub";
zerotierIp = clanLib.readFact "zerotier-ip";
clanMachines =
lib.mapAttrs
(machine: facts: {
@ -18,28 +16,12 @@ with lib; {
clanCore.facts.services.syncthing = factsGenerator.syncthing { };
services.syncthing = {
#guiAddress = lib.mkDefault "${config.networking.hostName}.${config.clan.static-hosts.topLevelDomain}:8384";
#guiAddress = lib.mkDefault "[${zerotierIp config.networking.hostName}]:8384";
guiAddress = lib.mkDefault "${config.networking.hostName}.private:8384";
overrideDevices = lib.mkDefault true;
key = config.clanCore.facts.services.syncthing.secret."syncthing.key".path;
cert = config.clanCore.facts.services.syncthing.secret."syncthing.cert".path;
settings.devices =
let
zeroDevice = machine: {
"${machine}" = {
name = machine;
id = syncthingPub machine;
addresses = [ "tcp://[${zerotierIp machine}]:22000" ];
};
};
tincDevice = machine: {
"${machine}" = {
name = machine;
id = syncthingPub machine;
addresses = [ "tcp://${machine}.private:22000" ];
};
};
device = machine: id: {
"${machine}" = {
name = machine;
@ -49,10 +31,6 @@ with lib; {
};
in
clanMachines
#// (device "mobi" )
#// (device "bobi" )
// (device "iPhone" "APFS6SA-VVTARXU-3WHHRZG-TE5N3T4-X4IC76V-T67EKZ6-NLGP3TW-EZYXYAH")
// (device "iPad" "JDDNVYD-H3WMSSS-WZ745KL-7QEGN6O-ZSGQLQU-YBR2L42-7FO7KJ4-BXPYDA5")
// (device "bumba" "JS7PWTO-VKFGBUP-GNFLSWP-MGFJ2KH-HLO2LKW-V3RPCR6-PCB5SQC-42FCKQZ")
@ -119,6 +97,12 @@ with lib; {
params.keep = "10";
};
};
# to share big stuff public
share = {
enable = lib.mkDefault false;
path = lib.mkDefault "/tmp/password-store";
devices = [ "cream" "cherry" "orbi" ];
};
# todo remove if zfs is is used
#nextcloud_backup = {
# enable = lib.mkDefault false;

View file

@ -32,6 +32,7 @@ in
# bugwarrior (a bit fiddly)
imports = [{
options.bugwarrior.config = mkMagicMergeOption {
type = attrs;
default = { };
@ -58,11 +59,12 @@ in
];
}))
];
};
}];
config = mkIf config.gui.enable {
home.packages = with pkgs;
[
@ -93,5 +95,6 @@ in
];
};
}

View file

@ -37,6 +37,11 @@
enable = true;
path = "/home/palo/finance";
};
share = {
enable = true;
path = "/home/palo/share";
type = "sendonly";
};
# no need to be encrypted
# -----------------------

View file

@ -41,6 +41,11 @@
enable = true;
path = "/home/palo/finance";
};
share = {
enable = true;
path = "/home/palo/share";
type = "sendonly";
};
# no need to be encrypted
# -----------------------

View file

@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }: {
networking.firewall.allowedTCPPorts = [ 22000 ];
networking.firewall.allowedUDPPorts = [ 22000 ];
#networking.firewall.allowedTCPPorts = [ 22000 ];
#networking.firewall.allowedUDPPorts = [ 22000 ];
services.syncthing = {
enable = true;
@ -26,6 +26,11 @@
type = "receiveonly";
path = "/media/syncthing/flix";
};
share = {
enable = true;
type = "receiveonly";
path = "/media/syncthing/share";
};
};
};