diff --git a/flake.lock b/flake.lock index b7695d9c55..424afe3d85 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1741010256, - "narHash": "sha256-WZNlK/KX7Sni0RyqLSqLPbK8k08Kq7H7RijPJbq9KHM=", + "lastModified": 1767640445, + "narHash": "sha256-UWYqmD7JFBEDBHWYcqE6s6c77pWdcU/i+bwD6XxMb8A=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ba487dbc9d04e0634c64e3b1f0d25839a0a68246", + "rev": "9f0c42f8bc7151b8e7e5840fb3bd454ad850d8c5", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index bbcb4ee445..71fd008148 100644 --- a/flake.nix +++ b/flake.nix @@ -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!" + ''; + }; + } + ); }; }