-
Notifications
You must be signed in to change notification settings - Fork 14
/
clj2nix.nix
41 lines (33 loc) · 1.06 KB
/
clj2nix.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
stdenv, lib, coreutils, clojure,
makeWrapper, nix-prefetch-git,
fetchMavenArtifact, fetchgit,
openjdk, fetchFromGitHub, git, gitignore
}:
let cljdeps = import ./deps.nix { inherit fetchMavenArtifact fetchgit lib; };
classp = cljdeps.makeClasspaths {
extraClasspaths = [ "${placeholder "out"}/lib" ];
};
version = "1.1.0-rc";
inherit (import gitignore { inherit lib; }) gitignoreSource;
in stdenv.mkDerivation rec {
name = "clj2nix-${version}";
src = gitignoreSource ./.;
buildInputs = [ makeWrapper clojure git ];
buildPhase = ''
mkdir -p classes
HOME=. clojure -Scp "${classp}:src" -e "(compile 'clj2nix.core)"
'';
dontFixup = true;
installPhase = ''
mkdir -p $out/{bin,lib}
cp -rT classes $out/lib
makeWrapper ${openjdk}/bin/java $out/bin/clj2nix \
--add-flags "-Dlog4j.rootLogger=FATAL" \
--add-flags "-cp" \
--add-flags "${classp}" \
--add-flags "clj2nix.core" \
--add-flags "${version}" \
--prefix PATH : "$PATH:${lib.makeBinPath [ coreutils nix-prefetch-git ]}"
'';
}