nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchNpmDeps,
6
7 # build-system
8 hatch-deps-selector,
9 hatch-jupyter-builder,
10 hatch-nodejs-version,
11 hatchling,
12
13 # nativeBuildInputs
14 nodejs,
15 npmHooks,
16
17 # dependencies
18 jupyter-core,
19 jupyter-server,
20 ipykernel,
21 nodeenv,
22
23 # tests
24 versionCheckHook,
25}:
26
27buildPythonPackage (finalAttrs: {
28 pname = "jupyter-book";
29 version = "2.1.3";
30 pyproject = true;
31
32 src = fetchFromGitHub {
33 owner = "jupyter-book";
34 repo = "jupyter-book";
35 tag = "v${finalAttrs.version}";
36 hash = "sha256-RFISKdBziLHeyB+942PeBYR0kxrRFLgg3sn5laYk3qM=";
37 };
38
39 npmDeps = fetchNpmDeps {
40 inherit (finalAttrs) src;
41 hash = "sha256-5qVmVQ3k1LOjN4qsTxHzWmJmJWu2mv/a3s+7N7dZUxc=";
42 };
43
44 build-system = [
45 hatch-deps-selector
46 hatch-jupyter-builder
47 hatch-nodejs-version
48 hatchling
49 ];
50
51 nativeBuildInputs = [
52 nodejs
53 npmHooks.npmConfigHook
54 ];
55
56 # jupyter-book requires node at runtime
57 propagatedBuildInputs = [
58 nodejs
59 ];
60
61 dependencies = [
62 ipykernel
63 jupyter-core
64 jupyter-server
65 nodeenv
66 ];
67
68 pythonImportsCheck = [ "jupyter_book" ];
69
70 # No python tests
71 nativeCheckInputs = [
72 versionCheckHook
73 ];
74 versionCheckProgramArg = "--version";
75
76 meta = {
77 description = "Build a book with Jupyter Notebooks and Sphinx";
78 homepage = "https://jupyterbook.org/";
79 changelog = "https://github.com/jupyter-book/jupyter-book/blob/${finalAttrs.src.tag}/CHANGELOG.md";
80 license = lib.licenses.bsd3;
81 teams = [ lib.teams.jupyter ];
82 mainProgram = "jupyter-book";
83 };
84})