Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 buildPgrxExtension,
3 cargo-pgrx_0_12_6,
4 fetchFromGitHub,
5 lib,
6 nix-update-script,
7 postgresql,
8 util-linux,
9}:
10buildPgrxExtension (finalAttrs: {
11 inherit postgresql;
12 cargo-pgrx = cargo-pgrx_0_12_6;
13
14 pname = "pgx_ulid";
15 version = "0.2.0";
16
17 src = fetchFromGitHub {
18 owner = "pksunkara";
19 repo = "pgx_ulid";
20 tag = "v${finalAttrs.version}";
21 hash = "sha256-VdLWwkUA0sVs5Z/Lyf5oTRhcHVzPmhgnYQhIM8MWJ0c=";
22 };
23
24 cargoHash = "sha256-OyrfwLMHn2aihfijHxE5oaz+XQC1HFlYbTp8Sw8RcK0=";
25
26 postInstall = ''
27 # Upstream renames the extension when packaging
28 # https://github.com/pksunkara/pgx_ulid/blob/084778c3e2af08d16ec5ec3ef4e8f345ba0daa33/.github/workflows/release.yml#L81
29 # Upgrade scripts should be added later, so we also rename them with wildcard
30 # https://github.com/pksunkara/pgx_ulid/issues/49
31 ${util-linux}/bin/rename pgx_ulid ulid $out/share/postgresql/extension/pgx_ulid*
32 '';
33
34 # pgrx tests try to install the extension into postgresql nix store
35 doCheck = false;
36
37 passthru = {
38 updateScript = nix-update-script { };
39 };
40
41 meta = {
42 # Support for PostgreSQL 13 was removed in 0.2.0: https://github.com/pksunkara/pgx_ulid/blob/084778c3e2af08d16ec5ec3ef4e8f345ba0daa33/CHANGELOG.md?plain=1#L6
43 broken = lib.versionOlder postgresql.version "14";
44 description = "ULID Postgres extension written in Rust";
45 homepage = "https://github.com/pksunkara/pgx_ulid";
46 changelog = "https://github.com/pksunkara/pgx_ulid/blob/v${finalAttrs.version}/CHANGELOG.md";
47 license = lib.licenses.mit;
48 maintainers = with lib.maintainers; [ myypo ];
49 };
50})