1 { lib, stdenv, fetchurl, installShellFiles, jdk, rlwrap, makeWrapper, writeScript }:
3 stdenv.mkDerivation (finalAttrs: {
5 version = "1.12.0.1488";
8 # https://github.com/clojure/brew-install/releases
9 url = "https://github.com/clojure/brew-install/releases/download/${finalAttrs.version}/clojure-tools-${finalAttrs.version}.tar.gz";
10 hash = "sha256-vBm+ABC+8EIcJv077HvDvKCMGSgo1ZoVGEVCLcRCB0I=";
18 # See https://github.com/clojure/brew-install/blob/1.10.3/src/main/resources/clojure/install/linux-install.sh
21 binPath = lib.makeBinPath [ rlwrap jdk ];
29 echo "Installing libs into $clojure_lib_dir"
30 install -Dm644 deps.edn "$clojure_lib_dir/deps.edn"
31 install -Dm644 example-deps.edn "$clojure_lib_dir/example-deps.edn"
32 install -Dm644 tools.edn "$clojure_lib_dir/tools.edn"
33 install -Dm644 exec.jar "$clojure_lib_dir/libexec/exec.jar"
34 install -Dm644 clojure-tools-${finalAttrs.version}.jar "$clojure_lib_dir/libexec/clojure-tools-${finalAttrs.version}.jar"
36 echo "Installing clojure and clj into $bin_dir"
37 substituteInPlace clojure --replace PREFIX $out
38 substituteInPlace clj --replace BINDIR $bin_dir
39 install -Dm755 clojure "$bin_dir/clojure"
40 install -Dm755 clj "$bin_dir/clj"
42 wrapProgram $bin_dir/clojure --prefix PATH : $out/bin:${binPath}
43 wrapProgram $bin_dir/clj --prefix PATH : $out/bin:${binPath}
45 installManPage clj.1 clojure.1
50 doInstallCheck = true;
52 installCheckPhase = ''
53 CLJ_CONFIG=$TMPDIR CLJ_CACHE=$TMPDIR/.clj_cache $out/bin/clojure \
56 -Scp $out/libexec/clojure-tools-${finalAttrs.version}.jar
59 passthru.updateScript = writeScript "update-clojure" ''
60 #!/usr/bin/env nix-shell
61 #!nix-shell -i bash -p curl common-updater-scripts jq
64 shopt -s inherit_errexit
66 # `jq -r '.[0].name'` results in `v0.0`
67 latest_version="$(curl \
68 ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
69 -fsL "https://api.github.com/repos/clojure/brew-install/tags" \
72 update-source-version clojure "$latest_version"
78 description = "Lisp dialect for the JVM";
79 homepage = "https://clojure.org/";
80 sourceProvenance = with sourceTypes; [ binaryBytecode ];
81 license = licenses.epl10;
83 Clojure is a dynamic programming language that targets the Java
84 Virtual Machine. It is designed to be a general-purpose language,
85 combining the approachability and interactive development of a
86 scripting language with an efficient and robust infrastructure for
87 multithreaded programming. Clojure is a compiled language - it
88 compiles directly to JVM bytecode, yet remains completely
89 dynamic. Every feature supported by Clojure is supported at
90 runtime. Clojure provides easy access to the Java frameworks, with
91 optional type hints and type inference, to ensure that calls to Java
94 Clojure is a dialect of Lisp, and shares with Lisp the code-as-data
95 philosophy and a powerful macro system. Clojure is predominantly a
96 functional programming language, and features a rich set of immutable,
97 persistent data structures. When mutable state is needed, Clojure
98 offers a software transactional memory system and reactive Agent
99 system that ensure clean, correct, multithreaded designs.
101 maintainers = with maintainers; [ jlesquembre ];
102 platforms = platforms.unix;