1{ stdenv, fetchurl, installShellFiles, jdk11, rlwrap, makeWrapper }:
2
3stdenv.mkDerivation rec {
4 pname = "clojure";
5 version = "1.10.1.645";
6
7 src = fetchurl {
8 url = "https://download.clojure.org/install/clojure-tools-${version}.tar.gz";
9 sha256 = "1z6a9an8ls992y4japmzdxay7c5d2z9s2q1xl4g615r23jwpcsf9";
10 };
11
12 nativeBuildInputs = [
13 installShellFiles
14 makeWrapper
15 ];
16
17 installPhase =
18 let
19 binPath = stdenv.lib.makeBinPath [ rlwrap jdk11 ];
20 in
21 ''
22 mkdir -p $out/libexec
23 cp clojure-tools-${version}.jar $out/libexec
24 cp example-deps.edn $out
25 cp deps.edn $out
26 cp clj_exec.clj $out
27
28 substituteInPlace clojure --replace PREFIX $out
29
30 install -Dt $out/bin clj clojure
31 wrapProgram $out/bin/clj --prefix PATH : $out/bin:${binPath}
32 wrapProgram $out/bin/clojure --prefix PATH : $out/bin:${binPath}
33
34 installManPage clj.1 clojure.1
35 '';
36
37 doInstallCheck = true;
38 installCheckPhase = ''
39 CLJ_CONFIG=$out CLJ_CACHE=$out/libexec $out/bin/clojure \
40 -Spath \
41 -Sverbose \
42 -Scp $out/libexec/clojure-tools-${version}.jar
43 '';
44 meta = with stdenv.lib; {
45 description = "A Lisp dialect for the JVM";
46 homepage = "https://clojure.org/";
47 license = licenses.epl10;
48 longDescription = ''
49 Clojure is a dynamic programming language that targets the Java
50 Virtual Machine. It is designed to be a general-purpose language,
51 combining the approachability and interactive development of a
52 scripting language with an efficient and robust infrastructure for
53 multithreaded programming. Clojure is a compiled language - it
54 compiles directly to JVM bytecode, yet remains completely
55 dynamic. Every feature supported by Clojure is supported at
56 runtime. Clojure provides easy access to the Java frameworks, with
57 optional type hints and type inference, to ensure that calls to Java
58 can avoid reflection.
59
60 Clojure is a dialect of Lisp, and shares with Lisp the code-as-data
61 philosophy and a powerful macro system. Clojure is predominantly a
62 functional programming language, and features a rich set of immutable,
63 persistent data structures. When mutable state is needed, Clojure
64 offers a software transactional memory system and reactive Agent
65 system that ensure clean, correct, multithreaded designs.
66 '';
67 maintainers = with maintainers; [ jlesquembre ];
68 platforms = platforms.unix;
69 };
70}