misc.etcd: get closer to upstream service definition

taken from
https://github.com/coreos/etcd/blob/master/contrib/systemd/etcd.service

I intentionally kept "After = network.target" because I think it's
missing upstream (https://github.com/coreos/etcd/pull/6388)
This commit is contained in:
Alexander Ried 2016-09-12 16:34:10 +02:00
parent 23ca90b013
commit 5481831263

View file

@ -143,9 +143,9 @@ in {
config = mkIf cfg.enable {
systemd.services.etcd = {
description = "Etcd Daemon";
description = "etcd key-value store";
wantedBy = [ "multi-user.target" ];
after = [ "network-interfaces.target" ];
after = [ "network.target" ];
environment = (filterAttrs (n: v: v != null) {
ETCD_NAME = cfg.name;
@ -168,12 +168,18 @@ in {
ETCD_INITIAL_CLUSTER_TOKEN = cfg.initialClusterToken;
}) // (mapAttrs' (n: v: nameValuePair "ETCD_${n}" v) cfg.extraConf);
unitConfig = {
Documentation = "https://github.com/coreos/etcd";
};
serviceConfig = {
Type = "notify";
ExecStart = "${pkgs.etcd.bin}/bin/etcd";
User = "etcd";
PermissionsStartOnly = true;
LimitNOFILE = 40000;
};
preStart = ''
mkdir -m 0700 -p ${cfg.dataDir}
if [ "$(id -u)" = 0 ]; then chown etcd ${cfg.dataDir}; fi