Add python and node virtualenvs

This commit is contained in:
Denis Lehmann 2019-01-07 15:47:29 +01:00
parent 9be402f81e
commit bb7d16565a
5 changed files with 40 additions and 1 deletions

View file

@ -2,4 +2,4 @@
This is a repository for different virtual environments, which can be used with the **Nix** package manager.
Just clone the content of the desired folder to your project, add your required packages to the `requirements.txt` file and run `nix-shell`.
Just clone the content of the desired folder to your project, add your required packages to the `*.txt` file and run `nix-shell`.

View file

@ -0,0 +1,19 @@
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "myNodeEnv";
buildInputs = with pkgs; [
nodejs
];
src = null;
shellHook = ''
mkdir -p .npm
if [ -s global_packages.txt ]; then
cat global_packages.txt | xargs npm install -g --prefix $PWD/.npm
fi
if [ -s package.json ]; then
npm install
fi
export PATH=$PWD/.npm/bin:$PATH
'';
}

View file

View file

@ -0,0 +1,20 @@
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "myPythonEnv";
buildInputs = with pkgs; [
python36Full
python36Packages.virtualenv
python36Packages.pip
];
src = null;
shellHook = ''
# set SOURCE_DATE_EPOCH so that we can use python wheels
SOURCE_DATE_EPOCH=$(date +%s)
virtualenv --no-setuptools venv
export PATH=$PWD/venv/bin:$PATH
if [ -s requirements.txt ]; then
pip install -r requirements.txt
fi
'';
}

View file