Melle
Melle

Reputation: 8367

How to install postgresql-client / psql on Nixos

I'm wondering how to install the psql command on NixOS. To be clear: I'm only interested in the client, not the server.

I've looked at the derivation but couldn't find any pointers.

Is there a way to create a derivation without building from source?

Thanks!

Upvotes: 6

Views: 3278

Answers (2)

jla
jla

Reputation: 10174

Instead of installing the package you can also use nix shell / run, and define a shell alias:

alias psql="nix shell nixpkgs#postgresql --command psql"

Upvotes: 3

infinisil
infinisil

Reputation: 1876

The psql command is in any of the postgresql* packages, so you can just add that to environment.systemPackages and rebuild:

environment.systemPackages = [ pkgs.postgresql ];

Upvotes: 8

Related Questions