-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
78 lines (75 loc) · 2.34 KB
/
flake.nix
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
{
description = "An FHS shell with mamba and cuda and miniconda for safety test.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, home-manager }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in {
devShell.x86_64-linux = (pkgs.buildFHSUserEnv {
name = "conda";
targetPkgs = pkgs: (
with pkgs; [
autoconf
binutils
cudatoolkit
curl
freeglut
gcc11
git
gitRepo
gnumake
gnupg
gperf
libGLU
libGL
libselinux
linuxPackages.nvidia_x11
m4
ncurses5
procps
stdenv.cc
unzip
util-linux
wget
xorg.libICE
xorg.libSM
xorg.libX11
xorg.libXext
xorg.libXi
xorg.libXmu
xorg.libXrandr
xorg.libXrender
xorg.libXv
zlib
micromamba
]
);
profile = ''
# cuda
export CUDA_PATH=${pkgs.cudatoolkit}
# export LD_LIBRARY_PATH=${pkgs.linuxPackages.nvidia_x11}/lib
export EXTRA_LDFLAGS="-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib"
export EXTRA_CCFLAGS="-I/usr/include"
export FONTCONFIG_FILE=/etc/fonts/fonts.conf
export QTCOMPOSE=${pkgs.xorg.libX11}/share/X11/locale
#micromamba
export MAMBA_ROOT_PREFIX=${builtins.getEnv "PWD"}/.mamba
eval "$(micromamba shell hook --shell=bash | sed 's/complete / # complete/g')"
if micromamba list -n pytorch > /dev/null 2>&1; then
echo "Activating existing 'pytorch' environment."
micromamba activate pytorch
#jupyter lab
else
echo "Creating new 'pytorch' environment."
micromamba create --yes -q -n pytorch
micromamba activate pytorch
micromamba install pytorch torchvision torchaudio pytorch-cuda=11.8 jupyter ipympl deepxde -c pytorch -c nvidia -c conda-forge
pip install matplotlib pandas seaborn scikit-learn tqdm catppuccin-jupyterlab neurodiffeq plotly kaleido
#jupyter lab
fi
'';
}).env;
};
}