diff --git a/pkgs/applications/editors/jupyter-kernels/wolfram/default.nix b/pkgs/applications/editors/jupyter-kernels/wolfram/default.nix new file mode 100644 index 000000000000..2d00d6e1fc2e --- /dev/null +++ b/pkgs/applications/editors/jupyter-kernels/wolfram/default.nix @@ -0,0 +1,22 @@ +{ callPackage +, wolfram-engine +}: + +# To test: +# $(nix-build -E 'with import ./. {}; jupyter.override { definitions = { wolfram = wolfram-for-jupyter-kernel.definition; }; }')/bin/jupyter-notebook +let kernel = callPackage ./kernel.nix {}; +in { + definition = { + displayName = "Wolfram Language ${wolfram-engine.version}"; + argv = [ + "${wolfram-engine}/bin/wolfram" + "-script" + "${kernel}/share/Wolfram/WolframLanguageForJupyter/Resources/KernelForWolframLanguageForJupyter.wl" + "{connection_file}" + "ScriptInstall" # suppresses prompt + ]; + language = "Wolfram Language"; + logo32 = "${wolfram-engine}/share/icons/hicolor/32x32/apps/wolfram-wolframlanguage.png"; + logo64 = "${wolfram-engine}/share/icons/hicolor/64x64/apps/wolfram-wolframlanguage.png"; + }; +} diff --git a/pkgs/applications/editors/jupyter-kernels/wolfram/kernel.nix b/pkgs/applications/editors/jupyter-kernels/wolfram/kernel.nix new file mode 100644 index 000000000000..65b02bac59b8 --- /dev/null +++ b/pkgs/applications/editors/jupyter-kernels/wolfram/kernel.nix @@ -0,0 +1,32 @@ +{ stdenv, lib, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "wolfram-for-jupyter-kernel"; + version = "0.9.2"; + + src = fetchFromGitHub { + owner = "WolframResearch"; + repo = "WolframLanguageForJupyter"; + rev = "v${version}"; + sha256 = "19d9dvr0bv7iy0x8mk4f576ha7z7h7id39nyrggwf9cp7gymxf47"; + }; + + dontConfigure = true; + + installPhase = '' + patchShebangs ./configure-jupyter.wls + mkdir -p $out/share/Wolfram + cp -r {WolframLanguageForJupyter,images,extras,LICENSE} $out/share/Wolfram + ''; + + # no tests + doCheck = false; + + meta = with lib; { + description = "A Jupyter kernel for Wolfram Language."; + homepage = "https://github.com/WolframResearch/WolframLanguageForJupyter"; + license = licenses.mit; + maintainers = with maintainers; [ fbeffa ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/applications/science/math/wolfram-engine/notebook.nix b/pkgs/applications/science/math/wolfram-engine/notebook.nix new file mode 100644 index 000000000000..85570eeca7fb --- /dev/null +++ b/pkgs/applications/science/math/wolfram-engine/notebook.nix @@ -0,0 +1,9 @@ +{ lib, stdenv, writeScriptBin, jupyter, wolfram-for-jupyter-kernel }: + +let + wolfram-jupyter = jupyter.override { definitions = { wolfram = wolfram-for-jupyter-kernel.definition; }; }; +in + writeScriptBin "wolfram-notebook" '' + #! ${stdenv.shell} + ${wolfram-jupyter}/bin/jupyter-notebook + '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ff933dd1867a..114e26a92f3c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -32637,6 +32637,10 @@ with pkgs; wolfram-engine = callPackage ../applications/science/math/wolfram-engine { }; + wolfram-for-jupyter-kernel = callPackage ../applications/editors/jupyter-kernels/wolfram { }; + + wolfram-notebook = callPackage ../applications/science/math/wolfram-engine/notebook.nix { }; + ipopt = callPackage ../development/libraries/science/math/ipopt { }; gmsh = callPackage ../applications/science/math/gmsh { };