How to install postgresql-client / psql on Nixos
Asked Answered
U

2

6

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!

Ulmaceous answered 13/9, 2018 at 20:56 Comment(1)
You've found the NixOS module. The derivation is here.. It does not define a client-only derivation. I have double checked with nix repl '<nixpkgs>'.Cq
H
8

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 ];
Hugmetight answered 16/9, 2018 at 21:21 Comment(0)
S
3

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"
Sesquialtera answered 7/8, 2022 at 21:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.