From 7eddc92374f873a909b1b1cdc14c1dc5c306ce08 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Sat, 9 Nov 2019 10:25:57 +0100 Subject: [PATCH] documentation: show combining python35.withPackages and mkShell this had me stumped - thanks to adisbladis on irc --- doc/languages-frameworks/python.section.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index 02bff8666e29..1bedebd11902 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -144,6 +144,24 @@ What's happening here? 2. Then we create a Python 3.5 environment with the `withPackages` function. 3. The `withPackages` function expects us to provide a function as an argument that takes the set of all python packages and returns a list of packages to include in the environment. Here, we select the packages `numpy` and `toolz` from the package set. +To combine this with `mkShell` you can: + +```nix +with import {}; + +let + pythonEnv = python35.withPackages (ps: [ + ps.numpy + ps.toolz + ]); +in mkShell { + buildInputs = [ + pythonEnv + hello + ]; +} +``` + ##### Execute command with `--run` A convenient option with `nix-shell` is the `--run` option, with which you can execute a command in the `nix-shell`. We can