nixos/cloudflared: systemd dependency fix

- also wait for network-online.target:
  fixes startup error on reboot without functioning networking
- restart on-failure (upstream service definition)
This commit is contained in:
0x4A6F 2022-12-30 17:48:49 +01:00 committed by Bjørn Forsman
parent d62198f2d4
commit 7e159b1a67

View file

@ -302,13 +302,14 @@ in
mkConfigFile = pkgs.writeText "cloudflared.yml" (builtins.toJSON fullConfig);
in
nameValuePair "cloudflared-tunnel-${name}" ({
after = [ "network.target" ];
after = [ "network.target" "network-online.target" ];
wants = [ "network.target" "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = cfg.user;
Group = cfg.group;
ExecStart = "${cfg.package}/bin/cloudflared tunnel --config=${mkConfigFile} --no-autoupdate run";
Restart = "always";
Restart = "on-failure";
};
})
)