forked from DROOdotFOO/raxol
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.nix
More file actions
52 lines (43 loc) · 1.24 KB
/
shell.nix
File metadata and controls
52 lines (43 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{ pkgs ? import <nixpkgs> {} }:
let
# Core dependencies
buildInputs = with pkgs; [
elixir
# Build essentials
gcc gnumake cmake pkg-config
# Database
postgresql_15
# System libraries
libffi openssl zlib ncurses imagemagick
# Development tools
git nodejs_20
# Python tools
python3Packages.pip python3Packages.setuptools python3Packages.wheel
];
in pkgs.mkShell {
inherit buildInputs;
shellHook = ''
echo "Setting up Raxol development environment..."
# Environment setup
export PATH="${pkgs.elixir}/bin:${pkgs.imagemagick}/bin:$PATH"
export MIX_ENV=dev
# PostgreSQL setup
export PGDATA="$PWD/.postgres"
mkdir -p /tmp/postgresql
if [ ! -d "$PGDATA" ]; then
initdb -D "$PGDATA" --auth=trust --no-locale
pg_ctl -D "$PGDATA" -o "-k /tmp/postgresql" start
sleep 1 && createuser -s postgres || true
pg_ctl -D "$PGDATA" stop
fi
if ! pg_ctl -D "$PGDATA" status >/dev/null 2>&1; then
pg_ctl -D "$PGDATA" -o "-k /tmp/postgresql" start
fi
echo "Environment ready! Run 'mix test' to verify setup."
'';
shellExitHook = ''
if pg_ctl -D "$PGDATA" status >/dev/null 2>&1; then
pg_ctl -D "$PGDATA" stop
fi
'';
}