-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
56 lines (46 loc) · 1.43 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ sources ? import ./nix/sources.nix
, pkgs ? import sources.nixpkgs { overlays = [ ]; config = { }; }
}:
with pkgs;
let
lib = import <nixpkgs/lib>;
inherit (lib) optional optionals;
basePackages = with pkgs; [
(python310.withPackages (ps: with ps; [ pynvim pip virtualenv ]))
# Without this, we see a whole bunch of warnings about LANG, LC_ALL and locales in general.
# The solution is from: https://github.com/NixOS/nix/issues/318#issuecomment-52986702
glibcLocales
coreutils
git
];
requiredPackages = basePackages
++ lib.optional stdenv.isLinux inotify-tools
++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
CoreFoundation
CoreServices
]);
env = buildEnv {
name = "dev-environment";
paths = requiredPackages;
};
in
stdenv.mkDerivation rec {
name = "bazix-environment";
phases = [ "nobuild" ];
buildInputs = [ env ];
shellHook = ''
if [[ ! -d venv ]]; then
pip freeze | grep "virtualenv" &> /dev/null || pip install virtualenv
python -m virtualenv venv --download
source venv/bin/activate
else
source venv/bin/activate
fi
pip install -r ./requirements/dev-requirements.lock.txt
'';
enableParallelBuilding = true;
LOCALE_ARCHIVE = if stdenv.isLinux then "${glibcLocales}/lib/locale/locale-archive" else "";
nobuild = ''
echo Do not run this derivation with nix-build, it can only be used with nix-shell
'';
}