mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 14:01:34 +01:00
Add custom isTailscaleDomain lib
This commit is contained in:
parent
589b76d745
commit
f3ea2b75e6
6 changed files with 15 additions and 11 deletions
|
|
@ -6,7 +6,6 @@
|
|||
}:
|
||||
let
|
||||
cfg = config.custom.services.syncthing;
|
||||
tailscaleCfg = config.custom.services.tailscale;
|
||||
|
||||
inherit (config.services.syncthing) dataDir;
|
||||
|
||||
|
|
@ -40,7 +39,7 @@ in
|
|||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = tailscaleCfg.enable;
|
||||
assertion = config.custom.services.tailscale.enable;
|
||||
message = "Syncthing requires tailscale.";
|
||||
}
|
||||
{
|
||||
|
|
@ -52,7 +51,7 @@ in
|
|||
message = "Running syncthing on a server requires `gui.domain` to be set.";
|
||||
}
|
||||
{
|
||||
assertion = (cfg.gui.domain != null) -> (cfg.gui.domain |> lib.hasSuffix tailscaleCfg.domain);
|
||||
assertion = (cfg.gui.domain != null) -> (lib.custom.isTailscaleDomain cfg.gui.domain);
|
||||
message = "The syncthing gui should only be exposed on a private network as it isn't yet configured with access controll.";
|
||||
}
|
||||
];
|
||||
|
|
@ -100,7 +99,7 @@ in
|
|||
|> lib.mapAttrs (
|
||||
name: value: {
|
||||
id = value.config.custom.services.syncthing.deviceId;
|
||||
addresses = [ "tcp://${name}.${tailscaleCfg.domain}:${toString cfg.syncPort}" ];
|
||||
addresses = [ "tcp://${name}.${config.custom.services.tailscale.domain}:${toString cfg.syncPort}" ];
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue