diff --git a/templates/indica.nix b/templates/indica.nix deleted file mode 100644 index 9e28641d..00000000 --- a/templates/indica.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ pkgs ? import {} }: - -pkgs.stdenv.mkDerivation { - pname = "indica-notebook"; - version = "1.0.0"; - - buildInputs = with pkgs; [ - (python39.withPackages (ps: with ps; [ - jupyter - ])) - ]; - - configurePhase = ''''; - - buildPhase = ''''; - - installPhase = ''''; -} diff --git a/templates/jupyter.nix b/templates/jupyter.nix deleted file mode 100644 index 9c7ebe16..00000000 --- a/templates/jupyter.nix +++ /dev/null @@ -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"; -} diff --git a/templates/poetry.nix b/templates/poetry.nix new file mode 100644 index 00000000..b9724b32 --- /dev/null +++ b/templates/poetry.nix @@ -0,0 +1,24 @@ +{ pkgs ? import {}, 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 + ''; +} diff --git a/templates/python.nix b/templates/python.nix index bfb4071f..b9193c90 100644 --- a/templates/python.nix +++ b/templates/python.nix @@ -1,4 +1,4 @@ -{ pkgs ? import { } }: +{ pkgs ? import {}, python ? pkgs.python39, ... }: let python-packages = ps: with ps; [ @@ -7,18 +7,17 @@ let wheel ]; in -with pkgs; -(buildFHSUserEnv { - name = "python"; - targetPkgs = pkgs: [ ]; - multiPkgs = pkgs: [ - zlib zlib-ng - (python39.withPackages python-packages) +pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + (python.withPackages python-packages) + git + zlib + libgccjit ]; - runScript = '' - bash -c "{ - python -m venv .venv - source .venv/bin/activate - }" + + shellHook = '' + export LD_LIBRARY_PATH="${pkgs.zlib}/lib:${pkgs.libgccjit}/lib" + python -m venv .venv + source .venv/bin/activate ''; -}).env +}