summary refs log tree commit diff
path: root/pkgs/development/interpreters/octave/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/interpreters/octave/default.nix')
-rw-r--r--pkgs/development/interpreters/octave/default.nix126
1 files changed, 53 insertions, 73 deletions
diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix
index b257933e0d6..c8441cbae1f 100644
--- a/pkgs/development/interpreters/octave/default.nix
+++ b/pkgs/development/interpreters/octave/default.nix
@@ -1,9 +1,6 @@
 { stdenv
 , pkgs
 , lib
-# Note: either stdenv.mkDerivation or, for octaveFull, the qt-5 mkDerivation
-# with wrapQtAppsHook (comes from libsForQt5.callPackage)
-, mkDerivation
 , fetchurl
 , gfortran
 , ncurses
@@ -27,26 +24,25 @@
 , curl
 , rapidjson
 , blas, lapack
-# These two should use the same lapack and blas as the above
-, qrupdate, arpack, suitesparse ? null
+# These 3 should use the same lapack and blas as the above, see code prepending
+, qrupdate, arpack, suitesparse
 # If set to true, the above 5 deps are overridden to use the blas and lapack
 # with 64 bit indexes support. If all are not compatible, the build will fail.
 , use64BitIdx ? false
 , libwebp
 , gl2ps
-, ghostscript ? null
-, hdf5 ? null
-, glpk ? null
-, gnuplot ? null
+, ghostscript
+, hdf5
+, glpk
+, gnuplot
 # - Include support for GNU readline:
 , enableReadline ? true
-, readline ? null
+, readline
 # - Build Java interface:
 , enableJava ? true
-, jdk ? null
-, python ? null
-, overridePlatforms ? null
-, sundials ? null
+, jdk
+, python3
+, sundials
 # - Packages required for building extra packages.
 , newScope
 , callPackage
@@ -54,17 +50,13 @@
 , makeWrapper
 # - Build Octave Qt GUI:
 , enableQt ? false
-, qtbase ? null
-, qtsvg ? null
-, qtscript ? null
-, qscintilla ? null
-, qttools ? null
+, qt5
+, qscintilla
 , libiconv
 , darwin
 }:
 
 let
-
   # Not always evaluated
   blas' = if use64BitIdx then
     blas.override {
@@ -90,7 +82,7 @@ let
     blas = blas';
     lapack = lapack';
   };
-  # Not always suitesparse is required at all
+  # We keep the option to not enable suitesparse support by putting it null
   suitesparse' = if suitesparse != null then
     suitesparse.override {
       blas = blas';
@@ -99,24 +91,14 @@ let
   else
     null
   ;
-
-  octavePackages = import ../../../top-level/octave-packages.nix {
-    inherit pkgs;
-    inherit lib stdenv fetchurl newScope;
-    octave = self;
-  };
-
-  wrapOctave = callPackage ./wrap-octave.nix {
-    octave = self;
-    inherit (pkgs) makeSetupHook makeWrapper;
-  };
-
-  self = mkDerivation rec {
+  # To avoid confusion later in passthru
+  allPkgs = pkgs;
+in stdenv.mkDerivation (finalAttrs: {
     version = "8.3.0";
     pname = "octave";
 
     src = fetchurl {
-      url = "mirror://gnu/octave/${pname}-${version}.tar.gz";
+      url = "mirror://gnu/octave/octave-${finalAttrs.version}.tar.gz";
       sha256 = "sha256-K0gRHLZ7MSgX5dHz4XH1utFRK7Bn4WdLnEspKBiVuXo=";
     };
 
@@ -142,41 +124,35 @@ let
       arpack'
       libwebp
       gl2ps
-    ]
-    ++ lib.optionals enableQt [
-      qtbase
-      qtsvg
+      ghostscript
+      hdf5
+      glpk
+      suitesparse'
+      sundials
+      gnuplot
+      python3
+    ] ++ lib.optionals enableQt [
+      qt5.qtbase
+      qt5.qtsvg
       qscintilla
-    ]
-    ++ lib.optionals (ghostscript != null) [ ghostscript ]
-    ++ lib.optionals (hdf5 != null) [ hdf5 ]
-    ++ lib.optionals (glpk != null) [ glpk ]
-    ++ lib.optionals (suitesparse != null) [ suitesparse' ]
-    ++ lib.optionals (enableJava) [ jdk ]
-    ++ lib.optionals (sundials != null) [ sundials ]
-    ++ lib.optionals (gnuplot != null) [ gnuplot ]
-    ++ lib.optionals (python != null) [ python ]
-    ++ lib.optionals (!stdenv.isDarwin) [ libGL libGLU libX11 ]
-    ++ lib.optionals stdenv.isDarwin [
+    ] ++ lib.optionals (enableJava) [
+      jdk
+    ] ++ lib.optionals (!stdenv.isDarwin) [
+      libGL libGLU libX11
+    ] ++ lib.optionals stdenv.isDarwin [
       libiconv
       darwin.apple_sdk.frameworks.Accelerate
       darwin.apple_sdk.frameworks.Cocoa
-    ]
-    ;
+    ];
     nativeBuildInputs = [
       pkg-config
       gfortran
-      # Listed here as well because it's outputs are split
-      fftw
-      fftwSinglePrec
       texinfo
-    ]
-    ++ lib.optionals (sundials != null) [ sundials ]
-    ++ lib.optionals enableQt [
-      qtscript
-      qttools
-    ]
-    ;
+    ] ++ lib.optionals enableQt [
+      qt5.wrapQtAppsHook
+      qt5.qtscript
+      qt5.qttools
+    ];
 
     doCheck = !stdenv.isDarwin;
 
@@ -202,30 +178,39 @@ let
     # Keep a copy of the octave tests detailed results in the output
     # derivation, because someone may care
     postInstall = ''
-      cp test/fntests.log $out/share/octave/${pname}-${version}-fntests.log || true
+      cp test/fntests.log $out/share/octave/octave-${finalAttrs.version}-fntests.log || true
     '';
 
     passthru = rec {
-      sitePath = "share/octave/${version}/site";
+      sitePath = "share/octave/${finalAttrs.version}/site";
       octPkgsPath = "share/octave/octave_packages";
       blas = blas';
       lapack = lapack';
       qrupdate = qrupdate';
       arpack = arpack';
       suitesparse = suitesparse';
+      octavePackages = import ../../../top-level/octave-packages.nix {
+        pkgs = allPkgs;
+        inherit lib stdenv fetchurl newScope;
+        octave = finalAttrs.finalPackage;
+      };
+      wrapOctave = callPackage ./wrap-octave.nix {
+        octave = finalAttrs.finalPackage;
+        inherit (allPkgs) makeSetupHook makeWrapper;
+      };
       inherit fftw fftwSinglePrec;
       inherit portaudio;
       inherit jdk;
-      inherit python;
+      python = python3;
       inherit enableQt enableReadline enableJava;
       buildEnv = callPackage ./build-env.nix {
-        octave = self;
+        octave = finalAttrs.finalPackage;
         inherit octavePackages wrapOctave;
         inherit (octavePackages) computeRequiredOctavePackages;
       };
       withPackages = import ./with-packages.nix { inherit buildEnv octavePackages; };
       pkgs = octavePackages;
-      interpreter = "${self}/bin/octave";
+      interpreter = "${finalAttrs.finalPackage}/bin/octave";
     };
 
     meta = {
@@ -233,10 +218,5 @@ let
       license = lib.licenses.gpl3Plus;
       maintainers = with lib.maintainers; [ raskin doronbehar ];
       description = "Scientific Programming Language";
-      platforms = if overridePlatforms == null then
-        (lib.platforms.linux ++ lib.platforms.darwin)
-      else overridePlatforms;
     };
-  };
-
-in self
+  })