git.iko.soy/typeable/nixpkgs
on master help sign in
nixos: add chronos service
commit099eabb49017fab343731f94033723552a41e722 authorJaka Hudoklin <jakahudoklin@gmail.com> dateWed 3 Dec 2014, 15:49 (12 years ago) parent665cc41
3 files changed+56
nixos/modules/misc/ids.nix+1 nixos/modules/module-list.nix+1 nixos/modules/services/scheduling/chronos.nix+54
nixos/modules/misc/ids.nix+1
@@ -171,6 +171,7 @@
171171 bosun = 161;
172172 kubernetes = 162;
173173 peerflix = 163;
174+ chronos = 164;
174175
175176 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
176177
nixos/modules/module-list.nix+1
@@ -292,6 +292,7 @@
292292 ./services/networking/znc.nix
293293 ./services/printing/cupsd.nix
294294 ./services/scheduling/atd.nix
295+ ./services/scheduling/chronos.nix
295296 ./services/scheduling/cron.nix
296297 ./services/scheduling/fcron.nix
297298 ./services/search/elasticsearch.nix
nixos/modules/services/scheduling/chronos.nixnew file+54
@@ -0,0 +1,54 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+ cfg = config.services.chronos;
7+
8+in {
9+
10+ ###### interface
11+
12+ options.services.chronos = {
13+ enable = mkOption {
14+ description = "Whether to enable graphite web frontend.";
15+ default = false;
16+ type = types.uniq types.bool;
17+ };
18+
19+ httpPort = mkOption {
20+ description = "Chronos listening port";
21+ default = 8080;
22+ type = types.int;
23+ };
24+
25+ master = mkOption {
26+ description = "Chronos mesos master zookeeper address";
27+ default = "zk://${head cfg.zookeeperHosts}/mesos";
28+ type = types.str;
29+ };
30+
31+ zookeeperHosts = mkOption {
32+ description = "Chronos mesos zookepper addresses";
33+ default = [ "localhost:2181" ];
34+ type = types.listOf types.str;
35+ };
36+ };
37+
38+ ###### implementation
39+
40+ config = mkIf cfg.enable {
41+ systemd.services.chronos = {
42+ description = "Chronos Service";
43+ wantedBy = [ "multi-user.target" ];
44+ after = [ "network-interfaces.target" "zookeeper.service" ];
45+
46+ serviceConfig = {
47+ ExecStart = "${pkgs.chronos}/bin/chronos --master ${cfg.master} --zk_hosts ${concatStringsSep "," cfg.zookeeperHosts} --http_port ${toString cfg.httpPort}";
48+ User = "chronos";
49+ };
50+ };
51+
52+ users.extraUsers.chronos.uid = config.ids.uids.chronos;
53+ };
54+}