nixos: add chronos service

This commit is contained in:
Jaka Hudoklin 2014-12-03 15:49:14 +01:00
parent 665cc41e5c
commit 099eabb490
3 changed files with 56 additions and 0 deletions

View File

@ -171,6 +171,7 @@
bosun = 161;
kubernetes = 162;
peerflix = 163;
chronos = 164;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!

View File

@ -292,6 +292,7 @@
./services/networking/znc.nix
./services/printing/cupsd.nix
./services/scheduling/atd.nix
./services/scheduling/chronos.nix
./services/scheduling/cron.nix
./services/scheduling/fcron.nix
./services/search/elasticsearch.nix

View File

@ -0,0 +1,54 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.chronos;
in {
###### interface
options.services.chronos = {
enable = mkOption {
description = "Whether to enable graphite web frontend.";
default = false;
type = types.uniq types.bool;
};
httpPort = mkOption {
description = "Chronos listening port";
default = 8080;
type = types.int;
};
master = mkOption {
description = "Chronos mesos master zookeeper address";
default = "zk://${head cfg.zookeeperHosts}/mesos";
type = types.str;
};
zookeeperHosts = mkOption {
description = "Chronos mesos zookepper addresses";
default = [ "localhost:2181" ];
type = types.listOf types.str;
};
};
###### implementation
config = mkIf cfg.enable {
systemd.services.chronos = {
description = "Chronos Service";
wantedBy = [ "multi-user.target" ];
after = [ "network-interfaces.target" "zookeeper.service" ];
serviceConfig = {
ExecStart = "${pkgs.chronos}/bin/chronos --master ${cfg.master} --zk_hosts ${concatStringsSep "," cfg.zookeeperHosts} --http_port ${toString cfg.httpPort}";
User = "chronos";
};
};
users.extraUsers.chronos.uid = config.ids.uids.chronos;
};
}