3 propertyXml = name: value: lib.optionalString (value != null) ''
6 <value>${builtins.toString value}</value>
9 siteXml = fileName: properties: pkgs.writeTextDir fileName ''
10 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
11 <!-- generated by NixOS -->
13 ${builtins.concatStringsSep "\n" (pkgs.lib.mapAttrsToList propertyXml properties)}
16 cfgLine = name: value: ''
17 ${name}=${builtins.toString value}
19 cfgFile = fileName: properties: pkgs.writeTextDir fileName ''
21 ${builtins.concatStringsSep "" (pkgs.lib.mapAttrsToList cfgLine properties)}
24 hadoop_verify_logdir() {
25 echo Skipping verification of log directory
29 export HADOOP_LOG_DIR=/tmp/hadoop/$USER
32 pkgs.runCommand "hadoop-conf" {} (with cfg; ''
34 cp ${siteXml "core-site.xml" (coreSite // coreSiteInternal)}/* $out/
35 cp ${siteXml "hdfs-site.xml" (hdfsSiteDefault // hdfsSite // hdfsSiteInternal)}/* $out/
36 cp ${siteXml "hbase-site.xml" (hbaseSiteDefault // hbaseSite // hbaseSiteInternal)}/* $out/
37 cp ${siteXml "mapred-site.xml" (mapredSiteDefault // mapredSite)}/* $out/
38 cp ${siteXml "yarn-site.xml" (yarnSiteDefault // yarnSite // yarnSiteInternal)}/* $out/
39 cp ${siteXml "httpfs-site.xml" httpfsSite}/* $out/
40 cp ${cfgFile "container-executor.cfg" containerExecutorCfg}/* $out/
41 cp ${pkgs.writeTextDir "hadoop-user-functions.sh" userFunctions}/* $out/
42 cp ${pkgs.writeTextDir "hadoop-env.sh" hadoopEnv}/* $out/
43 cp ${log4jProperties} $out/log4j.properties
44 ${lib.concatMapStringsSep "\n" (dir: "cp -f -r ${dir}/* $out/") extraConfDirs}