{ lib, stdenv, callPackage, jre, clojure, build-tools-jar, writeScript , writeText }: { src, name, group, version, clj-deps, src-paths }: with lib; let build-tools-deps = writeText "deps.edn" '' { :aliases { :build { :ns-default build :replace-deps { io.github.clojure/tools.build { :local/root "${build-tools-jar}" } } } } } ''; deps = callPackage clj-deps { }; classpath = deps.makeClasspaths { }; uberjar-script = writeScript "uberjar-builder.rb" '' ${ruby}/bin/ruby ${readFile ./resources/uberjar-builder.rb} ''; full-name = "${group}-${name}-${version}-standalone.jar"; target = "$TEMP/target"; in stdenv.mkDerivation { name = name; src = src; nativeBuildInputs = [ jre ]; buildInputs = [ build-tools-jar ] ++ (map (x: x.paths) deps.packages); buildPhase = '' HOME=$TEMP/home mkdir -p $HOME mkdir -p ${target} clojure \ -Scp ${classpath} \ -Sdeps ${build-tools-deps} \ -T:build \ lib-uberjar \ :project ${group}/${name} \ :version ${version}" \ :srcs ${concatStringsSep "," src-paths}" :target ${target} ''; installPhase = '' mv ${target}/${name}-${version}-standalone.jar $out ''; }