1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 14:11:36 +00:00
nixpkgs/nixos/modules/services/misc/mesos-slave.nix

96 lines
2.2 KiB
Nix
Raw Normal View History

2014-08-26 19:56:54 +01:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.mesos.slave;
2014-12-02 11:10:15 +00:00
2014-08-26 19:56:54 +01:00
in {
options.services.mesos = {
slave = {
enable = mkOption {
description = "Whether to enable the Mesos Slave.";
default = false;
type = types.uniq types.bool;
};
port = mkOption {
description = "Mesos Slave port";
default = 5051;
type = types.int;
};
master = mkOption {
description = ''
May be one of:
zk://host1:port1,host2:port2,.../path
zk://username:password@host1:port1,host2:port2,.../path
'';
type = types.str;
};
2014-12-02 11:10:15 +00:00
2014-08-26 19:56:54 +01:00
withHadoop = mkOption {
description = "Add the HADOOP_HOME to the slave.";
default = false;
type = types.bool;
};
2014-12-02 11:10:15 +00:00
2014-08-26 19:56:54 +01:00
workDir = mkOption {
description = "The Mesos work directory.";
default = "/var/lib/mesos/slave";
type = types.str;
};
2014-12-02 11:10:15 +00:00
2014-08-26 19:56:54 +01:00
extraCmdLineOptions = mkOption {
description = ''
Extra command line options for Mesos Slave.
2014-12-02 11:10:15 +00:00
2014-08-26 19:56:54 +01:00
See https://mesos.apache.org/documentation/latest/configuration/
'';
default = [ "" ];
type = types.listOf types.string;
example = [ "--gc_delay=3days" ];
};
2014-12-02 11:10:15 +00:00
2014-08-26 19:56:54 +01:00
logLevel = mkOption {
description = ''
The logging level used. Possible values:
'INFO', 'WARNING', 'ERROR'
'';
default = "INFO";
type = types.str;
};
};
};
config = mkIf cfg.enable {
systemd.services.mesos-slave = {
description = "Mesos Slave";
wantedBy = [ "multi-user.target" ];
after = [ "network-interfaces.target" ];
2014-12-02 11:10:15 +00:00
environment.MESOS_CONTAINERIZERS = "docker,mesos";
2014-08-26 19:56:54 +01:00
serviceConfig = {
ExecStart = ''
${pkgs.mesos}/bin/mesos-slave \
--port=${toString cfg.port} \
--master=${cfg.master} \
${optionalString cfg.withHadoop "--hadoop-home=${pkgs.hadoop}"} \
--work_dir=${cfg.workDir} \
--logging_level=${cfg.logLevel} \
2014-12-02 11:10:15 +00:00
--docker=${pkgs.docker}/libexec/docker/docker \
2014-08-26 19:56:54 +01:00
${toString cfg.extraCmdLineOptions}
'';
PermissionsStartOnly = true;
};
preStart = ''
mkdir -m 0700 -p ${cfg.workDir}
'';
};
};
2014-12-02 11:10:15 +00:00
}