README: recommend overriding env over mkShell

Resolve #186.

The current documentation shows how to include dev-dependencies in
environment *or* add external dependencies to the environment, but I
suspect in the vast majority of cases both will be desired.
This commit is contained in:
ryneeverett 2021-09-27 12:48:29 -04:00
parent 2df09faeff
commit cd659414ca

View file

@ -110,7 +110,7 @@ in myAppEnv.env
``` ```
#### Example shell.nix with external dependencies #### Example shell.nix with external dependencies
For a shell environment including external dependencies, pass the app environment and dependency packages (for example, `pkgs.hello`) as build inputs to `pkgs.mkShell`. For a shell environment including external dependencies, override the `env` to add dependency packages (for example, `pkgs.hello`) as build inputs.
```nix ```nix
{ pkgs ? import <nixpkgs> {} }: { pkgs ? import <nixpkgs> {} }:
let let
@ -120,10 +120,9 @@ let
my-app = ./src; my-app = ./src;
}; };
}; };
in in myAppEnv.env.overrideAttrs (oldAttrs: {
pkgs.mkShell { buildInputs = [ pkgs.hello ]:
buildInputs = [ myAppEnv pkgs.hello ]; })
}
``` ```
### mkPoetryPackages ### mkPoetryPackages