nixos/zerotierone: simplify the unit

There is no need to stop/start the unit when the machine is online or
offline.

This should fix the shutdown locking issues.

nixos zerotier: sometimes it doesn't shutdown
This commit is contained in:
zimbatm 2019-05-20 14:06:12 +02:00
parent 71c19d3efa
commit b54c60b689
No known key found for this signature in database
GPG Key ID: 71BAF6D40C1D63D7

View File

@ -38,10 +38,13 @@ in
config = mkIf cfg.enable {
systemd.services.zerotierone = {
description = "ZeroTierOne";
path = [ cfg.package ];
bindsTo = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
wants = [ "network-online.target" ];
path = [ cfg.package ];
preStart = ''
mkdir -p /var/lib/zerotier-one/networks.d
chmod 700 /var/lib/zerotier-one
@ -53,6 +56,7 @@ in
ExecStart = "${cfg.package}/bin/zerotier-one -p${toString cfg.port}";
Restart = "always";
KillMode = "process";
TimeoutStopSec = 5;
};
};