about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorNick Cao <nickcao@nichi.co>2024-01-11 11:28:44 -0500
committerNick Cao <nickcao@nichi.co>2024-01-11 11:33:23 -0500
commite2ada3ce79e7e3a180d6943236184c10a66e573a (patch)
tree56faa0dd459b351b9c70714e683a37a75e99f7ad /pkgs/development/compilers
parentfd37c3101b402e860d996526963acd04d92f4c5a (diff)
julia_1{9,10}: deduplicate common code
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/julia/1.9.nix85
-rw-r--r--pkgs/development/compilers/julia/default.nix31
-rw-r--r--pkgs/development/compilers/julia/generic.nix (renamed from pkgs/development/compilers/julia/1.10.nix)19
3 files changed, 35 insertions, 100 deletions
diff --git a/pkgs/development/compilers/julia/1.9.nix b/pkgs/development/compilers/julia/1.9.nix
deleted file mode 100644
index 34da443c26894..0000000000000
--- a/pkgs/development/compilers/julia/1.9.nix
+++ /dev/null
@@ -1,85 +0,0 @@
-{ lib
-, stdenv
-, fetchurl
-, which
-, python3
-, gfortran
-, cmake
-, perl
-, gnum4
-, openssl
-, libxml2
-}:
-
-stdenv.mkDerivation rec {
-  pname = "julia";
-  version = "1.9.4";
-
-  src = fetchurl {
-    url = "https://github.com/JuliaLang/julia/releases/download/v${version}/julia-${version}-full.tar.gz";
-    hash = "sha256-YYQ7lkf9BtOymU8yd6ZN4ctaWlKX2TC4yOO8DpN0ACQ=";
-  };
-
-  patches = [
-    ./patches/1.9/0002-skip-failing-and-flaky-tests.patch
-  ];
-
-  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
-  '';
-
-  doInstallCheck = !stdenv.hostPlatform.isAarch64; # tests are flaky for aarch64-linux on hydra
-  installCheckTarget = "testall";
-
-  preInstallCheck = ''
-    export HOME="$TMPDIR"
-    export JULIA_TEST_USE_MULTIPLE_WORKERS="true"
-  '';
-
-  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" ];
-  };
-}
diff --git a/pkgs/development/compilers/julia/default.nix b/pkgs/development/compilers/julia/default.nix
index 60ca5a9b9633b..e59efcc613822 100644
--- a/pkgs/development/compilers/julia/default.nix
+++ b/pkgs/development/compilers/julia/default.nix
@@ -1,10 +1,10 @@
 { callPackage }:
 
 let
-  juliaWithPackages = callPackage ../../julia-modules {};
+  juliaWithPackages = callPackage ../../julia-modules { };
 
   wrapJulia = julia: julia.overrideAttrs (oldAttrs: {
-    passthru = (oldAttrs.passthru or {}) // {
+    passthru = (oldAttrs.passthru or { }) // {
       withPackages = juliaWithPackages.override { inherit julia; };
     };
   });
@@ -12,9 +12,26 @@ let
 in
 
 {
-  julia_16-bin = wrapJulia (callPackage ./1.6-bin.nix {});
-  julia_19-bin = wrapJulia (callPackage ./1.9-bin.nix {});
-  julia_110-bin = wrapJulia (callPackage ./1.10-bin.nix {});
-  julia_19 = wrapJulia (callPackage ./1.9.nix {});
-  julia_110 = wrapJulia (callPackage ./1.10.nix {});
+  julia_16-bin = wrapJulia (callPackage ./1.6-bin.nix { });
+  julia_19-bin = wrapJulia (callPackage ./1.9-bin.nix { });
+  julia_110-bin = wrapJulia (callPackage ./1.10-bin.nix { });
+  julia_19 = wrapJulia (callPackage
+    (import ./generic.nix {
+      version = "1.9.4";
+      hash = "sha256-YYQ7lkf9BtOymU8yd6ZN4ctaWlKX2TC4yOO8DpN0ACQ=";
+      patches = [
+        ./patches/1.9/0002-skip-failing-and-flaky-tests.patch
+      ];
+    })
+    { });
+  julia_110 = wrapJulia (callPackage
+    (import ./generic.nix {
+      version = "1.10.0";
+      hash = "sha256-pfjAzgjPEyvdkZygtbOytmyJ4OX35/sqgf+n8iXj20w=";
+      patches = [
+        ./patches/1.10/0001-skip-building-docs-as-it-requires-network-access.patch
+        ./patches/1.10/0002-skip-failing-and-flaky-tests.patch
+      ];
+    })
+    { });
 }
diff --git a/pkgs/development/compilers/julia/1.10.nix b/pkgs/development/compilers/julia/generic.nix
index 620f235e4ee9a..4ab317618a413 100644
--- a/pkgs/development/compilers/julia/1.10.nix
+++ b/pkgs/development/compilers/julia/generic.nix
@@ -1,3 +1,8 @@
+{ version
+, hash
+, patches
+}:
+
 { lib
 , stdenv
 , fetchurl
@@ -13,18 +18,14 @@
 
 stdenv.mkDerivation rec {
   pname = "julia";
-  version = "1.10.0";
+
+  inherit version patches;
 
   src = fetchurl {
     url = "https://github.com/JuliaLang/julia/releases/download/v${version}/julia-${version}-full.tar.gz";
-    hash = "sha256-pfjAzgjPEyvdkZygtbOytmyJ4OX35/sqgf+n8iXj20w=";
+    inherit hash;
   };
 
-  patches = [
-    ./patches/1.10/0001-skip-building-docs-as-it-requires-network-access.patch
-    ./patches/1.10/0002-skip-failing-and-flaky-tests.patch
-  ];
-
   strictDeps = true;
 
   nativeBuildInputs = [
@@ -64,7 +65,9 @@ stdenv.mkDerivation rec {
     done
   '';
 
-  doInstallCheck = true;
+  # tests are flaky for aarch64-linux on hydra
+  doInstallCheck = if (lib.versionOlder version "1.10") then !stdenv.hostPlatform.isAarch64 else true;
+
   installCheckTarget = "testall";
 
   preInstallCheck = ''