about summary refs log tree commit diff
path: root/pkgs/development/tools/database/pgweb/default.nix
blob: 9fa1436bee1b6ea5899b151b5a6363ae00419d0c (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
{ lib
, buildGoModule
, fetchFromGitHub
, testers
, pgweb
}:

buildGoModule rec {
  pname = "pgweb";
  version = "0.15.0";

  src = fetchFromGitHub {
    owner = "sosedoff";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-n8MFYwne25MdzVwYmmXt9d9rqKU37patAazb3Wn9coM=";
  };

  postPatch = ''
    # Disable tests require network access.
    rm -f pkg/client/{client,dump}_test.go
  '';

  vendorHash = "sha256-Jpvf6cST3kBvYzCQLoJ1fijUC/hP1ouptd2bQZ1J/Lo=";

  ldflags = [ "-s" "-w" ];

  checkFlags =
    let
      skippedTests = [
        # There is a `/tmp/foo` file on the test machine causing the test case to fail on macOS
        "TestParseOptions"
      ];
    in
    [ "-skip" "${builtins.concatStringsSep "|" skippedTests}" ];

    passthru.tests.version = testers.testVersion {
      version = "v${version}";
      package = pgweb;
      command = "pgweb --version";
    };

  meta = with lib; {
    changelog = "https://github.com/sosedoff/pgweb/releases/tag/v${version}";
    description = "A web-based database browser for PostgreSQL";
    longDescription = ''
      A simple postgres browser that runs as a web server. You can view data,
      run queries and examine tables and indexes.
    '';
    homepage = "https://sosedoff.github.io/pgweb/";
    license = licenses.mit;
    mainProgram = "pgweb";
    maintainers = with maintainers; [ zupo luisnquin ];
  };
}