nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenvNoCC,
4 fetchFromGitHub,
5 coreutils,
6 gnused,
7 postgresql,
8 makeWrapper,
9}:
10
11stdenvNoCC.mkDerivation rec {
12 pname = "psql2csv";
13 version = "0.12";
14
15 src = fetchFromGitHub {
16 owner = "fphilipe";
17 repo = "psql2csv";
18 rev = "v${version}";
19 hash = "sha256-XIdZ2+Jlw2JLn4KXD9h3+xXymu4FhibAfp5uGGkVwLQ=";
20 };
21
22 nativeBuildInputs = [ makeWrapper ];
23
24 dontConfigure = true;
25 dontBuild = true;
26
27 installPhase = ''
28 runHook preInstall
29
30 install -Dm755 -t $out/bin psql2csv
31 wrapProgram $out/bin/psql2csv \
32 --prefix PATH : ${
33 lib.makeBinPath [
34 coreutils
35 gnused
36 postgresql
37 ]
38 }
39
40 runHook postInstall
41 '';
42
43 meta = {
44 description = "Tool to run a PostreSQL query and output the result as CSV";
45 homepage = "https://github.com/fphilipe/psql2csv";
46 license = lib.licenses.mit;
47 maintainers = [ ];
48 inherit (postgresql.meta) platforms;
49 mainProgram = "psql2csv";
50 };
51}