49 lines
1.1 KiB
Nix
49 lines
1.1 KiB
Nix
{ lib, stdenv, callPackage, clojure, build-tools-jar, writeTextDir, toEDN }:
|
|
{ src, name, group, version, clj-deps, src-paths }:
|
|
|
|
with lib;
|
|
let
|
|
|
|
build-tools-deps = writeTextDir "deps.edn" (toEDN {
|
|
aliases.build = {
|
|
ns-build = "'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 = ''
|
|
HOME=$TEMP/home
|
|
mkdir -p $HOME
|
|
mkdir -p ${target}
|
|
|
|
clojure \
|
|
-Scp .:${build-tools-jar}:${classpath} \
|
|
-Sdeps ${builtins.trace build-tools-deps build-tools-deps} \
|
|
-X:build \
|
|
lib-uberjar \
|
|
:project ${group}/${name} \
|
|
:version ${version} \
|
|
:srcs ${concatStringsSep "," src-paths} \
|
|
:target ${target}
|
|
'';
|
|
|
|
installPhase = ''
|
|
mv ${target}/${name}-${version}-standalone.jar $out
|
|
'';
|
|
}
|