{ lib, stdenv, callPackage, clojure, build-tools-jar, writeTextDir }: { src, name, group, version, clj-deps, src-paths }: with lib; let build-tools-deps = writeTextDir "deps.edn" '' { :aliases { :build { :ns-default build :replace-deps { io.github.clojure/tools.build { :local/root "${build-tools-jar}" } } } } } ''; classpath = clj-deps.makeClasspaths { }; full-name = "${group}-${name}-${version}-standalone.jar"; target = "$TEMP/target"; in stdenv.mkDerivation { name = name; src = src; nativeBuildInputs = [ clojure ]; buildInputs = (map (x: x.paths) clj-deps.packages); buildPhase = let cmd = '' HOME=$TEMP/home BHOME=$TEMP/build-home mkdir -p $HOME mkdir -p ${target} mkdir -p $BHOME cp ${build-tools-deps} $BHOME/deps.edn clojure \ -Scp .:${build-tools-jar}:${classpath} \ -Sdeps $BHOME/deps.edn \ -X:build \ lib-uberjar \ :project ${group}/${name} \ :version ${version} \ :srcs ${concatStringsSep "," src-paths} \ :target ${target} ''; in builtins.trace cmd cmd; installPhase = '' mv ${target}/${name}-${version}-standalone.jar $out ''; }