Skip to content

Commit

Permalink
Docs: improve Python expressions
Browse files Browse the repository at this point in the history
as it contained several mistakes and was just messy.

(cherry picked from commit 9cdfb33)
  • Loading branch information
FRidh committed Nov 8, 2016
1 parent 8a5c376 commit 1db8b4a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions doc/languages-frameworks/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -669,9 +669,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
```
Expand All @@ -683,14 +682,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`
Expand All @@ -699,7 +699,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 ]))
];
```

Expand Down

0 comments on commit 1db8b4a

Please sign in to comment.