Compare commits

..

No commits in common. "653ebd2c8504170680dad35512fc5885077ae6f5" and "ac3b43a952dc941b38b4a3ac17ad1efa5b98866d" have entirely different histories.

3 changed files with 51 additions and 61 deletions

View file

@ -29,17 +29,12 @@ in
|> lib.map (node: "\"${node.name}.${nebulaCfg.network.domain}. A ${node.address}\""); |> lib.map (node: "\"${node.name}.${nebulaCfg.network.domain}. A ${node.address}\"");
}; };
forward-zone = forward-zone = lib.singleton {
(lib.singleton {
name = "."; name = ".";
forward-addr = [ forward-addr = [
"1.1.1.1" "1.1.1.1"
"8.8.8.8" "8.8.8.8"
]; ];
})
++ lib.optional config.custom.services.tailscale.enable {
name = "${config.custom.services.tailscale.domain}";
forward-addr = [ "100.100.100.100" ];
}; };
}; };
}; };

View file

@ -51,8 +51,8 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
{ {
assertion = config.custom.services.nebula.node.enable; assertion = config.custom.services.tailscale.enable;
message = "Syncthing requires nebula"; message = "Syncthing requires tailscale";
} }
{ {
assertion = cfg.isServer -> (cfg.gui.domain != null); assertion = cfg.isServer -> (cfg.gui.domain != null);
@ -86,8 +86,7 @@ in
}; };
}; };
services = { services.syncthing = {
syncthing = {
enable = true; enable = true;
user = lib.mkIf (!cfg.isServer) "seb"; user = lib.mkIf (!cfg.isServer) "seb";
@ -106,11 +105,9 @@ in
|> lib.filterAttrs (name: _: name != config.networking.hostName) |> lib.filterAttrs (name: _: name != config.networking.hostName)
|> lib.filterAttrs (_: value: value.config.custom.services.syncthing.enable) |> lib.filterAttrs (_: value: value.config.custom.services.syncthing.enable)
|> lib.mapAttrs ( |> lib.mapAttrs (
_: value: { name: value: {
id = value.config.custom.services.syncthing.deviceId; id = value.config.custom.services.syncthing.deviceId;
addresses = [ addresses = [ "tcp://${name}.${config.custom.services.tailscale.domain}:${toString cfg.syncPort}" ];
"tcp://${value.config.custom.services.nebula.node.address}:${toString cfg.syncPort}"
];
} }
); );
@ -122,7 +119,7 @@ in
}); });
options = { options = {
listenAddress = "tcp://${config.custom.services.nebula.node.address}:${toString cfg.syncPort}"; listenAddress = "tcp://0.0.0.0:${toString cfg.syncPort}";
globalAnnounceEnabled = false; globalAnnounceEnabled = false;
localAnnounceEnabled = false; localAnnounceEnabled = false;
relaysEnabled = false; relaysEnabled = false;
@ -133,16 +130,6 @@ in
}; };
}; };
nebula.networks.mesh.firewall.inbound =
config.services.syncthing.settings.devices
|> lib.attrNames
|> lib.map (name: {
port = cfg.syncPort;
proto = "tcp";
host = name;
});
};
custom = { custom = {
services = { services = {
caddy.virtualHosts.${cfg.gui.domain}.port = lib.mkIf (cfg.gui.domain != null) cfg.gui.port; caddy.virtualHosts.${cfg.gui.domain}.port = lib.mkIf (cfg.gui.domain != null) cfg.gui.port;

View file

@ -35,5 +35,13 @@ in
systemd.services.tailscaled-set.after = [ "tailscaled-autoconnect.service" ]; systemd.services.tailscaled-set.after = [ "tailscaled-autoconnect.service" ];
custom.persistence.directories = [ "/var/lib/tailscale" ]; custom.persistence.directories = [ "/var/lib/tailscale" ];
# Disable search domain when nebula is in use
systemd.network.networks."50-tailscale" = lib.mkIf config.custom.services.nebula.node.enable {
matchConfig.Name = config.services.tailscale.interfaceName;
linkConfig.Unmanaged = lib.mkForce false;
dns = [ "100.100.100.100" ];
domains = [ ];
};
}; };
} }