|
571 | 571 | sqlTests = ./nix/tests/smoke; |
572 | 572 | pg_prove = pkgs.perlPackages.TAPParserSourceHandlerpgTAP; |
573 | 573 | pg_regress = basePackages.pg_regress; |
574 | | - getkey-script = pkgs.stdenv.mkDerivation { |
575 | | - name = "pgsodium-getkey"; |
576 | | - buildCommand = '' |
577 | | - mkdir -p $out/bin |
578 | | - cat > $out/bin/pgsodium-getkey << 'EOF' |
579 | | - #!${pkgs.bash}/bin/bash |
580 | | - set -euo pipefail |
581 | | - |
582 | | - TMPDIR_BASE=$(mktemp -d) |
583 | | - |
584 | | - if [[ "$(uname)" == "Darwin" ]]; then |
585 | | - KEY_DIR="/private/tmp/pgsodium" |
586 | | - else |
587 | | - KEY_DIR="''${PGSODIUM_KEY_DIR:-$TMPDIR_BASE/pgsodium}" |
588 | | - fi |
589 | | - KEY_FILE="$KEY_DIR/pgsodium.key" |
590 | | - |
591 | | - if ! mkdir -p "$KEY_DIR" 2>/dev/null; then |
592 | | - echo "Error: Could not create key directory $KEY_DIR" >&2 |
593 | | - exit 1 |
594 | | - fi |
595 | | - chmod 1777 "$KEY_DIR" |
596 | | - |
597 | | - if [[ ! -f "$KEY_FILE" ]]; then |
598 | | - if ! (dd if=/dev/urandom bs=32 count=1 2>/dev/null | od -A n -t x1 | tr -d ' \n' > "$KEY_FILE"); then |
599 | | - if ! (openssl rand -hex 32 > "$KEY_FILE"); then |
600 | | - echo "00000000000000000000000000000000" > "$KEY_FILE" |
601 | | - echo "Warning: Using fallback key" >&2 |
602 | | - fi |
| 574 | + getkey-script = pkgs.writeScriptBin "pgsodium-getkey" '' |
| 575 | + #!${pkgs.bash}/bin/bash |
| 576 | + set -euo pipefail |
| 577 | + |
| 578 | + TMPDIR_BASE=$(mktemp -d) |
| 579 | + |
| 580 | + if [[ "$(uname)" == "Darwin" ]]; then |
| 581 | + KEY_DIR="/private/tmp/pgsodium" |
| 582 | + else |
| 583 | + KEY_DIR="''${PGSODIUM_KEY_DIR:-$TMPDIR_BASE/pgsodium}" |
| 584 | + fi |
| 585 | + KEY_FILE="$KEY_DIR/pgsodium.key" |
| 586 | + |
| 587 | + if ! mkdir -p "$KEY_DIR" 2>/dev/null; then |
| 588 | + echo "Error: Could not create key directory $KEY_DIR" >&2 |
| 589 | + exit 1 |
| 590 | + fi |
| 591 | + chmod 1777 "$KEY_DIR" |
| 592 | + |
| 593 | + if [[ ! -f "$KEY_FILE" ]]; then |
| 594 | + if ! (dd if=/dev/urandom bs=32 count=1 2>/dev/null | od -A n -t x1 | tr -d ' \n' > "$KEY_FILE"); then |
| 595 | + if ! (openssl rand -hex 32 > "$KEY_FILE"); then |
| 596 | + echo "00000000000000000000000000000000" > "$KEY_FILE" |
| 597 | + echo "Warning: Using fallback key" >&2 |
603 | 598 | fi |
604 | | - chmod 644 "$KEY_FILE" |
605 | | - fi |
606 | | - |
607 | | - if [[ -f "$KEY_FILE" && -r "$KEY_FILE" ]]; then |
608 | | - cat "$KEY_FILE" |
609 | | - else |
610 | | - echo "Error: Cannot read key file $KEY_FILE" >&2 |
611 | | - exit 1 |
612 | 599 | fi |
613 | | - EOF |
614 | | - chmod +x $out/bin/pgsodium-getkey |
615 | | - ''; |
616 | | - }; |
| 600 | + chmod 644 "$KEY_FILE" |
| 601 | + fi |
| 602 | + |
| 603 | + if [[ -f "$KEY_FILE" && -r "$KEY_FILE" ]]; then |
| 604 | + cat "$KEY_FILE" |
| 605 | + else |
| 606 | + echo "Error: Cannot read key file $KEY_FILE" >&2 |
| 607 | + exit 1 |
| 608 | + fi |
| 609 | + ''; |
617 | 610 |
|
618 | 611 | # Use the shared setup but with a test-specific name |
619 | 612 | start-postgres-server-bin = makePostgresDevSetup { |
|
682 | 675 | echo "listen_addresses = '*'" >> "$PGTAP_CLUSTER"/postgresql.conf |
683 | 676 | echo "port = 5435" >> "$PGTAP_CLUSTER"/postgresql.conf |
684 | 677 | echo "host all all 127.0.0.1/32 trust" >> $PGTAP_CLUSTER/pg_hba.conf |
685 | | - echo "Checking shared_preload_libraries setting:" |
686 | | - grep -rn "shared_preload_libraries" "$PGTAP_CLUSTER"/postgresql.conf |
687 | 678 | # Remove timescaledb if running orioledb-17 check |
688 | 679 | echo "I AM ${pgpkg.version}====================================================" |
689 | 680 | if [[ "${pgpkg.version}" == *"17"* ]]; then |
|
0 commit comments