-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
37 lines (32 loc) · 858 Bytes
/
shell.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
{ pkgsnix ? import ./pkgs.nix
, pkgs ? pkgsnix.pkgs
, unstable ? pkgsnix.unstable
, isDocker ? false
}:
with pkgs; let
commonBuildInputs = [
stdenv.cc.cc.lib
python311
];
devBuildInputs = [
gnumake
pipenv
unstable.ruff
];
commonShellHook = ''
'';
devShellHook = ''
export LD_LIBRARY_PATH="${lib.makeLibraryPath commonBuildInputs}:$LD_LIBRARY_PATH"
export PIPENV_VENV_IN_PROJECT=1
export PIPENV_VERBOSITY=-1
[ ! -e .venv/bin/python ] && [ -h .venv/bin/python ] && rm -r .venv
[ ! -f .venv/bin/activate ] && pipenv sync --dev
case $- in *i*) exec pipenv shell --fancy;; esac
'';
dockerShellHook = ''
'';
in
pkgs.mkShell {
buildInputs = commonBuildInputs ++ (if isDocker then [ ] else devBuildInputs);
shellHook = commonShellHook + (if isDocker then dockerShellHook else devShellHook);
}