about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/pg/pgcopydb/package.nix
blob: b65d5ca77b095934f799082a6ffb724f28bf5d04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ lib
, stdenv
, fetchFromGitHub
, libkrb5
, openssl
, pam
, pkg-config
, postgresql
, readline
, sqlite
, testers
, zlib
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "pgcopydb";
  version = "0.15";

  src = fetchFromGitHub {
    owner = "dimitri";
    repo = "pgcopydb";
    rev = "v${finalAttrs.version}";
    hash = "sha256-m9iIF8h6V3wWLUQuPntXtRAh16RrmR3uqZZIljGCY08=";
  };

  nativeBuildInputs = [
    pkg-config
  ];

  buildInputs = [
    libkrb5
    openssl
    postgresql
    readline
    sqlite
    zlib
  ] ++ lib.optionals stdenv.isLinux [
    pam
  ];

  hardeningDisable = [ "format" ];

  installPhase = ''
    runHook preInstall

    install -D -t $out/bin/ src/bin/pgcopydb/pgcopydb

    runHook postInstall
  '';

  passthru.tests = {
    version = testers.testVersion {
      package = finalAttrs.finalPackage;
    };
  };

  meta = with lib; {
    description = "Copy a Postgres database to a target Postgres server (pg_dump | pg_restore on steroids";
    homepage = "https://github.com/dimitri/pgcopydb";
    changelog = "https://github.com/dimitri/pgcopydb/blob/${finalAttrs.src.rev}/CHANGELOG.md";
    license = licenses.postgresql;
    maintainers = with maintainers; [ marsam ];
    mainProgram = "pgcopydb";
    platforms = platforms.all;
  };
})