init: octave-kernel at 0.32.0

This commit is contained in:
Tom McLaughlin 2021-06-20 13:56:50 -07:00
parent d026185c79
commit 30013a6174
3 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,60 @@
{ lib
, stdenv
, callPackage
, runCommand
, makeWrapper
, octave
, imagemagick
, python3
}:
# To test:
# $(nix-build -E 'with import <nixpkgs> {}; jupyter.override { definitions = { octave = octave-kernel.definition; }; }')/bin/jupyter-notebook
let
kernel = callPackage ./kernel.nix {
python3Packages = python3.pkgs;
};
in
rec {
launcher = runCommand "octave-kernel-launcher" {
inherit octave;
python = python3.withPackages (ps: [ ps.traitlets ps.jupyter_core ps.ipykernel ps.metakernel kernel ]);
buildInputs = [ makeWrapper ];
} ''
mkdir -p $out/bin
makeWrapper $python/bin/python $out/bin/octave-kernel \
--add-flags "-m octave_kernel" \
--suffix PATH : $octave/bin
'';
sizedLogo = size: stdenv.mkDerivation {
name = ''octave-logo-${octave.version}-${size}x${size}.png'';
src = octave.src;
buildInputs = [ imagemagick ];
dontConfigure = true;
dontInstall = true;
buildPhase = ''
convert ./libgui/src/icons/logo.png -resize ${size}x${size} $out
'';
};
definition = {
displayName = "Octave";
argv = [
"${launcher}/bin/octave-kernel"
"-f"
"{connection_file}"
];
language = "octave";
logo32 = sizedLogo "32";
logo64 = sizedLogo "64";
};
}

View File

@ -0,0 +1,30 @@
{ lib, octave, python3Packages }:
with python3Packages;
buildPythonPackage rec {
pname = "octave-kernel";
version = "0.32.0";
src = fetchPypi {
pname = "octave_kernel";
inherit version;
sha256 = "0dfbxfcf3bz4jswnpkibnjwlkgy0y4j563nrhaqxv3nfa65bksif";
};
propagatedBuildInputs = [ metakernel ipykernel ];
# Tests require jupyter_kernel_test to run, but it hasn't seen a
# release since 2017 and seems slightly abandoned.
# Doing fetchPypi on it doesn't work, even though it exists here:
# https://pypi.org/project/jupyter_kernel_test/.
doCheck = false;
meta = with lib; {
description = "A Jupyter kernel for Octave.";
homepage = "https://github.com/Calysto/octave_kernel";
license = licenses.bsd3;
maintainers = with maintainers; [ thomasjm ];
platforms = platforms.all;
};
}

View File

@ -12095,6 +12095,8 @@ in
overridePlatforms = ["x86_64-linux" "x86_64-darwin"];
};
octave-kernel = callPackage ../applications/editors/jupyter-kernels/octave { };
octavePackages = recurseIntoAttrs octave.pkgs;
ocropus = callPackage ../applications/misc/ocropus { };