summaryrefslogtreecommitdiff
path: root/pkgs/servers/sql/postgresql/ext/pgx_ulid.nix
blob: 9de14b0f0e4f3087fbd4f4f3e7ddf534b8554777 (plain)
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
{
  buildPgrxExtension,
  cargo-pgrx_0_17_0,
  fetchFromGitHub,
  lib,
  nix-update-script,
  postgresql,
  util-linux,
}:
buildPgrxExtension (finalAttrs: {
  inherit postgresql;
  cargo-pgrx = cargo-pgrx_0_17_0;

  pname = "pgx_ulid";
  version = "0.2.3";

  src = fetchFromGitHub {
    owner = "pksunkara";
    repo = "pgx_ulid";
    tag = "v${finalAttrs.version}";
    hash = "sha256-j4whXsKyDiV+3F5Xp5Q5vODT7LGS4IVz4VfrhsyYw14=";
  };

  cargoHash = "sha256-oQTetxtIqrVqSDcO8GEMAJ20/RKyYoBAIVflAcWHrPA=";

  postInstall = ''
    # Upstream renames the extension when packaging as well as upgrade scripts
    # https://github.com/pksunkara/pgx_ulid/blob/master/.github/workflows/release.yml#L80
    ${util-linux}/bin/rename pgx_ulid ulid $out/share/postgresql/extension/pgx_ulid*
  '';

  # pgrx tests try to install the extension into postgresql nix store
  doCheck = false;

  passthru = {
    updateScript = nix-update-script { };
  };

  meta = {
    description = "ULID Postgres extension written in Rust";
    homepage = "https://github.com/pksunkara/pgx_ulid";
    changelog = "https://github.com/pksunkara/pgx_ulid/blob/v${finalAttrs.version}/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [
      myypo
      typedrat
    ];
  };
})