diff --git a/.envrc b/.envrc index 3550a30f2de38..f905841649e3c 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,7 @@ use flake + +# Per-worktree overrides (ports, DATABASE_URL, etc.) written by webmux/workmux +# post-create hooks. Must come after `use flake` so they take precedence over +# the flake's defaults. +# shellcheck source=/dev/null +[ -f .env.local ] && source .env.local diff --git a/flake.nix b/flake.nix index 135005b83d5d6..5f644d93dcf8d 100644 --- a/flake.nix +++ b/flake.nix @@ -229,13 +229,20 @@ # --------------------------------------------------------------- devEnvVars = { - DATABASE_URL = "postgres://postgres:changeme@127.0.0.1:5432/windmill?sslmode=disable"; - REMOTE = "http://127.0.0.1:8000"; - REMOTE_LSP = "http://127.0.0.1:3001"; NODE_ENV = "development"; NODE_OPTIONS = "--max-old-space-size=16384"; }; + # Connection-specific defaults — set via shellHook so they respect + # pre-existing values (e.g. from webmux runtime.env / .env.local). + # Nix attrs are injected unconditionally and would override per-worktree + # values set by webmux before the interactive shell starts. + devShellHook = '' + export DATABASE_URL="''${DATABASE_URL:-postgres://postgres:changeme@127.0.0.1:5432/windmill?sslmode=disable}" + export REMOTE="''${REMOTE:-http://127.0.0.1:8000}" + export REMOTE_LSP="''${REMOTE_LSP:-http://127.0.0.1:3001}" + ''; + # --------------------------------------------------------------- # Helper scripts — base set (default + full) # --------------------------------------------------------------- @@ -402,6 +409,7 @@ # ============================================================= devShells.default = pkgs.mkShell (buildEnvVars // commonRuntimeVars // devEnvVars // browserVars // { + shellHook = devShellHook; buildInputs = coreBuildInputs; packages = helperScriptsBase ++ [ playwrightWrapper ]; @@ -413,6 +421,7 @@ # ============================================================= devShells.full = pkgs.mkShell (buildEnvVars // commonRuntimeVars // extraRuntimeVars // devEnvVars // browserVars // { + shellHook = devShellHook; buildInputs = coreBuildInputs ++ extraRuntimes ++ (with pkgs; [ # Python extras poetry