Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 59 additions & 14 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,65 @@

outputs = { self, nixpkgs, ... }@inputs:
let
system = "aarch64-darwin";
pkgs = import nixpkgs { inherit system; config.allowUnfree = true; };
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in {
devShells.${system}.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nodejs_22
corepack_22

python312

# Webhooks
stripe-cli
ngrok
];
};
devShells = forAllSystems (system:
let
pkgs = import nixpkgs { inherit system; config.allowUnfree = true; };
in {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nodejs_22
corepack_22

python314
uv

# Webhooks
stripe-cli

# Containers
docker-client
];

LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
pkgs.stdenv.cc.cc.lib
];

shellHook = ''
echo "Setting up Polar development environment..."

# Setup environment files
./dev/setup-environment

# Start Docker containers
echo "Starting containers..."
if [ -S /var/run/docker.sock ]; then
# Docker daemon socket exists, try to use it
(cd server && docker compose up -d --build)
else
echo "ERROR: Docker not found or running"
return 1 2>/dev/null || exit 1
fi

# Setup Python environment, build emails, and run migrations
echo "Setting up Python environment..."
(cd server && uv sync && uv run task emails && uv run task db_migrate)

# Install frontend dependencies
echo "Installing frontend dependencies..."
(cd clients && pnpm install)

echo "Development environment ready!"
'';
};
}
);
};
}