/
default.nix
45 lines (39 loc) · 1.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
let
# Pinning nixpkgs to specific release
# To get sha256 use "nix-prefetch-git <url> --rev <commit>"
commitRev="5574b6a152b1b3ae5f93ba37c4ffd1981f62bf5a";
nixpkgs = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${commitRev}.tar.gz";
sha256 = "1pqdddp4aiz726c7qs1dwyfzixi14shp0mbzi1jhapl9hrajfsjg";
};
pkgs = import nixpkgs { config = { allowUnfree = true; }; };
pythonPackages = pkgs.python36Packages;
python-spinsfast = import example4/spinsfast.nix { pythonPackages = pythonPackages; };
my-local-hello-world = import example4/hello_world { };
in
pkgs.mkShell {
buildInputs = [
pythonPackages.numpy
pythonPackages.scipy
pythonPackages.jupyterlab
# for demo and notebooks
python-spinsfast
my-local-hello-world
pythonPackages.pythonix
pythonPackages.graphviz
pkgs.tree
];
shellHook = ''
if [ ! -f $HOME/.dockerbuildphase ]; then
touch $HOME/.dockerbuildphase
export DOCKER_BUILD_PHASE=true
fi
if [ "$DOCKER_BUILD_PHASE" = true ]; then
echo "Do some action in build phase"
fi
if [ "$DOCKER_BUILD_PHASE" = false ]; then
echo "Do some action in run phase like start db"
fi
echo "Do some action in both phases"
'';
}