1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 testers,
6 pgweb,
7 nixosTests,
8}:
9
10buildGoModule rec {
11 pname = "pgweb";
12 version = "0.16.2";
13
14 src = fetchFromGitHub {
15 owner = "sosedoff";
16 repo = "pgweb";
17 rev = "v${version}";
18 hash = "sha256-gZK8+H3dBMzSVyE96E7byihKMR4+1YlVFZJtCTGUZwI=";
19 };
20
21 postPatch = ''
22 # Disable tests require network access.
23 rm -f pkg/client/{client,dump}_test.go
24 '';
25
26 vendorHash = "sha256-Jpvf6cST3kBvYzCQLoJ1fijUC/hP1ouptd2bQZ1J/Lo=";
27
28 ldflags = [
29 "-s"
30 "-w"
31 ];
32
33 checkFlags =
34 let
35 skippedTests = [
36 # There is a `/tmp/foo` file on the test machine causing the test case to fail on macOS
37 "TestParseOptions"
38 ];
39 in
40 [
41 "-skip"
42 "${builtins.concatStringsSep "|" skippedTests}"
43 ];
44
45 passthru.tests = {
46 version = testers.testVersion {
47 version = "v${version}";
48 package = pgweb;
49 command = "pgweb --version";
50 };
51 integration_test = nixosTests.pgweb;
52 };
53
54 meta = {
55 changelog = "https://github.com/sosedoff/pgweb/releases/tag/v${version}";
56 description = "Web-based database browser for PostgreSQL";
57 longDescription = ''
58 A simple postgres browser that runs as a web server. You can view data,
59 run queries and examine tables and indexes.
60 '';
61 homepage = "https://sosedoff.github.io/pgweb/";
62 license = lib.licenses.mit;
63 mainProgram = "pgweb";
64 maintainers = with lib.maintainers; [
65 zupo
66 luisnquin
67 ];
68 };
69}