-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
92 lines (82 loc) · 2.77 KB
/
flake.nix
File metadata and controls
92 lines (82 loc) · 2.77 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
{
description = "A Nix-flake-based Python development environment";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
version = "3.13";
in {
devShells = forEachSupportedSystem ({ pkgs }:
let
concatMajorMinor = v:
pkgs.lib.pipe v [
pkgs.lib.versions.splitVersion
(pkgs.lib.sublist 0 2)
pkgs.lib.concatStrings
];
python = pkgs."python${concatMajorMinor version}";
catppuccin-jupyterlab = python.pkgs.buildPythonPackage rec {
pname = "catppuccin_jupyterlab";
version = "0.2.4";
format = "wheel";
src = pkgs.fetchPypi {
inherit pname version;
format = "wheel";
python = "py3";
dist = "py3";
abi = "none";
platform = "any";
# sha256 (SRI) or base32 works:
hash = "sha256-ZDg5scRuk+SXvrledB1A3VhfxOSJpEwsbOiahpqc72c="; # <-- SRI works if you use 'hash'
};
doCheck = false;
};
# One unified Python environment for both Lab (frontend) and the theme
pythonEnv = python.withPackages (ps:
[
ps.jupyterlab
ps.ipykernel
ps.pandas
ps.numpy
ps.matplotlib
ps.seaborn
ps.plotly
ps.requests
ps.httpx
ps.scipy
ps.pyyaml
ps.pyarrow
ps.pytest
ps.pytest-cov
ps.flake8
ps.black
] #++ [ catppuccin-jupyterlab ]
);
in {
default = pkgs.mkShellNoCC {
# IMPORTANT: do NOT activate a venv here; it will shadow pythonEnv
packages = [
pythonEnv
pkgs.git
pkgs.uv
];
shellHook = ''
uv tool install specify-cli --from git+https://github.com/github/spec-kit.git
export PATH="$HOME/.local/bin:$PATH"
'';
postShellHook = ''
KERNEL_NAME="jl-313"
KERNEL_DIR="$HOME/.local/share/jupyter/kernels/$KERNEL_NAME"
if [ ! -d "$KERNEL_DIR" ]; then
python -m ipykernel install --user \
--name "$KERNEL_NAME" \
--display-name "Python 3.13 (flake)" >/dev/null
fi
'';
};
});
};
}