diff --git a/nixos/modules/services/databases/hbase.nix b/nixos/modules/services/databases/hbase.nix index 181be2d6b0b8..fe4f05eec643 100644 --- a/nixos/modules/services/databases/hbase.nix +++ b/nixos/modules/services/databases/hbase.nix @@ -1,14 +1,10 @@ -{ config, lib, pkgs, ... }: +{ config, options, lib, pkgs, ... }: with lib; let cfg = config.services.hbase; - - defaultConfig = { - "hbase.rootdir" = "file://${cfg.dataDir}/hbase"; - "hbase.zookeeper.property.dataDir" = "${cfg.dataDir}/zookeeper"; - }; + opt = options.services.hbase; buildProperty = configAttr: (builtins.concatStringsSep "\n" @@ -23,7 +19,7 @@ let configFile = pkgs.writeText "hbase-site.xml" '' - ${buildProperty (defaultConfig // cfg.settings)} + ${buildProperty (opt.settings.default // cfg.settings)} ''; @@ -96,7 +92,16 @@ in { settings = mkOption { type = with lib.types; attrsOf (oneOf [ str int bool ]); - default = defaultConfig; + default = { + "hbase.rootdir" = "file://${cfg.dataDir}/hbase"; + "hbase.zookeeper.property.dataDir" = "${cfg.dataDir}/zookeeper"; + }; + defaultText = literalExpression '' + { + "hbase.rootdir" = "file://''${config.${opt.dataDir}}/hbase"; + "hbase.zookeeper.property.dataDir" = "''${config.${opt.dataDir}}/zookeeper"; + } + ''; description = '' configurations in hbase-site.xml, see for details. '';