forked from materialsinnovation/pymks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
36 lines (30 loc) · 1.23 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
#
# $ nix-shell --pure --arg withBoost false --argstr tag 20.09
#
{
tag ? "20.09",
withSfepy ? true,
}:
let
pkgs = import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/${tag}.tar.gz") {};
pypkgs = pkgs.python3Packages;
pymks = pypkgs.callPackage ./default.nix { sfepy=(if withSfepy then pypkgs.sfepy else null); };
linting = with pypkgs; [ black pylint flake8 ];
in
(pymks.overridePythonAttrs (old: rec {
propagatedBuildInputs = old.propagatedBuildInputs;
nativeBuildInputs = propagatedBuildInputs ++ linting;
postShellHook = ''
export OMPI_MCA_plm_rsh_agent=${pkgs.openssh}/bin/ssh
SOURCE_DATE_EPOCH=$(date +%s)
export PYTHONUSERBASE=$PWD/.local
export USER_SITE=`python -c "import site; print(site.USER_SITE)"`
export PYTHONPATH=$PYTHONPATH:$USER_SITE
export PATH=$PATH:$PYTHONUSERBASE/bin
jupyter nbextension install --py widgetsnbextension --user > /dev/null 2>&1
jupyter nbextension enable widgetsnbextension --user --py > /dev/null 2>&1
pip install jupyter_contrib_nbextensions --user > /dev/null 2>&1
jupyter contrib nbextension install --user > /dev/null 2>&1
jupyter nbextension enable spellchecker/main > /dev/null 2>&1
'';
}))