-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
82 lines (72 loc) · 2.78 KB
/
flake.nix
File metadata and controls
82 lines (72 loc) · 2.78 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
{
description = "Encoding texts as dense vectors";
inputs.nixpkgs.url = "nixpkgs/9b008d60392981ad674e04016d25619281550a9d";
outputs = { self, nixpkgs }:
let
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ self.overlays.default ];
config = {
allowUnfree = true;
cudaSupport = true;
};
};
pypkgs = pkgs.python3Packages;
pycu11pkgs = pkgs.pycu11.pkgs;
in {
overlays = {
default = import ./nix/overlay.nix {inherit self pkgs;};
cu11 = import ./nix/overlay-cu11.nix {inherit self pkgs;};
};
packages.x86_64-linux = {
default = pypkgs.doc_enc;
doc_enc_train = pypkgs.doc_enc_train;
doc_enc_cu11 = pycu11pkgs.doc_enc;
};
trainDockerImage = import ./nix/docker.nix {inherit pkgs;
doc-enc-pkg = pypkgs.doc_enc_train;
version=pypkgs.doc_enc_train.version;
name-suffix="_train";};
inferenceDockerImage = import ./nix/docker.nix {inherit pkgs;
doc-enc-pkg = pypkgs.doc_enc;
version=pypkgs.doc_enc.version;};
devShells.x86_64-linux =
let python-dev-hook =
''
#execute this hook only for interactive sessions
if [ -n "$PS1" ]; then
echo "Executing pythonDevHook"
eval "${pkgs.python3.interpreter} -m pip install -e . --prefix .dev --no-build-isolation >&2"
export PYTHONPATH=$(pwd)/.dev/${pkgs.python3.sitePackages}:$PYTHONPATH
export PATH=$(pwd)/.dev/bin:$PATH
export NIX_PYTHONPATH="$(pwd)/.dev/${pkgs.python3.sitePackages}:$NIX_PYTHONPATH"
fi
'';
common-hook = ''
#https://github.com/NixOS/nixpkgs/issues/11390
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/nvidia/current/:$LD_LIBRARY_PATH
'';
in {
default = pkgs.mkShell {
inputsFrom = [ pypkgs.doc_enc_train ];
buildInputs = [
pkgs.pyright
pkgs.nodePackages.bash-language-server
pkgs.shellcheck
pkgs.yamllint
pkgs.ruff
#pypkgs.pylint
pypkgs.black
pypkgs.pip
# pypkgs.debugpy
pypkgs.ipykernel
];
shellHook= python-dev-hook + common-hook;
};
cu11 = pkgs.mkShell {
inputsFrom = [ pycu11pkgs.doc_enc ];
shellHook= python-dev-hook + common-hook;
};
};
};
}