Add python and node virtualenvs
This commit is contained in:
parent
9be402f81e
commit
bb7d16565a
5 changed files with 40 additions and 1 deletions
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
This is a repository for different virtual environments, which can be used with the **Nix** package manager.
|
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`.
|
||||||
|
|
|
||||||
19
node_environment/default.nix
Normal file
19
node_environment/default.nix
Normal 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
|
||||||
|
'';
|
||||||
|
}
|
||||||
0
node_environment/global_packages.txt
Normal file
0
node_environment/global_packages.txt
Normal file
20
python_environment/default.nix
Normal file
20
python_environment/default.nix
Normal 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
|
||||||
|
'';
|
||||||
|
}
|
||||||
0
python_environment/requirements.txt
Normal file
0
python_environment/requirements.txt
Normal file
Loading…
Add table
Add a link
Reference in a new issue