-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update setup instructions to work with Linux/NixOS (#1105)
- Loading branch information
1 parent
021e4d1
commit 38e4dea
Showing
5 changed files
with
120 additions
and
10 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ pkgs ? import <nixpkgs> { } }: | ||
|
||
with pkgs; | ||
|
||
mkShellNoCC { | ||
buildInputs = [ | ||
bintools | ||
gcc | ||
libffi.dev | ||
nodejs | ||
ruby | ||
yarn | ||
]; | ||
} |
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,49 @@ | ||
#!/bin/sh | ||
# shellcheck shell=ash | ||
set -euo pipefail | ||
|
||
# Darwin compatibility | ||
if hash greadlink >/dev/null 2>/dev/null; then | ||
readlink() { greadlink "$@"; } | ||
fi | ||
|
||
# set working directory to repo root | ||
cd "$(dirname "$(dirname "$(readlink -f "$0")")")" | ||
|
||
step() { | ||
printf '\x1B[1;36m>>\x1B[0;36m %s...\x1B[0m\n' "$1" | ||
} | ||
|
||
if [ ! -d testing/postgresql-data/ ]; then | ||
step "First-time setup: Creating PostgreSQL database for testing" | ||
initdb -A trust -U postgres testing/postgresql-data/ | ||
fi | ||
mkdir -p testing/postgresql-run/ | ||
|
||
step "Configuring PostgreSQL" | ||
sed -ie '/^#\?\(external_pid_file\|unix_socket_directories\|port\)\b/d' testing/postgresql-data/postgresql.conf | ||
( | ||
echo "external_pid_file = '${PWD}/testing/postgresql-run/pid'" | ||
echo "unix_socket_directories = '${PWD}/testing/postgresql-run'" | ||
echo "port = 5432" | ||
) >> testing/postgresql-data/postgresql.conf | ||
|
||
stop_postgres() { | ||
EXIT_CODE=$? | ||
step "Stopping PostgreSQL" | ||
pg_ctl stop -D testing/postgresql-data/ -w -s | ||
exit "${EXIT_CODE}" | ||
} | ||
|
||
step "Starting PostgreSQL" | ||
rm -f -- testing/postgresql.log | ||
trap stop_postgres EXIT INT TERM | ||
pg_ctl start -D testing/postgresql-data/ -l testing/postgresql.log -w -s | ||
|
||
step "Running command: $*" | ||
set +e | ||
"$@" | ||
EXIT_CODE=$? | ||
set -e | ||
|
||
exit "${EXIT_CODE}" |