2015-06-07 04:10:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.zerotierone;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.services.zerotierone.enable = mkEnableOption "ZeroTierOne";
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.services.zerotierone = {
|
|
|
|
description = "ZeroTierOne";
|
|
|
|
path = [ pkgs.zerotierone ];
|
|
|
|
after = [ "network.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
preStart =
|
|
|
|
''
|
|
|
|
mkdir -p /var/lib/zerotier-one
|
|
|
|
chmod 700 /var/lib/zerotier-one
|
|
|
|
chown -R root:root /var/lib/zerotier-one
|
|
|
|
'';
|
|
|
|
serviceConfig = {
|
2016-02-19 22:56:19 +00:00
|
|
|
ExecStart = "${pkgs.zerotierone}/bin/zerotier-one";
|
|
|
|
Restart = "always";
|
|
|
|
KillMode = "process";
|
2015-06-07 04:10:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
environment.systemPackages = [ pkgs.zerotierone ];
|
|
|
|
};
|
|
|
|
}
|