add share syncthing folder

This commit is contained in:
Ingolf Wagner 2024-06-10 15:11:48 +02:00
parent 5b9761c903
commit f764b038bf
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
5 changed files with 50 additions and 48 deletions

View file

@ -1,7 +1,5 @@
{ config, lib, pkgs, factsGenerator, clanLib, ... }: { config, lib, pkgs, factsGenerator, clanLib, ... }:
let let
syncthingPub = clanLib.readFact "syncthing.pub";
zerotierIp = clanLib.readFact "zerotier-ip";
clanMachines = clanMachines =
lib.mapAttrs lib.mapAttrs
(machine: facts: { (machine: facts: {
@ -18,28 +16,12 @@ with lib; {
clanCore.facts.services.syncthing = factsGenerator.syncthing { }; clanCore.facts.services.syncthing = factsGenerator.syncthing { };
services.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"; guiAddress = lib.mkDefault "${config.networking.hostName}.private:8384";
overrideDevices = lib.mkDefault true; overrideDevices = lib.mkDefault true;
key = config.clanCore.facts.services.syncthing.secret."syncthing.key".path; key = config.clanCore.facts.services.syncthing.secret."syncthing.key".path;
cert = config.clanCore.facts.services.syncthing.secret."syncthing.cert".path; cert = config.clanCore.facts.services.syncthing.secret."syncthing.cert".path;
settings.devices = settings.devices =
let 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: { device = machine: id: {
"${machine}" = { "${machine}" = {
name = machine; name = machine;
@ -49,10 +31,6 @@ with lib; {
}; };
in in
clanMachines clanMachines
#// (device "mobi" )
#// (device "bobi" )
// (device "iPhone" "APFS6SA-VVTARXU-3WHHRZG-TE5N3T4-X4IC76V-T67EKZ6-NLGP3TW-EZYXYAH") // (device "iPhone" "APFS6SA-VVTARXU-3WHHRZG-TE5N3T4-X4IC76V-T67EKZ6-NLGP3TW-EZYXYAH")
// (device "iPad" "JDDNVYD-H3WMSSS-WZ745KL-7QEGN6O-ZSGQLQU-YBR2L42-7FO7KJ4-BXPYDA5") // (device "iPad" "JDDNVYD-H3WMSSS-WZ745KL-7QEGN6O-ZSGQLQU-YBR2L42-7FO7KJ4-BXPYDA5")
// (device "bumba" "JS7PWTO-VKFGBUP-GNFLSWP-MGFJ2KH-HLO2LKW-V3RPCR6-PCB5SQC-42FCKQZ") // (device "bumba" "JS7PWTO-VKFGBUP-GNFLSWP-MGFJ2KH-HLO2LKW-V3RPCR6-PCB5SQC-42FCKQZ")
@ -119,6 +97,12 @@ with lib; {
params.keep = "10"; 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 # todo remove if zfs is is used
#nextcloud_backup = { #nextcloud_backup = {
# enable = lib.mkDefault false; # enable = lib.mkDefault false;

View file

@ -32,6 +32,7 @@ in
# bugwarrior (a bit fiddly) # bugwarrior (a bit fiddly)
imports = [{ imports = [{
options.bugwarrior.config = mkMagicMergeOption { options.bugwarrior.config = mkMagicMergeOption {
type = attrs; type = attrs;
default = { }; default = { };
@ -58,40 +59,42 @@ in
]; ];
})) }))
]; ];
}; };
}]; }];
home.packages = with pkgs; config = mkIf config.gui.enable {
[
taskwarrior home.packages = with pkgs;
taskwarrior-tui [
timewarrior taskwarrior
tasksh taskwarrior-tui
taskwarrior-hooks
(pkgs.writeShellScriptBin "tsak" ''${pkgs.taskwarrior}/bin/task "$@"'')
vit timewarrior
(pkgs.writers.writeBashBin "active" "${taskwarrior-tui}/bin/taskwarrior-tui -r active") tasksh
(pkgs.writers.writeBashBin "todo" "${taskwarrior-tui}/bin/taskwarrior-tui -r todo") taskwarrior-hooks
(pkgs.writeShellScriptBin "tsak" ''${pkgs.taskwarrior}/bin/task "$@"'')
(pkgs.writers.writeBashBin "calendar" '' vit
${pkgs.taskwarrior}/bin/task calendar (pkgs.writers.writeBashBin "active" "${taskwarrior-tui}/bin/taskwarrior-tui -r active")
${pkgs.taskwarrior}/bin/task calendar_report (pkgs.writers.writeBashBin "todo" "${taskwarrior-tui}/bin/taskwarrior-tui -r todo")
'')
# todo : belongs to calendar.nix (pkgs.writers.writeBashBin "calendar" ''
vdirsyncer ${pkgs.taskwarrior}/bin/task calendar
khal ${pkgs.taskwarrior}/bin/task calendar_report
(pkgs.writers.writeBashBin "kalendar" '' '')
${pkgs.vdirsyncer}/bin/vdirsyncer sync
${pkgs.khal}/bin/ikhal
'')
]; # todo : belongs to calendar.nix
vdirsyncer
khal
(pkgs.writers.writeBashBin "kalendar" ''
${pkgs.vdirsyncer}/bin/vdirsyncer sync
${pkgs.khal}/bin/ikhal
'')
];
};
} }

View file

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

View file

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

View file

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