forked from AUTOMATIC1111/stable-diffusion-webui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
68 lines (62 loc) · 2.24 KB
/
default.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
{ pkgs ? import <nixpkgs> {
config = {
allowUnfree = true;
cudaSupport = true;
};
}}:
with pkgs;
let
pythonPackages = python310Packages;
nixGLSrc = builtins.fetchGit {
url = "https://github.com/guibou/nixGL";
rev = "7165ffbccbd2cf4379b6cd6d2edd1620a427e5ae";
};
nixGLDefault = (pkgs.callPackage nixGLSrc {}).auto.nixGLDefault;
nvidiaPackages = pkgs:
with pkgs; [
cudaPackages_10_2.cudatoolkit
cudaPackages.cudnn
nixGLDefault
];
requiredPackags = [
python310
git
stdenv
glib
conda
# pythonPackages.venvShellHook
# pythonPackages.fastapi
# pythonPackages.pytorch-bin
# pythonPackages.torchvision
# pythonPackages.tqdm
# pythonPackages.pip
# pythonPackages.setuptools
# pythonPackages.yapf
];
in pkgs.mkShell rec {
name = "Imagine.nvim-StableDiffusion";
#venvDir = ".venv";
#nrizq2w7q86fgpbmcx178vv5s4hxdlfa-hello.dr Required for building C extensions
CUDA_PATH = "${cudaPackages_10_2.cudatoolkit}";
LD_LIBRARY_PATH =
"${cudaPackages_10_2.cudatoolkit}/lib:${cudaPackages.cudnn}/lib:${cudaPackages_10_2.cudatoolkit.lib}/lib:${zlib}/lib:${stdenv.cc.cc.lib}/lib:/run/opengl-driver/lib:/run/opengl-driver-32/lib:/usr/lib:/usr/lib32:/run/opengl-driver/lib:/run/opengl-driver-32/lib:/usr/lib:/usr/lib32:${pkgs.glib.out}/lib:$LD_LIBRARY_PATH";
buildInputs = requiredPackags ++ (nvidiaPackages pkgs);
# # Run this command, only after creating the virtual environment
# postVenvCreation = ''
# export LD_LIBRARY_PATH=$(nixGL printenv LD_LIBRARY_PATH):$LD_LIBRARY_PATH:${R}/lib/R/lib:${readline}/lib
# unset SOURCE_DATE_EPOCH
# SOURCE_DATE_EPOCH=$(date +%s)
# pip install -r requirements.txt --no-cache-dir --prefer-binary
# pip install -e .
# pip install -r repositories/CodeFormer/requirements.txt --prefer-binary
# pip install -r repositories/CodeFormer/requirements.txt --prefer-binary
# '';
# Now we can execute any commands within the virtual environment.
# This is optional and can be left out to run pip manually.
postShellHook = ''
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${R}/lib/R/lib:${readline}/lib
# allow pip to install wheels
unset SOURCE_DATE_EPOCH
SOURCE_DATE_EPOCH=$(date +%s)
'';
}