summary refs log tree commit diff
path: root/nixos/modules/services/cluster/hadoop
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2021-12-05 21:28:49 +0100
committerpennae <github@quasiparticle.net>2021-12-09 01:13:48 +0100
commitfb0e5be84331188a69b3edd31679ca6576edb75a (patch)
tree80d713f568ae02e4a3aed70114bafe46e9fe753f /nixos/modules/services/cluster/hadoop
parentf6d0b014fe1db9e6edec5485f41a1162136c8a70 (diff)
downloadnixpkgs-fb0e5be84331188a69b3edd31679ca6576edb75a.tar
nixpkgs-fb0e5be84331188a69b3edd31679ca6576edb75a.tar.gz
nixpkgs-fb0e5be84331188a69b3edd31679ca6576edb75a.tar.bz2
nixpkgs-fb0e5be84331188a69b3edd31679ca6576edb75a.tar.lz
nixpkgs-fb0e5be84331188a69b3edd31679ca6576edb75a.tar.xz
nixpkgs-fb0e5be84331188a69b3edd31679ca6576edb75a.tar.zst
nixpkgs-fb0e5be84331188a69b3edd31679ca6576edb75a.zip
treewide: add defaultText for options with simple interpolation defaults
adds defaultText for all options that use `cfg.*` values in their
defaults, but only for interpolations with no extra processing (other
than toString where necessary)
Diffstat (limited to 'nixos/modules/services/cluster/hadoop')
-rw-r--r--nixos/modules/services/cluster/hadoop/default.nix14
1 files changed, 13 insertions, 1 deletions
diff --git a/nixos/modules/services/cluster/hadoop/default.nix b/nixos/modules/services/cluster/hadoop/default.nix
index 90f22c48e05..a1a95fe31ca 100644
--- a/nixos/modules/services/cluster/hadoop/default.nix
+++ b/nixos/modules/services/cluster/hadoop/default.nix
@@ -1,6 +1,7 @@
-{ config, lib, pkgs, ...}:
+{ config, lib, options, pkgs, ...}:
 let
   cfg = config.services.hadoop;
+  opt = options.services.hadoop;
 in
 with lib;
 {
@@ -44,6 +45,14 @@ with lib;
         "mapreduce.map.env" = "HADOOP_MAPRED_HOME=${cfg.package}/lib/${cfg.package.untarDir}";
         "mapreduce.reduce.env" = "HADOOP_MAPRED_HOME=${cfg.package}/lib/${cfg.package.untarDir}";
       };
+      defaultText = literalExpression ''
+        {
+          "mapreduce.framework.name" = "yarn";
+          "yarn.app.mapreduce.am.env" = "HADOOP_MAPRED_HOME=''${config.${opt.package}}/lib/''${config.${opt.package}.untarDir}";
+          "mapreduce.map.env" = "HADOOP_MAPRED_HOME=''${config.${opt.package}}/lib/''${config.${opt.package}.untarDir}";
+          "mapreduce.reduce.env" = "HADOOP_MAPRED_HOME=''${config.${opt.package}}/lib/''${config.${opt.package}.untarDir}";
+        }
+      '';
       type = types.attrsOf types.anything;
       example = literalExpression ''
         options.services.hadoop.mapredSite.default // {
@@ -98,6 +107,9 @@ with lib;
 
     log4jProperties = mkOption {
       default = "${cfg.package}/lib/${cfg.package.untarDir}/etc/hadoop/log4j.properties";
+      defaultText = literalExpression ''
+        "''${config.${opt.package}}/lib/''${config.${opt.package}.untarDir}/etc/hadoop/log4j.properties"
+      '';
       type = types.path;
       example = literalExpression ''
         "''${pkgs.hadoop}/lib/''${pkgs.hadoop.untarDir}/etc/hadoop/log4j.properties";