18 src = fetchFromGitHub {
22 hash = "sha256-s2GqiFcekXRts8BU5CSmTrkFZ9xLqq4A5MybhB1o1Gg=";
27 codon-llvm = stdenv.mkDerivation {
29 version = "unstable-2022-09-23";
31 src = fetchFromGitHub {
33 repo = "llvm-project";
34 rev = "55b0b8fa1c9f9082b535628fc9fa6313280c0b9a";
35 hash = "sha256-03SPQgNdrpR6/JZ5aR/ntoh/FnZvCjT/6bTAcZaFafw=";
47 "-DLLVM_ENABLE_RTTI=ON"
48 "-DLLVM_ENABLE_TERMINFO=OFF"
49 "-DLLVM_ENABLE_ZLIB=OFF"
50 "-DLLVM_INCLUDE_TESTS=OFF"
51 "-DLLVM_TARGETS_TO_BUILD=all"
52 "-DLLVM_USE_LINKER=lld"
57 codon-deps = stdenv.mkDerivation {
58 name = "codon-deps-${version}.tar.gz";
73 "-DCPM_DOWNLOAD_ALL=ON"
74 "-DCPM_SOURCE_CACHE=${depsDir}"
75 "-DLLVM_DIR=${codon-llvm}/lib/cmake/llvm"
79 # Prune the `.git` directories
80 find ${depsDir} -name .git -type d -prune -exec rm -rf {} \;;
81 # Build a reproducible tar, per instructions at https://reproducible-builds.org/docs/archives/
82 tar --owner=0 --group=0 --numeric-owner --format=gnu \
83 --sort=name --mtime="@$SOURCE_DATE_EPOCH" \
87 _deps/googletest-subbuild/googletest-populate-prefix/src/*.zip
91 if stdenv.hostPlatform.isDarwin then
92 "sha256-KfemYV42xBAhsPbwTkzdc3GxCVHiWRbyUZORPWxx4vg="
94 "sha256-a1zGSpbMjfQBrcgW/aiIdKX8+uI3p/S9pgZjHe2HtWs=";
96 outputHashAlgo = "sha256";
105 # Without the hash, CMake will try to replace the `.zip` file
106 ./Add-a-hash-to-the-googletest-binary.patch
109 nativeBuildInputs = [
119 mkdir -p $sourceRoot/build
120 tar -xf ${codon-deps} -C $sourceRoot/build
124 "-DCPM_SOURCE_CACHE=${depsDir}"
125 "-DLLVM_DIR=${codon-llvm}/lib/cmake/llvm"
126 "-DLLVM_USE_LINKER=lld"
129 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
130 ln -s $out/lib/codon/*.dylib $out/lib/
133 passthru.updateScript = nix-update-script { };
136 description = "High-performance, zero-overhead, extensible Python compiler using LLVM";
137 homepage = "https://docs.exaloop.io/codon";
139 license = lib.licenses.bsl11;
140 platforms = lib.platforms.all;
141 broken = true; # `codon-llvm` build fails on darwin and linux