diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2016-11-08 12:42:53 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2016-11-08 12:44:49 +0100 |
commit | 9cdfb334017c6611ccd58880f9739e2649109ffa (patch) | |
tree | 362b35c4ef34ff977bc7ebe421eb6bf607ae18cb /doc | |
parent | a4f2d339feba9625aec71e136d8a30cd1f92f8ed (diff) | |
download | nixlib-9cdfb334017c6611ccd58880f9739e2649109ffa.tar nixlib-9cdfb334017c6611ccd58880f9739e2649109ffa.tar.gz nixlib-9cdfb334017c6611ccd58880f9739e2649109ffa.tar.bz2 nixlib-9cdfb334017c6611ccd58880f9739e2649109ffa.tar.lz nixlib-9cdfb334017c6611ccd58880f9739e2649109ffa.tar.xz nixlib-9cdfb334017c6611ccd58880f9739e2649109ffa.tar.zst nixlib-9cdfb334017c6611ccd58880f9739e2649109ffa.zip |
Docs: improve Python expressions
as it contained several mistakes and was just messy.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/languages-frameworks/python.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/doc/languages-frameworks/python.md b/doc/languages-frameworks/python.md index 127614a71b75..df60cc1e5738 100644 --- a/doc/languages-frameworks/python.md +++ b/doc/languages-frameworks/python.md @@ -655,9 +655,8 @@ when you try to install a second environment. Create a file, e.g. `build.nix`, with the following expression ```nix with import <nixpkgs> {}; -with python35Packages; -python.withPackages (ps: with ps; [ numpy ipython ]) +pkgs.python35.withPackages (ps: with ps; [ numpy ipython ]) ``` and install it in your profile with ``` @@ -669,14 +668,15 @@ Now you can use the Python interpreter, as well as the extra packages that you a If you prefer to, you could also add the environment as a package override to the Nixpkgs set. ``` - packageOverrides = pkgs: with pkgs; with python35Packages; { - myEnv = python.withPackages (ps: with ps; [ numpy ipython ]); + packageOverrides = pkgs: with pkgs; { + myEnv = python35.withPackages (ps: with ps; [ numpy ipython ]); }; ``` and install it in your profile with ``` -nix-env -iA nixos.blogEnv +nix-env -iA nixpkgs.myEnv ``` +We're installing using the attribute path and assume the channels is named `nixpkgs`. Note that I'm using the attribute path here. #### Environment defined in `/etc/nixos/configuration.nix` @@ -685,7 +685,7 @@ For the sake of completeness, here's another example how to install the environm ```nix environment.systemPackages = with pkgs; [ - (python35Packages.python.withPackages (ps: callPackage ../packages/common-python-packages.nix { pythonPackages = ps; })) + (python35.withPackages(ps: with ps; [ numpy ipython ])) ]; ``` |