diff options
author | Jaka Hudoklin <jakahudoklin@gmail.com> | 2014-12-03 15:49:14 +0100 |
---|---|---|
committer | Jaka Hudoklin <jakahudoklin@gmail.com> | 2014-12-03 15:49:14 +0100 |
commit | 099eabb49017fab343731f94033723552a41e722 (patch) | |
tree | 1611ef5c82e09d2b7c77a96e1e8082aee405c1e0 /nixos/modules/services/scheduling/chronos.nix | |
parent | 665cc41e5c602fd29f09a2ef9ac785dffbf1a54e (diff) | |
download | nixlib-099eabb49017fab343731f94033723552a41e722.tar nixlib-099eabb49017fab343731f94033723552a41e722.tar.gz nixlib-099eabb49017fab343731f94033723552a41e722.tar.bz2 nixlib-099eabb49017fab343731f94033723552a41e722.tar.lz nixlib-099eabb49017fab343731f94033723552a41e722.tar.xz nixlib-099eabb49017fab343731f94033723552a41e722.tar.zst nixlib-099eabb49017fab343731f94033723552a41e722.zip |
nixos: add chronos service
Diffstat (limited to 'nixos/modules/services/scheduling/chronos.nix')
-rw-r--r-- | nixos/modules/services/scheduling/chronos.nix | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/nixos/modules/services/scheduling/chronos.nix b/nixos/modules/services/scheduling/chronos.nix new file mode 100644 index 000000000000..277cdd632809 --- /dev/null +++ b/nixos/modules/services/scheduling/chronos.nix @@ -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; + }; +} |