blob: d1c7bc956ed7da617d91061fcd780bba9db5ad74 (
plain)
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
|
{ pkgs, ... }:
let
mkShellDerivation = n: ps: pkgs.stdenvNoCC.mkDerivation rec {
name = n;
buildInputs = ps;
shellHook = ''
export NIX_SHELL_NAME="${name}"
'';
};
mkPythonShellDerivation = n: ps: init: pkgs.stdenvNoCC.mkDerivation rec {
name = n;
buildInputs = [(pkgs.python3.withPackages (python-packages: with python-packages; ps ++ [
jupyterlab
qtconsole
]))];
shellHook = let
startup = pkgs.writeTextFile {
name = "startup.py";
text = init;
};
in ''
export NIX_SHELL_NAME="${name}"
export PYTHONSTARTUP=${startup}
'';
};
jupyter = import (builtins.fetchGit {
url = https://github.com/tweag/jupyterWith;
rev = "35eb565c6d00f3c61ef5e74e7e41870cfa3926f7";
}) {};
mkJupyterEnv = kernel: jupyter.jupyterlabWith {
kernels = [ kernel ];
};
in {
custom.tasks = {
cpp_shell = {
description = "Generic C++ shell environment";
directory = "~/";
type = "environment";
environment = mkShellDerivation "cpp-env" (with pkgs; [
cmake
gcc10
gdb cgdb
universal-ctags
]);
};
latex_shell = {
description = "Generic LaTeX shell environment";
directory = "~/";
type = "environment";
environment = mkShellDerivation "latex-env" (with pkgs; [
tectonic
]);
};
pymath_jupyter = {
description = "Python for mathematics @ Jupyter Lab";
directory = "~/";
type = "jupyter-lab";
environment = mkJupyterEnv (
jupyter.kernels.iPythonWith {
name = "python";
packages = p: with p; [
numpy
sympy
scipy
matplotlib
];
}
);
};
};
}
|