mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 18:59:07 +01:00
syncthing: Add phone in a hacky way
This commit is contained in:
parent
ed070e6abe
commit
fa2bef14f4
2 changed files with 39 additions and 28 deletions
|
|
@ -85,37 +85,40 @@ in
|
||||||
cert = lib.mkIf useSopsSecrets config.sops.secrets."syncthing/cert".path;
|
cert = lib.mkIf useSopsSecrets config.sops.secrets."syncthing/cert".path;
|
||||||
key = lib.mkIf useSopsSecrets config.sops.secrets."syncthing/key".path;
|
key = lib.mkIf useSopsSecrets config.sops.secrets."syncthing/key".path;
|
||||||
|
|
||||||
settings = {
|
settings =
|
||||||
devices =
|
let
|
||||||
self.nixosConfigurations
|
hosts =
|
||||||
|> lib.filterAttrs (_: host: host.config.networking.hostName != config.networking.hostName)
|
self.nixosConfigurations
|
||||||
|> lib.filterAttrs (_: host: host.config.custom.services.syncthing.enable)
|
|> lib.filterAttrs (_: host: host.config.networking.hostName != config.networking.hostName)
|
||||||
|> lib.mapAttrs (
|
|> lib.filterAttrs (_: host: host.config.custom.services.syncthing.enable);
|
||||||
_: host: {
|
in
|
||||||
id = host.config.custom.services.syncthing.deviceId;
|
{
|
||||||
addresses = [
|
devices =
|
||||||
"tcp://${host.config.custom.networking.overlay.address}:${toString host.config.custom.services.syncthing.syncPort}"
|
hosts
|
||||||
];
|
|> lib.mapAttrs (
|
||||||
}
|
_: host: {
|
||||||
);
|
id = host.config.custom.services.syncthing.deviceId;
|
||||||
|
addresses = lib.singleton "tcp://${host.config.custom.networking.overlay.address}:${toString host.config.custom.services.syncthing.syncPort}";
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
folders =
|
folders =
|
||||||
cfg.folders
|
cfg.folders
|
||||||
|> self.lib.genAttrs (name: {
|
|> self.lib.genAttrs (name: {
|
||||||
path = "${dataDir}/${name}";
|
path = "${dataDir}/${name}";
|
||||||
devices = config.services.syncthing.settings.devices |> lib.attrNames;
|
devices = hosts |> lib.attrNames;
|
||||||
});
|
});
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
listenAddress = "tcp://${netCfg.overlay.address}:${toString cfg.syncPort}";
|
listenAddress = "tcp://${netCfg.overlay.address}:${toString cfg.syncPort}";
|
||||||
globalAnnounceEnabled = false;
|
globalAnnounceEnabled = false;
|
||||||
localAnnounceEnabled = false;
|
localAnnounceEnabled = false;
|
||||||
relaysEnabled = false;
|
relaysEnabled = false;
|
||||||
natEnabled = false;
|
natEnabled = false;
|
||||||
urAccepted = -1;
|
urAccepted = -1;
|
||||||
autoUpgradeIntervalH = 0;
|
autoUpgradeIntervalH = 0;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nebula.networks.mesh.firewall.inbound = lib.singleton {
|
nebula.networks.mesh.firewall.inbound = lib.singleton {
|
||||||
|
|
|
||||||
|
|
@ -112,4 +112,12 @@
|
||||||
sshd.enable = true;
|
sshd.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.syncthing.settings = {
|
||||||
|
devices."fairphone" = {
|
||||||
|
id = "6ROH65D-E65I5F6-URI4OUZ-RCHFC3B-PMBSIHH-5DNLJPS-SYSUWQY-HKYGHQG";
|
||||||
|
addresses = "tcp://10.254.250.74:22000";
|
||||||
|
};
|
||||||
|
folders."Documents".devices = [ config.services.syncthing.settings.devices."fairphone".name ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue