Skip to content

Commit acc0bf9

Browse files
authored
Merge branch 'develop' into feat/reland-vault-wo-pgsodium
2 parents 04eb114 + 70657e2 commit acc0bf9

File tree

8 files changed

+148
-74
lines changed

8 files changed

+148
-74
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ Unmodified Postgres with some useful plugins. Our goal with this repo is not to
1616
| [hypopg](https://github.com/HypoPG/hypopg/archive/refs/tags/1.4.1.tar.gz) | [1.4.1](https://github.com/HypoPG/hypopg/archive/refs/tags/1.4.1.tar.gz) | Hypothetical Indexes for PostgreSQL |
1717
| [index_advisor](https://github.com/olirice/index_advisor/archive/v0.2.0.tar.gz) | [0.2.0](https://github.com/olirice/index_advisor/archive/v0.2.0.tar.gz) | Recommend indexes to improve query performance in PostgreSQL |
1818
| [pg-safeupdate](https://github.com/eradman/pg-safeupdate/archive/1.4.tar.gz) | [1.4](https://github.com/eradman/pg-safeupdate/archive/1.4.tar.gz) | A simple extension to PostgreSQL that requires criteria for UPDATE and DELETE |
19-
| [pg_backtrace](https://github.com/pashkinelfe/pg_backtrace/archive/d100bac815a7365e199263f5b3741baf71b14c70.tar.gz) | [1.1](https://github.com/pashkinelfe/pg_backtrace/archive/d100bac815a7365e199263f5b3741baf71b14c70.tar.gz) | Updated fork of pg_backtrace |
2019
| [pg_cron](https://github.com/citusdata/pg_cron/archive/v1.6.4.tar.gz) | [1.6.4](https://github.com/citusdata/pg_cron/archive/v1.6.4.tar.gz) | Run Cron jobs through PostgreSQL |
21-
| [pg_graphql](https://github.com/supabase/pg_graphql/archive/v1.5.9.tar.gz) | [1.5.9](https://github.com/supabase/pg_graphql/archive/v1.5.9.tar.gz) | GraphQL support for PostreSQL |
20+
| [pg_graphql](https://github.com/supabase/pg_graphql/archive/v1.5.11.tar.gz) | [1.5.11](https://github.com/supabase/pg_graphql/archive/v1.5.11.tar.gz) | GraphQL support for PostreSQL |
2221
| [pg_hashids](https://github.com/iCyberon/pg_hashids/archive/cd0e1b31d52b394a0df64079406a14a4f7387cd6.tar.gz) | [cd0e1b31d52b394a0df64079406a14a4f7387cd6](https://github.com/iCyberon/pg_hashids/archive/cd0e1b31d52b394a0df64079406a14a4f7387cd6.tar.gz) | Generate short unique IDs in PostgreSQL |
2322
| [pg_jsonschema](https://github.com/supabase/pg_jsonschema/archive/v0.3.3.tar.gz) | [0.3.3](https://github.com/supabase/pg_jsonschema/archive/v0.3.3.tar.gz) | JSON Schema Validation for PostgreSQL |
2423
| [pg_net](https://github.com/supabase/pg_net/archive/refs/tags/v0.14.0.tar.gz) | [0.14.0](https://github.com/supabase/pg_net/archive/refs/tags/v0.14.0.tar.gz) | Async networking for Postgres |
@@ -39,7 +38,7 @@ Unmodified Postgres with some useful plugins. Our goal with this repo is not to
3938
| [plv8](https://github.com/plv8/plv8/archive/v3.1.10.tar.gz) | [3.1.10](https://github.com/plv8/plv8/archive/v3.1.10.tar.gz) | V8 Engine Javascript Procedural Language add-on for PostgreSQL |
4039
| [postgis](https://download.osgeo.org/postgis/source/postgis-3.3.7.tar.gz) | [3.3.7](https://download.osgeo.org/postgis/source/postgis-3.3.7.tar.gz) | Geographic Objects for PostgreSQL |
4140
| [rum](https://github.com/postgrespro/rum/archive/1.3.14.tar.gz) | [1.3.14](https://github.com/postgrespro/rum/archive/1.3.14.tar.gz) | Full text search index method for PostgreSQL |
42-
| [supabase-wrappers](https://github.com/supabase/wrappers/archive/v0.4.4.tar.gz) | [0.4.4](https://github.com/supabase/wrappers/archive/v0.4.4.tar.gz) | Various Foreign Data Wrappers (FDWs) for PostreSQL |
41+
| [supabase-wrappers](https://github.com/supabase/wrappers/archive/v0.4.5.tar.gz) | [0.4.5](https://github.com/supabase/wrappers/archive/v0.4.5.tar.gz) | Various Foreign Data Wrappers (FDWs) for PostreSQL |
4342
| [supautils](https://github.com/supabase/supautils/archive/refs/tags/v2.6.0.tar.gz) | [2.6.0](https://github.com/supabase/supautils/archive/refs/tags/v2.6.0.tar.gz) | PostgreSQL extension for enhanced security |
4443
| [timescaledb-apache](https://github.com/timescale/timescaledb/archive/2.16.1.tar.gz) | [2.16.1](https://github.com/timescale/timescaledb/archive/2.16.1.tar.gz) | Scales PostgreSQL for time-series data via automatic partitioning across time and space |
4544
| [vault](https://github.com/supabase/vault/archive/refs/tags/v0.2.9.tar.gz) | [0.2.9](https://github.com/supabase/vault/archive/refs/tags/v0.2.9.tar.gz) | Store encrypted secrets in PostgreSQL |
@@ -52,9 +51,8 @@ Unmodified Postgres with some useful plugins. Our goal with this repo is not to
5251
| [index_advisor](https://github.com/olirice/index_advisor/archive/v0.2.0.tar.gz) | [0.2.0](https://github.com/olirice/index_advisor/archive/v0.2.0.tar.gz) | Recommend indexes to improve query performance in PostgreSQL |
5352
| [orioledb](https://github.com/orioledb/orioledb/archive/beta9.tar.gz) | [orioledb](https://github.com/orioledb/orioledb/archive/beta9.tar.gz) | orioledb |
5453
| [pg-safeupdate](https://github.com/eradman/pg-safeupdate/archive/1.4.tar.gz) | [1.4](https://github.com/eradman/pg-safeupdate/archive/1.4.tar.gz) | A simple extension to PostgreSQL that requires criteria for UPDATE and DELETE |
55-
| [pg_backtrace](https://github.com/pashkinelfe/pg_backtrace/archive/d100bac815a7365e199263f5b3741baf71b14c70.tar.gz) | [1.1](https://github.com/pashkinelfe/pg_backtrace/archive/d100bac815a7365e199263f5b3741baf71b14c70.tar.gz) | Updated fork of pg_backtrace |
5654
| [pg_cron](https://github.com/citusdata/pg_cron/archive/v1.6.4.tar.gz) | [1.6.4](https://github.com/citusdata/pg_cron/archive/v1.6.4.tar.gz) | Run Cron jobs through PostgreSQL |
57-
| [pg_graphql](https://github.com/supabase/pg_graphql/archive/v1.5.9.tar.gz) | [1.5.9](https://github.com/supabase/pg_graphql/archive/v1.5.9.tar.gz) | GraphQL support for PostreSQL |
55+
| [pg_graphql](https://github.com/supabase/pg_graphql/archive/v1.5.11.tar.gz) | [1.5.11](https://github.com/supabase/pg_graphql/archive/v1.5.11.tar.gz) | GraphQL support for PostreSQL |
5856
| [pg_hashids](https://github.com/iCyberon/pg_hashids/archive/cd0e1b31d52b394a0df64079406a14a4f7387cd6.tar.gz) | [cd0e1b31d52b394a0df64079406a14a4f7387cd6](https://github.com/iCyberon/pg_hashids/archive/cd0e1b31d52b394a0df64079406a14a4f7387cd6.tar.gz) | Generate short unique IDs in PostgreSQL |
5957
| [pg_jsonschema](https://github.com/supabase/pg_jsonschema/archive/v0.3.3.tar.gz) | [0.3.3](https://github.com/supabase/pg_jsonschema/archive/v0.3.3.tar.gz) | JSON Schema Validation for PostgreSQL |
6058
| [pg_net](https://github.com/supabase/pg_net/archive/refs/tags/v0.14.0.tar.gz) | [0.14.0](https://github.com/supabase/pg_net/archive/refs/tags/v0.14.0.tar.gz) | Async networking for Postgres |
@@ -74,7 +72,7 @@ Unmodified Postgres with some useful plugins. Our goal with this repo is not to
7472
| [plpgsql-check](https://github.com/okbob/plpgsql_check/archive/v2.7.11.tar.gz) | [2.7.11](https://github.com/okbob/plpgsql_check/archive/v2.7.11.tar.gz) | Linter tool for language PL/pgSQL |
7573
| [postgis](https://download.osgeo.org/postgis/source/postgis-3.3.7.tar.gz) | [3.3.7](https://download.osgeo.org/postgis/source/postgis-3.3.7.tar.gz) | Geographic Objects for PostgreSQL |
7674
| [rum](https://github.com/postgrespro/rum/archive/1.3.14.tar.gz) | [1.3.14](https://github.com/postgrespro/rum/archive/1.3.14.tar.gz) | Full text search index method for PostgreSQL |
77-
| [supabase-wrappers](https://github.com/supabase/wrappers/archive/v0.4.4.tar.gz) | [0.4.4](https://github.com/supabase/wrappers/archive/v0.4.4.tar.gz) | Various Foreign Data Wrappers (FDWs) for PostreSQL |
75+
| [supabase-wrappers](https://github.com/supabase/wrappers/archive/v0.4.5.tar.gz) | [0.4.5](https://github.com/supabase/wrappers/archive/v0.4.5.tar.gz) | Various Foreign Data Wrappers (FDWs) for PostreSQL |
7876
| [supautils](https://github.com/supabase/supautils/archive/refs/tags/v2.6.0.tar.gz) | [2.6.0](https://github.com/supabase/supautils/archive/refs/tags/v2.6.0.tar.gz) | PostgreSQL extension for enhanced security |
7977
| [vault](https://github.com/supabase/vault/archive/refs/tags/v0.2.9.tar.gz) | [0.2.9](https://github.com/supabase/vault/archive/refs/tags/v0.2.9.tar.gz) | Store encrypted secrets in PostgreSQL |
8078
| [wal2json](https://github.com/eulerto/wal2json/archive/wal2json_2_6.tar.gz) | [2_6](https://github.com/eulerto/wal2json/archive/wal2json_2_6.tar.gz) | PostgreSQL JSON output plugin for changeset extraction |

ansible/files/postgresql_config/supautils.conf.j2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ supautils.drop_trigger_grants = '{"postgres":["auth.audit_log_entries","auth.ide
55
# omitted because may be unsafe: adminpack, amcheck, file_fdw, lo, old_snapshot, pageinspect, pg_buffercache, pg_freespacemap, pg_surgery, pg_visibility
66
# omitted because deprecated: intagg, xml2
77
# omitted because doesn't require superuser: pgmq
8-
supautils.privileged_extensions = 'address_standardizer, address_standardizer_data_us, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, fuzzystrmatch, hstore, http, hypopg, index_advisor, insert_username, intarray, isn, ltree, moddatetime, orioledb, pg_cron, pg_graphql, pg_hashids, pg_jsonschema, pg_net, pg_prewarm, pg_repack, pg_stat_monitor, pg_stat_statements, pg_tle, pg_trgm, pg_walinspect, pgaudit, pgcrypto, pgjwt, pgroonga, pgroonga_database, pgrouting, pgrowlocks, pgsodium, pgstattuple, pgtap, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supabase_vault, supautils, tablefunc, tcn, timescaledb, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp, vector, wrappers'
8+
# omitted because protected: plpgsql
9+
supautils.privileged_extensions = 'address_standardizer, address_standardizer_data_us, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, fuzzystrmatch, hstore, http, hypopg, index_advisor, insert_username, intarray, isn, ltree, moddatetime, orioledb, pg_cron, pg_graphql, pg_hashids, pg_jsonschema, pg_net, pg_prewarm, pg_repack, pg_stat_monitor, pg_stat_statements, pg_tle, pg_trgm, pg_walinspect, pgaudit, pgcrypto, pgjwt, pgroonga, pgroonga_database, pgrouting, pgrowlocks, pgsodium, pgstattuple, pgtap, plcoffee, pljava, plls, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supabase_vault, supautils, tablefunc, tcn, timescaledb, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp, vector, wrappers'
910
supautils.privileged_extensions_custom_scripts_path = '/etc/postgresql-custom/extension-custom-scripts'
1011
supautils.privileged_extensions_superuser = 'supabase_admin'
1112
supautils.privileged_role = 'postgres'

ansible/playbook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
- name: Install WAL-G
4040
import_tasks: tasks/setup-wal-g.yml
41-
when: debpkg_mode or nixpkg_mode
41+
when: debpkg_mode or nixpkg_mode or stage2_nix
4242

4343
- name: Install Gotrue
4444
import_tasks: tasks/setup-gotrue.yml

ansible/tasks/setup-wal-g.yml

Lines changed: 78 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,73 @@
11
# Downloading dependencies
2-
- name: wal-g dependencies
3-
become: yes
4-
apt:
5-
pkg:
6-
- libbrotli-dev
7-
- liblzo2-dev
8-
- libsodium-dev
9-
- cmake
2+
# - name: wal-g dependencies
3+
# become: yes
4+
# apt:
5+
# pkg:
6+
# - libbrotli-dev
7+
# - liblzo2-dev
8+
# - libsodium-dev
9+
# - cmake
1010

1111
# install go dependency for WAL-G
12-
- name: wal-g go dependency
13-
get_url:
14-
url: "https://golang.org/dl/go{{ golang_version }}.linux-{{ platform }}.tar.gz"
15-
dest: /tmp
16-
checksum: "{{ golang_version_checksum[platform] }}"
17-
timeout: 60
12+
# - name: wal-g go dependency
13+
# get_url:
14+
# url: "https://golang.org/dl/go{{ golang_version }}.linux-{{ platform }}.tar.gz"
15+
# dest: /tmp
16+
# checksum: "{{ golang_version_checksum[platform] }}"
17+
# timeout: 60
1818

19-
- name: unpack go archive
20-
unarchive:
21-
remote_src: yes
22-
src: "/tmp/go{{ golang_version }}.linux-{{ platform }}.tar.gz"
23-
dest: /usr/local
19+
# - name: unpack go archive
20+
# unarchive:
21+
# remote_src: yes
22+
# src: "/tmp/go{{ golang_version }}.linux-{{ platform }}.tar.gz"
23+
# dest: /usr/local
2424

25-
# Download WAL-G
26-
- name: wal-g - download latest version
27-
git:
28-
repo: https://github.com/wal-g/wal-g.git
29-
dest: /tmp/wal-g
30-
version: "v{{ wal_g_release }}"
31-
become: yes
25+
# # Download WAL-G
26+
# - name: wal-g - download latest version
27+
# git:
28+
# repo: https://github.com/wal-g/wal-g.git
29+
# dest: /tmp/wal-g
30+
# version: "v{{ wal_g_release }}"
31+
# become: yes
3232

33-
- name: wal-g - pg_clean
34-
make:
35-
chdir: /tmp/wal-g
36-
target: pg_clean
37-
params:
38-
GOBIN: "/usr/local/bin"
39-
PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin"
40-
USE_LIBSODIUM: true
41-
become: yes
42-
ignore_errors: yes
33+
# - name: wal-g - pg_clean
34+
# make:
35+
# chdir: /tmp/wal-g
36+
# target: pg_clean
37+
# params:
38+
# GOBIN: "/usr/local/bin"
39+
# PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin"
40+
# USE_LIBSODIUM: true
41+
# become: yes
42+
# ignore_errors: yes
4343

44-
- name: wal-g - deps
45-
make:
46-
chdir: /tmp/wal-g
47-
target: deps
48-
params:
49-
GOBIN: "/usr/local/bin"
50-
PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin"
51-
USE_LIBSODIUM: true
52-
become: yes
53-
ignore_errors: yes
44+
# - name: wal-g - deps
45+
# make:
46+
# chdir: /tmp/wal-g
47+
# target: deps
48+
# params:
49+
# GOBIN: "/usr/local/bin"
50+
# PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin"
51+
# USE_LIBSODIUM: true
52+
# become: yes
53+
# ignore_errors: yes
5454

55-
- name: wal-g - build and install
56-
community.general.make:
57-
chdir: /tmp/wal-g
58-
target: pg_install
59-
jobs: "{{ parallel_jobs | default(omit) }}"
60-
params:
61-
GOBIN: "/usr/local/bin"
62-
PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin"
63-
USE_LIBSODIUM: true
64-
become: yes
55+
# - name: wal-g - build and install
56+
# community.general.make:
57+
# chdir: /tmp/wal-g
58+
# target: pg_install
59+
# jobs: "{{ parallel_jobs | default(omit) }}"
60+
# params:
61+
# GOBIN: "/usr/local/bin"
62+
# PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin"
63+
# USE_LIBSODIUM: true
64+
# become: yes
6565

6666
- name: Create wal-g group
6767
group:
6868
name: wal-g
6969
state: present
70+
when: nixpkg_mode
7071

7172
- name: Create wal-g user
7273
user:
@@ -75,22 +76,38 @@
7576
comment: WAL-G user
7677
group: wal-g
7778
groups: wal-g, postgres
78-
79+
when: nixpkg_mode
7980
- name: Create a config directory owned by wal-g
8081
file:
8182
path: /etc/wal-g
8283
state: directory
8384
owner: wal-g
8485
group: wal-g
8586
mode: '0770'
87+
when: nixpkg_mode
8688

89+
- name: Install wal-g from nix binary cache
90+
become: yes
91+
shell: |
92+
sudo -u wal-g bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/{{ git_commit_sha }}#wal-g"
93+
when: stage2_nix
94+
95+
- name: Create symlink for wal-g from Nix profile to /usr/local/bin
96+
ansible.builtin.file:
97+
src: /home/wal-g/.nix-profile/bin/wal-g
98+
dest: /usr/local/bin/wal-g
99+
state: link
100+
force: yes # This will replace existing file/symlink if it exists
101+
become: yes # Need sudo to write to /usr/local/bin
102+
when: stage2_nix
87103
- name: Create /etc/wal-g/config.json
88104
file:
89105
path: /etc/wal-g/config.json
90106
state: touch
91107
owner: wal-g
92108
group: wal-g
93109
mode: '0664'
110+
when: stage2_nix
94111

95112
- name: Move custom wal-g.conf file to /etc/postgresql-custom/wal-g.conf
96113
template:
@@ -99,6 +116,7 @@
99116
mode: 0664
100117
owner: postgres
101118
group: postgres
119+
when: stage2_nix
102120

103121
- name: Add script to be run for restore_command
104122
template:
@@ -107,24 +125,20 @@
107125
mode: 0500
108126
owner: postgres
109127
group: postgres
128+
when: stage2_nix
110129

111130
- name: Add helper script for wal_fetch.sh
112131
template:
113132
src: "files/walg_helper_scripts/wal_change_ownership.sh"
114133
dest: /root/wal_change_ownership.sh
115134
mode: 0700
116135
owner: root
136+
when: stage2_nix
117137

118138
- name: Include /etc/postgresql-custom/wal-g.conf in postgresql.conf
119139
become: yes
120140
replace:
121141
path: /etc/postgresql/postgresql.conf
122142
regexp: "#include = '/etc/postgresql-custom/wal-g.conf'"
123143
replace: "include = '/etc/postgresql-custom/wal-g.conf'"
124-
125-
# Clean up Go
126-
- name: Uninstall Go
127-
become: yes
128-
file:
129-
path: /usr/local/go
130-
state: absent
144+
when: stage2_nix

ansible/vars.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ kong_deb_checksum: sha1:2086f6ccf8454fe64435252fea4d29d736d7ec61
4545
nginx_release: 1.22.0
4646
nginx_release_checksum: sha1:419efb77b80f165666e2ee406ad8ae9b845aba93
4747

48-
wal_g_release: "2.0.1"
4948

5049
postgres_exporter_release: "0.15.0"
5150
postgres_exporter_release_checksum:

docker/nix/build_nix.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ nix build .#checks.$SYSTEM.psql_orioledb-17 -L --no-link
1313
nix build .#psql_15/bin -o psql_15
1414

1515
nix build .#psql_orioledb-17/bin -o psql_orioledb_17
16-
16+
nix build .#wal-g -o wal-g
1717
# Copy to S3
18+
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./wal-g
1819
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_15
1920
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_orioledb_17
2021
if [ "$SYSTEM" = "aarch64-linux" ]; then
@@ -26,4 +27,5 @@ if [ "$SYSTEM" = "aarch64-linux" ]; then
2627
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_15_src
2728
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_orioledb-17_debug-debug
2829
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_orioledb-17_src
30+
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./wal-g
2931
fi

flake.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
sfcgal = pkgs.callPackage ./nix/ext/sfcgal/sfcgal.nix { };
8888
supabase-groonga = pkgs.callPackage ./nix/supabase-groonga.nix { };
8989
mecab-naist-jdic = pkgs.callPackage ./nix/ext/mecab-naist-jdic/default.nix { };
90+
wal-g = pkgs.callPackage ./nix/wal-g.nix { };
9091
# Our list of PostgreSQL extensions which come from upstream Nixpkgs.
9192
# These are maintained upstream and can easily be used here just by
9293
# listing their name. Anytime the version of nixpkgs is upgraded, these
@@ -405,6 +406,7 @@
405406
# PostgreSQL versions.
406407
psql_15 = postgresVersions.psql_15;
407408
psql_orioledb-17 = postgresVersions.psql_orioledb-17;
409+
wal-g = wal-g;
408410
sfcgal = sfcgal;
409411
pg_prove = pkgs.perlPackages.TAPParserSourceHandlerpgTAP;
410412
inherit postgresql_15 postgresql_orioledb-17;

nix/wal-g.nix

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
lib,
3+
buildGoModule,
4+
fetchFromGitHub,
5+
brotli,
6+
libsodium,
7+
installShellFiles,
8+
}:
9+
10+
buildGoModule rec {
11+
pname = "wal-g";
12+
version = "3.0.5";
13+
14+
src = fetchFromGitHub {
15+
owner = "wal-g";
16+
repo = "wal-g";
17+
rev = "v${version}";
18+
sha256 = "sha256-wVr0L2ZXMuEo6tc2ajNzPinVQ8ZVzNOSoaHZ4oFsA+U=";
19+
};
20+
21+
vendorHash = "sha256-YDLAmRfDl9TgbabXj/1rxVQ052NZDg3IagXVTe5i9dw=";
22+
23+
nativeBuildInputs = [ installShellFiles ];
24+
25+
buildInputs = [
26+
brotli
27+
libsodium
28+
];
29+
30+
subPackages = [ "main/pg" ];
31+
32+
tags = [
33+
"brotli"
34+
"libsodium"
35+
];
36+
37+
ldflags = [
38+
"-s"
39+
"-w"
40+
"-X github.com/wal-g/wal-g/cmd/pg.walgVersion=${version}"
41+
"-X github.com/wal-g/wal-g/cmd/pg.gitRevision=${src.rev}"
42+
];
43+
44+
postInstall = ''
45+
mv $out/bin/pg $out/bin/wal-g
46+
installShellCompletion --cmd wal-g \
47+
--bash <($out/bin/wal-g completion bash) \
48+
--zsh <($out/bin/wal-g completion zsh)
49+
'';
50+
51+
meta = with lib; {
52+
homepage = "https://github.com/wal-g/wal-g";
53+
license = licenses.asl20;
54+
description = "Archival restoration tool for PostgreSQL";
55+
mainProgram = "wal-g";
56+
maintainers = [ samrose ];
57+
};
58+
}

0 commit comments

Comments
 (0)