at 18.09-beta 1.3 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 cfg = config.services.chronos; 7 8in { 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.bool; 17 }; 18 19 httpPort = mkOption { 20 description = "Chronos listening port"; 21 default = 4400; 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.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.users.chronos.uid = config.ids.uids.chronos; 53 }; 54}