-
Notifications
You must be signed in to change notification settings - Fork 19
/
default.nix
48 lines (43 loc) · 1.68 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
46
47
48
argsOuter@{...}:
let
# specifying args defaults in this slightly non-standard way to allow us to include the default values in `args`
args = rec {
pkgs = import <nixpkgs> {};
pythonPackages = pkgs.python36Packages;
forDev = true;
localOverridesPath = ./local.nix;
} // argsOuter;
in (with args; {
digitalMarketplaceFrameworksEnv = (pkgs.stdenv.mkDerivation rec {
name = "digitalmarketplace-frameworks-env";
shortName = "dm-fwks";
buildInputs = [
pythonPackages.python
pkgs.glibcLocales
pkgs.libffi
pkgs.libyaml
# pip requires git to fetch some of its dependencies
pkgs.git
# for `cryptography`
pkgs.openssl
] ++ pkgs.stdenv.lib.optionals forDev ([
] ++ pkgs.stdenv.lib.optionals pkgs.stdenv.isDarwin [
]
);
hardeningDisable = pkgs.stdenv.lib.optionals pkgs.stdenv.isDarwin [ "format" ];
GIT_SSL_CAINFO="${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
VIRTUALENV_ROOT = "venv${pythonPackages.python.pythonVersion}";
VIRTUAL_ENV_DISABLE_PROMPT = "1";
SOURCE_DATE_EPOCH = "315532800";
# if we don't have this, we get unicode troubles in a --pure nix-shell
LANG="en_GB.UTF-8";
shellHook = ''
export PS1="\[\e[0;36m\](nix-shell\[\e[0m\]:\[\e[0;36m\]${shortName})\[\e[0;32m\]\u@\h\[\e[0m\]:\[\e[0m\]\[\e[0;36m\]\w\[\e[0m\]\$ "
if [ ! -e $VIRTUALENV_ROOT ]; then
${pythonPackages.python}/bin/python -m venv $VIRTUALENV_ROOT
fi
source $VIRTUALENV_ROOT/bin/activate
make requirements${pkgs.stdenv.lib.optionalString forDev "-dev"}
'';
}).overrideAttrs (if builtins.pathExists localOverridesPath then (import localOverridesPath args) else (x: x));
})