1{ config, lib, pkgs, ...}:
2
3with lib;
4{
5 imports = [ ./yarn.nix ./hdfs.nix ];
6
7 options.services.hadoop = {
8 coreSite = mkOption {
9 default = {};
10 type = types.attrsOf types.anything;
11 example = literalExample ''
12 {
13 "fs.defaultFS" = "hdfs://localhost";
14 }
15 '';
16 description = "Hadoop core-site.xml definition";
17 };
18
19 hdfsSite = mkOption {
20 default = {};
21 type = types.attrsOf types.anything;
22 example = literalExample ''
23 {
24 "dfs.nameservices" = "namenode1";
25 }
26 '';
27 description = "Hadoop hdfs-site.xml definition";
28 };
29
30 mapredSite = mkOption {
31 default = {};
32 type = types.attrsOf types.anything;
33 example = literalExample ''
34 {
35 "mapreduce.map.cpu.vcores" = "1";
36 }
37 '';
38 description = "Hadoop mapred-site.xml definition";
39 };
40
41 yarnSite = mkOption {
42 default = {};
43 type = types.attrsOf types.anything;
44 example = literalExample ''
45 {
46 "yarn.resourcemanager.ha.id" = "resourcemanager1";
47 }
48 '';
49 description = "Hadoop yarn-site.xml definition";
50 };
51
52 package = mkOption {
53 type = types.package;
54 default = pkgs.hadoop;
55 defaultText = "pkgs.hadoop";
56 example = literalExample "pkgs.hadoop";
57 description = "";
58 };
59 };
60
61
62 config = mkMerge [
63 (mkIf (builtins.hasAttr "yarn" config.users.users ||
64 builtins.hasAttr "hdfs" config.users.users) {
65 users.groups.hadoop = {
66 gid = config.ids.gids.hadoop;
67 };
68 })
69
70 ];
71}