I’m trying to build a package from a modified nixpkgs folder. Here are the modified contents of the package I’m building:
{ lib, stdenv, fetchzip, makeWrapper, jre, python3Packages, coreutils, hadoop_3_1, pkg-config, curl, autoPatchelfHook, cacert
, RSupport? true, R
}:
with lib;
stdenv.mkDerivation rec {
pname = "spark";
version = "3.1.2";
src = fetchzip {
url = "mirror://apache/spark/${pname}-${version}/${pname}-${version}.tgz";
sha256 = "0npld46bz20ixwaqsg65j6xwlb8nar1dhz2yfd0z5vzhy10qcq11";
};
nativeBuildInputs = [ makeWrapper pkg-config autoPatchelfHook ];
buildInputs = [ jre python3Packages.python python3Packages.numpy curl ]
++ optional RSupport R;
buildPhase = ''
seq 3 | while read line; do
patchShebangs .
autoPatchelf .
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
export HOME=$out
HOME=$out ./build/mvn -DskipTests clean package -Phive -Dhadoop.version=3.0.0-cdh6.3.1 -Dhive.version=2.1.1-cdh6.3.1 -Dlibthrift.version=0.9.3-1 -Dmaven.repo.local=$out/.m2 || true
done
'';
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "0npld46bz20ixwaqsg65j6xwlb8nar1dhz2yfd0z5vzhy10qcqqq";
#untarDir = "${pname}-${version}-bin-without-hadoop";
#installPhase = ''
#mkdir -p $out/{lib/${untarDir}/conf,bin,/share/java}
#mv * $out/lib/${untarDir}
#sed -e 's/INFO, console/WARN, console/' < \
# $out/lib/${untarDir}/conf/log4j.properties.template > \
# $out/lib/${untarDir}/conf/log4j.properties
#cat > $out/lib/${untarDir}/conf/spark-env.sh <<- EOF
#export JAVA_HOME="${jre}"
#export SPARK_HOME="$out/lib/${untarDir}"
#export SPARK_DIST_CLASSPATH=$(${hadoop_3_1}/bin/hadoop classpath)
#export PYSPARK_PYTHON="${python3Packages.python}/bin/${python3Packages.python.executable}"
#export PYTHONPATH="\$PYTHONPATH:$PYTHONPATH"
#${optionalString RSupport
# ''export SPARKR_R_SHELL="${R}/bin/R"
# export PATH=$PATH:"${R}/bin/R"''}
#EOF
#for n in $(find $out/lib/${untarDir}/bin -type f ! -name "*.*"); do
# makeWrapper "$n" "$out/bin/$(basename $n)"
# substituteInPlace "$n" --replace dirname ${coreutils.out}/bin/dirname
#done
#ln -s $out/lib/${untarDir}/lib/spark-assembly-*.jar $out/share/java
#'';
meta = {
description = "Apache Spark is a fast and general engine for large-scale data processing";
homepage = "http://spark.apache.org";
license = lib.licenses.asl20;
platforms = lib.platforms.all;
maintainers = with maintainers; [ thoughtpolice offline kamilchm ];
repositories.git = "git://git.apache.org/spark.git";
};
}
I’m building it by running:
nix-shell -I nixpkgs=$(pwd) -p spark
If I understood correctly, nix builds should not be aware of the existence of my user, as it happens in an isolated environment. But the build error logs show my username.
Even if I run this as root after purging all env vars and pther references to my user, mvn is somehow able to pick up my non-root username.
here’s the full build log:
https://asciinema.org/a/4QrAgofnrBCFCQmHW4YFgdpP5
How is this possible? Am I missing something obvious?