-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: remove dependency on pgsodium #37
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
afff747
feat: remove dependency on pgsodium
soedirgo 0277508
chore: update tests
soedirgo 3ea5c25
chore: remove pg17 for now
soedirgo 7b9dc8e
chore: reinstate pg17
soedirgo 2b0c0e6
fix: change vault.secrets owner in upgrade script
soedirgo e4aab63
fix: change perms to not rely on pgsodium_keyiduser
soedirgo 6cd5b71
chore: rerun tests
soedirgo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,24 @@ | ||
name: Tests | ||
|
||
on: push | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
tests: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
pg-version: ['13', '14', '15', '16', '17'] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run tests | ||
run: | | ||
./test.sh 15 | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v13 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
- name: Run tests | ||
run: nix-shell --run "vault-with-pg-${{ matrix.pg-version }} make installcheck" | ||
- if: ${{ failure() }} | ||
run: cat regression.diffs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
results/ | ||
regression.* | ||
*.o | ||
*.so | ||
*.bc | ||
*.dylib |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,25 @@ | ||
PG_CFLAGS = -std=c99 -Werror -Wno-declaration-after-statement | ||
EXTENSION = supabase_vault | ||
EXTVERSION = 0.3.0 | ||
|
||
DATA = $(wildcard sql/*--*.sql) | ||
|
||
TESTS = $(wildcard test/sql/*.sql) | ||
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS)) | ||
REGRESS_OPTS = --use-existing --inputdir=test | ||
|
||
MODULE_big = $(EXTENSION) | ||
OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c)) | ||
|
||
all: $(EXTENSION).control | ||
|
||
$(EXTENSION).control: | ||
sed "s/@VAULT_VERSION@/$(EXTVERSION)/g" $(EXTENSION).control.in > $(EXTENSION).control | ||
|
||
PG_CONFIG = pg_config | ||
SHLIB_LINK = -lsodium | ||
|
||
PG_CPPFLAGS := $(CPPFLAGS) -DEXTVERSION=\"$(EXTVERSION)\" | ||
|
||
PGXS := $(shell $(PG_CONFIG) --pgxs) | ||
include $(PGXS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ postgresql, writeShellScriptBin } : | ||
|
||
let | ||
ver = builtins.head (builtins.splitVersion postgresql.version); | ||
src = builtins.readFile ./withTmpDb.sh.in; | ||
in | ||
(writeShellScriptBin "vault-with-pg-${ver}" src).overrideAttrs(old: { | ||
buildCommand = '' | ||
${old.buildCommand} | ||
substituteInPlace $out/bin/${old.name} --subst-var-by 'POSTGRESQL_PATH' '${postgresql}' | ||
''; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ lib, stdenv, fetchFromGitHub, libsodium, postgresql }: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "pgsodium"; | ||
version = "3.1.8"; | ||
|
||
buildInputs = [ libsodium postgresql ]; | ||
|
||
src = fetchFromGitHub { | ||
owner = "michelp"; | ||
repo = pname; | ||
rev = "refs/tags/v${version}"; | ||
hash = "sha256-j5F1PPdwfQRbV8XJ8Mloi8FvZF0MTl4eyIJcBYQy1E4="; | ||
}; | ||
|
||
installPhase = '' | ||
mkdir -p $out/{lib,share/postgresql/extension} | ||
|
||
install -D *${postgresql.dlSuffix} $out/lib | ||
install -D -t $out/share/postgresql/extension sql/*.sql | ||
install -D -t $out/share/postgresql/extension *.control | ||
''; | ||
|
||
meta = with lib; { | ||
description = "Modern cryptography for PostgreSQL"; | ||
homepage = "https://github.com/michelp/${pname}"; | ||
maintainers = with maintainers; [ samrose ]; | ||
platforms = postgresql.meta.platforms; | ||
license = licenses.postgresql; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ lib, stdenv, fetchFromGitHub, postgresql, perl, perlPackages, which }: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "pgtap"; | ||
version = "1.2.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "theory"; | ||
repo = "pgtap"; | ||
rev = "v${version}"; | ||
hash = "sha256-lb0PRffwo6J5a6Hqw1ggvn0cW7gPZ02OEcLPi9ineI8="; | ||
}; | ||
|
||
nativeBuildInputs = [ postgresql perl perlPackages.TAPParserSourceHandlerpgTAP which ]; | ||
|
||
installPhase = '' | ||
install -D {sql/pgtap--${version}.sql,pgtap.control} -t $out/share/postgresql/extension | ||
''; | ||
|
||
meta = with lib; { | ||
description = "A unit testing framework for PostgreSQL"; | ||
longDescription = '' | ||
pgTAP is a unit testing framework for PostgreSQL written in PL/pgSQL and PL/SQL. | ||
It includes a comprehensive collection of TAP-emitting assertion functions, | ||
as well as the ability to integrate with other TAP-emitting test frameworks. | ||
It can also be used in the xUnit testing style. | ||
''; | ||
maintainers = with maintainers; [ samrose ]; | ||
homepage = "https://pgtap.org"; | ||
inherit (postgresql.meta) platforms; | ||
license = licenses.mit; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import ./generic.nix { | ||
version = "17.0"; | ||
hash = "sha256-fidhMcD91rYliNutmzuyS4w0mNUAkyjbpZrxboGRCd4="; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
self: | ||
let | ||
# Before removing an EOL major version, make sure to check the versioning policy in: | ||
# <nixpkgs>/nixos/modules/services/databases/postgresql.md | ||
# | ||
# Before removing, make sure to update it to the last minor version - and if only in | ||
# an immediately preceding commit. This allows people relying on that old major version | ||
# for a bit longer to still update up to this commit to at least get the latest minor | ||
# version. In other words: Do not remove the second-to-last minor version from nixpkgs, | ||
# yet. Update first. | ||
versions = { | ||
postgresql_17 = ./17.nix; | ||
}; | ||
|
||
mkAttributes = jitSupport: | ||
self.lib.mapAttrs' (version: path: | ||
let | ||
attrName = if jitSupport then "${version}_jit" else version; | ||
in | ||
self.lib.nameValuePair attrName (import path { | ||
inherit jitSupport self; | ||
}) | ||
) versions; | ||
|
||
in | ||
# variations without and with JIT | ||
(mkAttributes false) // (mkAttributes true) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this necessary if the dep is getting pulled out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we use pgsodium code in pgsodium.c and pgsodium.h; we can do away with them once we move from libsodium (still needed to decrypt existing secrets)