nixos/hbase: add settings option for hbase-site.xml
This commit is contained in:
parent
82b5e86be8
commit
cb5f41a067
@ -5,18 +5,24 @@ with lib;
|
||||
let
|
||||
cfg = config.services.hbase;
|
||||
|
||||
configFile = pkgs.writeText "hbase-site.xml" ''
|
||||
<configuration>
|
||||
<property>
|
||||
<name>hbase.rootdir</name>
|
||||
<value>file://${cfg.dataDir}/hbase</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>hbase.zookeeper.property.dataDir</name>
|
||||
<value>${cfg.dataDir}/zookeeper</value>
|
||||
</property>
|
||||
</configuration>
|
||||
'';
|
||||
defaultConfig = {
|
||||
"hbase.rootdir" = "file://${cfg.dataDir}/hbase";
|
||||
"hbase.zookeeper.property.dataDir" = "${cfg.dataDir}/zookeeper";
|
||||
};
|
||||
|
||||
buildProperty = configAttr:
|
||||
(builtins.concatStringsSep "\n"
|
||||
(lib.mapAttrsToList
|
||||
(name: value: ''
|
||||
<property>
|
||||
<name>${name}</name>
|
||||
<value>${builtins.toString value}</value>
|
||||
</property>
|
||||
'')
|
||||
configAttr));
|
||||
|
||||
configFile = pkgs.writeText "hbase-site.xml"
|
||||
(buildProperty (defaultConfig // cfg.settings));
|
||||
|
||||
configDir = pkgs.runCommand "hbase-config-dir" { preferLocalBuild = true; } ''
|
||||
mkdir -p $out
|
||||
@ -85,6 +91,14 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = with lib.types; attrsOf (oneOf [ str int bool ]);
|
||||
default = defaultConfig;
|
||||
description = ''
|
||||
configurations in hbase-site.xml, see <link xlink:href="https://github.com/apache/hbase/blob/master/hbase-server/src/test/resources/hbase-site.xml"/> for details.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user