-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
121 lines (105 loc) · 3.19 KB
/
Copy pathflake.nix
File metadata and controls
121 lines (105 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# SPDX-FileCopyrightText: 2026 Kirill Elagin <https://kir.elagin.me/>
#
# SPDX-License-Identifier: MPL-2.0 OR MIT
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/26.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
let
inherit (nixpkgs) lib;
in {
lib = import ./jupyter/lib.nix { inherit lib; };
templates = {
default = self.templates.all-kernels;
all-kernels = {
path = ./templates/all-kernels;
description = "A basic template with all available kernel types";
welcomeText = ''
# A basic jupyter.nix template for configuring different kernel types
## Customise
Edit `flake.nix`, see the comments for the most common configuration options
for the various kernel types available.
## Then start Jupyter Lab
```
$ nix run
```
'';
};
};
} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
packages = rec {
default = jupyter-ipykernel;
jupyter-ipykernel = self.lib.makeJupyterLab {
inherit pkgs;
kernels = {
"python3".ipykernel = {
packages = pp: with pp; [
numpy
polars
requests
scipy
];
withPlotly = true;
};
};
};
jupyter-ihaskell = self.lib.makeJupyterLab {
inherit pkgs;
kernels = {
"Haskell".ihaskell = {
packages = hp: with hp; [
aeson
ihaskell-aeson
];
rtsOptions = [ "-M3g" "-N2" ];
};
};
};
};
checks = {
eval-lib = pkgs.writeText "eval-lib" (builtins.deepSeq self.lib "OK");
reuse = pkgs.runCommand "reuse-lint" {
nativeBuildInputs = [ pkgs.reuse ];
} ''reuse --root ${./.} lint > "$out"'';
builtin-kernel-types = self.lib.makeJupyterLab {
inherit pkgs;
kernels = {
"kernelspec".kernelspec = {
spec = {
argv = [ "echo" "hello" ];
display_name = "kernelspec test";
language = "none";
};
};
"ipykernel".ipykernel = { };
"ihaskell".ihaskell = { };
};
};
custom-dir-kernel =
let
dir-kernel = {
config.outDir = self.lib.buildKernelSpec pkgs "dir-kernel" {
argv = [ "echo" "hello" ];
display_name = "kernelspec test";
language = "none";
};
};
in
self.lib.makeJupyterLab {
inherit pkgs;
kernelTypes = {
inherit dir-kernel;
};
kernels = {
"custom-dir-kernel".dir-kernel = { };
};
};
};
}
);
}