Create development environment based on shell.nix

When I create a shell environment with the command

$ nix-shell --pure -p postgresql

I get an environment with the command pg_ctl. But when I run nix-shell in a directory with a shell.nix file containing

	pkgs ? import <nixpkgs> {}

	buildinputs =

I get an environment without any of the pg_* tools. Why is that?

Because of the buildinputs attribute, you have to write the i for Inputs with a capital I, as in buildInputs.

1 Like

Thanks, now it works!

Does it exist any tool that find these kind of errors?

Not that I am aware of, also what makes it hard to detect those “errors” is, that any attribute you provide will be translated to an environment variable for the underlying derivation.

It is the build script in the derivation which attaches a meaning to those environment variables.

Coloured Syntax highlighting is always good to have. So depending on what editor/IDE you have there maybe a plugin.

Code completion/Code Suggestion are always nice too, there might be something in this list that fits the bill.

maybe nix-linter may also be able to help you in some cases.

1 Like

I opened PR adding a basic check for typos to nixpkgs-hammering: