Skip to content

Commit

Permalink
coq_kernel: init at 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Dec 8, 2022
1 parent e613e99 commit 20b52df
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
58 changes: 58 additions & 0 deletions pkgs/applications/editors/jupyter-kernels/coq/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{ stdenv
, callPackage
, runCommand
, makeWrapper
, coq
, imagemagick
, python3
}:

# To test (in root nixpkgs dir):
# $(nix-build -E 'with import ./. {}; jupyter.override { definitions = { coq = coq-kernel.definition; }; }')/bin/jupyter-notebook

let
kernel = callPackage ./kernel.nix {};

in

rec {
launcher = runCommand "coq-kernel-launcher" {
inherit coq;
python = python3.withPackages (ps: [ ps.traitlets ps.jupyter_core ps.ipykernel kernel ]);
buildInputs = [ makeWrapper ];
} ''
mkdir -p $out/bin
makeWrapper $python/bin/python $out/bin/coq-kernel \
--add-flags "-m coq_jupyter" \
--suffix PATH : $coq/bin
'';

sizedLogo = size: stdenv.mkDerivation {
pname = "coq-logo-${size}x${size}.png";
inherit (coq) version;

src = coq.src;

buildInputs = [ imagemagick ];

dontConfigure = true;
dontInstall = true;

buildPhase = ''
convert ./ide/coqide/coq.png -resize ${size}x${size} $out
'';
};

definition = {
displayName = "Coq " + coq.version;
argv = [
"${launcher}/bin/coq-kernel"
"-f"
"{connection_file}"
];
language = "coq";
logo32 = sizedLogo "32";
logo64 = sizedLogo "64";
};
}
31 changes: 31 additions & 0 deletions pkgs/applications/editors/jupyter-kernels/coq/kernel.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{ lib
, fetchFromGitHub
, python3
, coq
}:

python3.pkgs.buildPythonPackage rec {
pname = "coq_jupyter";
version = "1.6.0";

src = fetchFromGitHub {
owner = "EugeneLoy";
repo = "coq_jupyter";
rev = "v${version}";
sha256 = "sha256-+Pp51cxeqjg5MW4CEccNWVjNcY9iyFNATIEage9RWJ0=";
};

propagatedBuildInputs = (with python3.pkgs; [ipykernel future]) ++ [coq];

nativeBuildInputs = [ coq ];

doCheck = false;

meta = with lib; {
homepage = "https://github.com/EugeneLoy/coq_jupyter";
description = "Jupyter kernel for Coq";
license = licenses.asl20;
maintainers = with maintainers; [ thomasjm ];
platforms = platforms.all;
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35852,6 +35852,8 @@ with pkgs;

coq2html = callPackage ../tools/typesetting/coq2html { };

coq-kernel = callPackage ../applications/editors/jupyter-kernels/coq { };

cryptoverif = callPackage ../applications/science/logic/cryptoverif { };

crypto-org-wallet = callPackage ../applications/blockchains/crypto-org-wallet { };
Expand Down

0 comments on commit 20b52df

Please sign in to comment.