about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/julia/generic.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-01-20 12:31:50 +0100
committerAlyssa Ross <hi@alyssa.is>2024-01-20 12:32:25 +0100
commitb7baf40e099b4215181fe7b0c63083b12ef2c7fb (patch)
treea6efabd31d05b6d0a36624729e80377bbbfb0149 /nixpkgs/pkgs/development/compilers/julia/generic.nix
parent710028664e26e85cb831a869b3da9f6993902255 (diff)
parent0799f514b1cd74878174939df79ac60ca5036673 (diff)
downloadnixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.gz
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.bz2
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.lz
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.xz
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.zst
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/julia/generic.nix')
-rw-r--r--nixpkgs/pkgs/development/compilers/julia/generic.nix91
1 files changed, 91 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/julia/generic.nix b/nixpkgs/pkgs/development/compilers/julia/generic.nix
new file mode 100644
index 000000000000..4ab317618a41
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/julia/generic.nix
@@ -0,0 +1,91 @@
+{ version
+, hash
+, patches
+}:
+
+{ lib
+, stdenv
+, fetchurl
+, which
+, python3
+, gfortran
+, cmake
+, perl
+, gnum4
+, openssl
+, libxml2
+}:
+
+stdenv.mkDerivation rec {
+  pname = "julia";
+
+  inherit version patches;
+
+  src = fetchurl {
+    url = "https://github.com/JuliaLang/julia/releases/download/v${version}/julia-${version}-full.tar.gz";
+    inherit hash;
+  };
+
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    which
+    python3
+    gfortran
+    cmake
+    perl
+    gnum4
+    openssl
+  ];
+
+  buildInputs = [
+    libxml2
+  ];
+
+  dontUseCmakeConfigure = true;
+
+  postPatch = ''
+    patchShebangs .
+  '';
+
+  makeFlags = [
+    "prefix=$(out)"
+    "USE_BINARYBUILDER=0"
+  ] ++ lib.optionals stdenv.isx86_64 [
+    # https://github.com/JuliaCI/julia-buildbot/blob/master/master/inventory.py
+    "JULIA_CPU_TARGET=generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)"
+  ] ++ lib.optionals stdenv.isAarch64 [
+    "JULIA_CPU_TARGET=generic;cortex-a57;thunderx2t99;armv8.2-a,crypto,fullfp16,lse,rdm"
+  ];
+
+  # remove forbidden reference to $TMPDIR
+  preFixup = ''
+    for file in libcurl.so libgmpxx.so libmpfr.so; do
+      patchelf --shrink-rpath --allowed-rpath-prefixes ${builtins.storeDir} "$out/lib/julia/$file"
+    done
+  '';
+
+  # tests are flaky for aarch64-linux on hydra
+  doInstallCheck = if (lib.versionOlder version "1.10") then !stdenv.hostPlatform.isAarch64 else true;
+
+  installCheckTarget = "testall";
+
+  preInstallCheck = ''
+    export JULIA_TEST_USE_MULTIPLE_WORKERS="true"
+    # Some tests require read/write access to $HOME.
+    # And $HOME cannot be equal to $TMPDIR as it causes test failures
+    export HOME=$(mktemp -d)
+  '';
+
+  dontStrip = true;
+
+  enableParallelBuilding = true;
+
+  meta = with lib; {
+    description = "High-level performance-oriented dynamical language for technical computing";
+    homepage = "https://julialang.org/";
+    license = licenses.mit;
+    maintainers = with maintainers; [ nickcao joshniemela thomasjm ];
+    platforms = [ "x86_64-linux" "aarch64-linux" ];
+  };
+}