Skip to content

Commit a9ce6be

Browse files
committed
fixups
1 parent a8338cf commit a9ce6be

File tree

4 files changed

+18
-21
lines changed

4 files changed

+18
-21
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,16 @@ DOCKERFILES := \
3939

4040
build: gen go-build node-install
4141

42+
# Note: We do NOT use --with-deps here because it fails on newer systems (like Ubuntu 24.04)
43+
# due to virtual package resolution issues (e.g. libasound2 vs libasound2t64).
4244
nix-setup: node-install go-install-tools gen
4345
npx playwright install
4446

4547
clean: clean-gen clean-node port-forward-terminate minikube-delete
4648

49+
clean-nix:
50+
rm -rf .nix/
51+
4752
precommit: license-check go-fix go-tidy lint test unstaged-changes
4853

4954
################################
@@ -392,7 +397,7 @@ playwright-install:
392397
@if [ -z "$$PLAYWRIGHT_BROWSERS_PATH" ]; then \
393398
npx playwright install --with-deps; \
394399
else \
395-
echo "Skipping playwright install because PLAYWRIGHT_BROWSERS_PATH is set to $$PLAYWRIGHT_BROWSERS_PATH"; \
400+
echo "Skipping playwright install because PLAYWRIGHT_BROWSERS_PATH is set to $$PLAYWRIGHT_BROWSERS_PATH. This should have been handled by nix-develop already to prevent sudo prompt."; \
396401
fi
397402

398403
playwright-update-snapshots: fresh-env-for-playwright

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ nix develop
6060
make nix-setup
6161
```
6262

63+
> [!NOTE]
64+
> To clean up the downloaded browsers and start fresh, you can run `make clean-nix`.
65+
6366
### Running the services locally
6467

6568
After setting up your environment, check out the [DEVELOPMENT.md](./DEVELOPMENT.md) for more information to get started and running locally.

docs/nix-setup.md

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ make nix-setup
2424

2525
This will drop you into a new shell with all the required tools in your `PATH`:
2626

27-
- Go (1.26.1)
28-
- Node.js (24.14.0)
29-
- OpenJDK 25
27+
- Go
28+
- Node.js
29+
- OpenJDK
3030
- Terraform, Cloud SDK, Minikube, Skaffold, etc.
3131

3232
You can verify the versions by looking at the output message when you enter the shell.
@@ -107,26 +107,14 @@ Playwright's WebKit browser requires some special handling in a Nix environment
107107

108108
We have handled this in `flake.nix`:
109109

110-
1. **Correct Library Versions**: We use `libxml2_13` instead of the default `libxml2` because it provides the exact `libxml2.so.2` file WebKit expects, avoiding brittle symlink hacks.
110+
1. **Correct Library Versions**: We use `libxml2_13` instead of the default `libxml2` because it provides the exact `libxml2.so.2` file WebKit expects, avoiding brittle symlink hacks. We also added `woff2` to support web fonts.
111111
2. **Automatic Patching**: When you enter the shell (`nix develop`), it automatically checks if Playwright browsers are installed in `.nix/browsers`. If found, it patches the `MiniBrowser` wrapper script to preserve your `LD_LIBRARY_PATH` instead of overwriting it.
112112

113-
### Clean Build of the Environment
113+
### Why we don't use `--with-deps`
114114

115-
If you run into issues with browsers or want to ensure a clean setup:
115+
We do not use `npx playwright install --with-deps` in `make nix-setup` because it attempts to use the host system's package manager (like `apt`) to install dependencies. On newer Linux distributions (like Ubuntu 24.04), this can fail due to package name changes (e.g., asking for `libasound2` when only `libasound2t64` is available).
116116

117-
1. **Clean Playwright Cache**: Delete the cached browsers to force a redownload.
118-
```bash
119-
rm -rf .nix/browsers
120-
```
121-
2. **Re-install Browsers**: Run the install command again (inside `nix develop`).
122-
```bash
123-
npx playwright install
124-
```
125-
3. **Re-enter Shell**: Exit and re-enter `nix develop` to trigger the automatic patching again!
126-
```bash
127-
exit
128-
nix develop
129-
```
117+
By managing dependencies in `flake.nix` and using Nix's environment, we avoid polluting the host system and prevent these distribution-specific installation failures.
130118

131119
## Playwright E2E Tests and Docker
132120

flake.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
libxcursor
7676
libxml2_13
7777
libevent
78+
woff2
7879
];
7980

8081
shellHook = ''
@@ -83,7 +84,7 @@
8384
export DOCKER_BUILDKIT=1
8485
export ANTLR=antlr4
8586
export USE_DOCKER_BROWSER=true
86-
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libxml2_13.out}/lib:${pkgs.libevent.out}/lib"
87+
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libxml2_13.out}/lib:${pkgs.libevent.out}/lib:${pkgs.woff2.out}/lib"
8788
8889
# Isolate Playwright browsers to this project
8990
export PLAYWRIGHT_BROWSERS_PATH="$PWD/.nix/browsers"

0 commit comments

Comments
 (0)