nixpkgs/pkgs/applications/editors/jupyter-kernels/clojupyter/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
1.7 KiB
Nix
Raw Normal View History

2020-11-11 11:44:23 +00:00
{ pkgs
, stdenv
, lib
, jre
, fetchFromGitHub
, writeShellScript
, runCommand
, imagemagick
}:
# To test:
# $(nix-build --no-out-link -E 'with import <nixpkgs> {}; jupyter.override { definitions = { clojure = clojupyter.definition; }; }')/bin/jupyter-notebook
let
cljdeps = import ./deps.nix { inherit pkgs; };
classp = cljdeps.makeClasspaths {};
shellScript = writeShellScript "clojupyter" ''
${jre}/bin/java -cp ${classp} clojupyter.kernel.core "$@"
'';
pname = "clojupyter";
2022-05-12 15:26:00 +00:00
version = "0.3.3";
2020-11-11 11:44:23 +00:00
meta = with lib; {
description = "A Jupyter kernel for Clojure";
homepage = "https://github.com/clojupyter/clojupyter";
sourceProvenance = with sourceTypes; [ binaryBytecode ]; # deps from maven
2020-11-11 11:44:23 +00:00
license = licenses.mit;
maintainers = with maintainers; [ thomasjm ];
platforms = jre.meta.platforms;
};
sizedLogo = size: stdenv.mkDerivation {
name = "clojupyter-logo-${size}x${size}.png";
src = fetchFromGitHub {
owner = "clojupyter";
repo = "clojupyter";
2022-05-12 15:26:00 +00:00
rev = version;
sha256 = "sha256-BCzcPnLSonm+ELFU4JIIzLPlVnP0VzlrRSGxOd/LFow=";
2020-11-11 11:44:23 +00:00
};
buildInputs = [ imagemagick ];
dontConfigure = true;
dontInstall = true;
buildPhase = ''
convert ./resources/clojupyter/assets/logo-64x64.png -resize ${size}x${size} $out
'';
inherit meta;
};
in
rec {
launcher = runCommand "clojupyter" { inherit pname version meta shellScript; } ''
mkdir -p $out/bin
ln -s $shellScript $out/bin/clojupyter
'';
definition = {
displayName = "Clojure";
argv = [
"${launcher}/bin/clojupyter"
"{connection_file}"
];
language = "clojure";
logo32 = sizedLogo "32";
logo64 = sizedLogo "64";
};
}