zerotierone: make package configurable
This commit is contained in:
parent
7069047f2e
commit
caa1350e07
1 changed files with 12 additions and 4 deletions
|
@ -7,11 +7,19 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.zerotierone.enable = mkEnableOption "ZeroTierOne";
|
options.services.zerotierone.enable = mkEnableOption "ZeroTierOne";
|
||||||
|
options.services.zerotierone.package = mkOption {
|
||||||
|
default = pkgs.zerotierone;
|
||||||
|
defaultText = "pkgs.zerotierone";
|
||||||
|
type = types.package;
|
||||||
|
description = ''
|
||||||
|
ZeroTier One package to use.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
systemd.services.zerotierone = {
|
systemd.services.zerotierone = {
|
||||||
description = "ZeroTierOne";
|
description = "ZeroTierOne";
|
||||||
path = [ pkgs.zerotierone ];
|
path = [ cfg.package ];
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
preStart =
|
preStart =
|
||||||
|
@ -21,7 +29,7 @@ in
|
||||||
chown -R root:root /var/lib/zerotier-one
|
chown -R root:root /var/lib/zerotier-one
|
||||||
'';
|
'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${pkgs.zerotierone}/bin/zerotier-one";
|
ExecStart = "${cfg.package}/bin/zerotier-one";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
KillMode = "process";
|
KillMode = "process";
|
||||||
};
|
};
|
||||||
|
@ -30,6 +38,6 @@ in
|
||||||
# ZeroTier does not issue DHCP leases, but some strangers might...
|
# ZeroTier does not issue DHCP leases, but some strangers might...
|
||||||
networking.dhcpcd.denyInterfaces = [ "zt0" ];
|
networking.dhcpcd.denyInterfaces = [ "zt0" ];
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.zerotierone ];
|
environment.systemPackages = [ cfg.package ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue