a12l
November 15, 2020, 4:26pm
1
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> {}
}:
pkgs.mkShell
{
buildinputs =
[
pkgs.postgresql
];
}
I get an environment without any of the pg_*
tools. Why is that?
NobbZ
November 15, 2020, 9:08pm
2
Because of the buildinputs
attribute, you have to write the i
for Inputs
with a capital I
, as in buildInputs
.
1 Like
a12l
November 15, 2020, 10:01pm
3
Thanks, now it works!
Does it exist any tool that find these kind of errors?
NobbZ
November 15, 2020, 10:09pm
4
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.
https://nixos.wiki/wiki/Editor_Modes_for_Nix_Files
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.
https://github.com/Synthetica9/nix-linter
1 Like
I opened PR adding a basic check for typos to nixpkgs-hammering: https://github.com/jtojnar/nixpkgs-hammering/pull/29
2 Likes