Add working python venv template and modified version using poetry
This commit is contained in:
parent
193245282a
commit
49d0c1b48f
|
@ -1,18 +0,0 @@
|
||||||
{ pkgs ? import <nixpkgs> {} }:
|
|
||||||
|
|
||||||
pkgs.stdenv.mkDerivation {
|
|
||||||
pname = "indica-notebook";
|
|
||||||
version = "1.0.0";
|
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
(python39.withPackages (ps: with ps; [
|
|
||||||
jupyter
|
|
||||||
]))
|
|
||||||
];
|
|
||||||
|
|
||||||
configurePhase = '''';
|
|
||||||
|
|
||||||
buildPhase = '''';
|
|
||||||
|
|
||||||
installPhase = '''';
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
{ tinypkgs ? import
|
|
||||||
(fetchTarball {
|
|
||||||
url = "https://gitlab.inria.fr/nix-tutorial/packages-repository/-/archive/master/packages-repository-8e43243635cd8f28c7213205b08c12f2ca2ac74d.tar.gz";
|
|
||||||
sha256 = "sha256:09l2w3m1z0308zc476ci0bsz5amm536hj1n9xzpwcjm59jxkqpqa";
|
|
||||||
})
|
|
||||||
{ }
|
|
||||||
}:
|
|
||||||
|
|
||||||
with tinypkgs; # Put tinypkgs's attributes in the current scope.
|
|
||||||
with pkgs; # Same for pkgs.
|
|
||||||
|
|
||||||
mkShell {
|
|
||||||
buildInputs = [
|
|
||||||
chord
|
|
||||||
|
|
||||||
# Defines a python + set of packages.
|
|
||||||
(python3.withPackages (ps: with ps; with python3Packages; [
|
|
||||||
jupyter
|
|
||||||
ipython
|
|
||||||
|
|
||||||
# Uncomment the following lines to make them available in the shell.
|
|
||||||
# pandas
|
|
||||||
# numpy
|
|
||||||
# matplotlib
|
|
||||||
]))
|
|
||||||
];
|
|
||||||
|
|
||||||
# Automatically run jupyter when entering the shell.
|
|
||||||
shellHook = "jupyter notebook";
|
|
||||||
}
|
|
24
templates/poetry.nix
Normal file
24
templates/poetry.nix
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{ pkgs ? import <nixpkgs> {}, python ? pkgs.python39, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
python-packages = ps: with ps; [
|
||||||
|
pip
|
||||||
|
setuptools
|
||||||
|
wheel
|
||||||
|
];
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
(python.withPackages python-packages)
|
||||||
|
poetry
|
||||||
|
git
|
||||||
|
zlib
|
||||||
|
libgccjit
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
export LD_LIBRARY_PATH="${pkgs.zlib}/lib:${pkgs.libgccjit}/lib"
|
||||||
|
[ ! -d "./.venv" ] && poetry install --sync
|
||||||
|
source .venv/bin/activate
|
||||||
|
'';
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
{ pkgs ? import <nixpkgs> { } }:
|
{ pkgs ? import <nixpkgs> {}, python ? pkgs.python39, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
python-packages = ps: with ps; [
|
python-packages = ps: with ps; [
|
||||||
|
@ -7,18 +7,17 @@ let
|
||||||
wheel
|
wheel
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
with pkgs;
|
pkgs.mkShell {
|
||||||
(buildFHSUserEnv {
|
nativeBuildInputs = with pkgs; [
|
||||||
name = "python";
|
(python.withPackages python-packages)
|
||||||
targetPkgs = pkgs: [ ];
|
git
|
||||||
multiPkgs = pkgs: [
|
zlib
|
||||||
zlib zlib-ng
|
libgccjit
|
||||||
(python39.withPackages python-packages)
|
|
||||||
];
|
];
|
||||||
runScript = ''
|
|
||||||
bash -c "{
|
shellHook = ''
|
||||||
python -m venv .venv
|
export LD_LIBRARY_PATH="${pkgs.zlib}/lib:${pkgs.libgccjit}/lib"
|
||||||
source .venv/bin/activate
|
python -m venv .venv
|
||||||
}"
|
source .venv/bin/activate
|
||||||
'';
|
'';
|
||||||
}).env
|
}
|
||||||
|
|
Loading…
Reference in a new issue