diff options
author | Vanilla <osu_Vanilla@126.com> | 2021-11-18 10:34:13 +0800 |
---|---|---|
committer | Vanilla <osu_Vanilla@126.com> | 2021-11-18 11:54:41 +0800 |
commit | cb5f41a0678b1dd628148cdd281c698e238ae635 (patch) | |
tree | 4a6486bf054f44bb3c768408d7dbc9d930a4188e /nixos/modules/services/databases | |
parent | 82b5e86be80fd59ba9c7e1135b26aa770fe04893 (diff) | |
download | nixpkgs-cb5f41a0678b1dd628148cdd281c698e238ae635.tar nixpkgs-cb5f41a0678b1dd628148cdd281c698e238ae635.tar.gz nixpkgs-cb5f41a0678b1dd628148cdd281c698e238ae635.tar.bz2 nixpkgs-cb5f41a0678b1dd628148cdd281c698e238ae635.tar.lz nixpkgs-cb5f41a0678b1dd628148cdd281c698e238ae635.tar.xz nixpkgs-cb5f41a0678b1dd628148cdd281c698e238ae635.tar.zst nixpkgs-cb5f41a0678b1dd628148cdd281c698e238ae635.zip |
nixos/hbase: add settings option for hbase-site.xml
Diffstat (limited to 'nixos/modules/services/databases')
-rw-r--r-- | nixos/modules/services/databases/hbase.nix | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/nixos/modules/services/databases/hbase.nix b/nixos/modules/services/databases/hbase.nix index ff01a1bcd98..183c8a2f46d 100644 --- a/nixos/modules/services/databases/hbase.nix +++ b/nixos/modules/services/databases/hbase.nix @@ -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. + ''; + }; + }; }; |