# impro_flake Nix flake + direnv workspace for developing [Impro](https://impro.social) and its plugins. Contains three independent git repositories side by side: | Path | Purpose | Remote | | ------------------------- | ------------------------------------------------------------ | ----------------------------------------------------------------- | | `impro/` | Impro web client (Eleventy SPA). The plugin host. | `tangled-7778777:7778777.online/impro` | | `impro-sample-plugin/` | Reference plugin. Starter template for new plugins. | `tangled-7778777:7778777.online/impro-sample-plugin` | | `.` (this repo) | The flake + direnv configuration that wraps both projects. | local-only at present | The flake repo deliberately ignores both project subdirectories (see `.gitignore`). This is what stops `nix build` / `nix develop` from copying their `node_modules/`, `build/`, and plugin output into the nix store on every rebuild — flake evaluation only sees `flake.nix`, `flake.lock`, `.envrc`, and this `README.md`. --- ## Prerequisites - Nix 2.20+ with flakes enabled (`experimental-features = flakes nix-command`) - direnv, hooked into your shell (`eval "$(direnv hook zsh)"` in `~/.zshrc`) Both are already configured on this machine. --- ## First-time setup ```sh cd ~/impro_flake direnv allow # loads the dev shell from flake.nix cd impro && npm ci # install host deps cd ../impro-sample-plugin && npm ci # install plugin SDK + esbuild ``` If `npm ci` complains about un-reviewed install scripts, run `npm approve-scripts --all` once in each project. This is npm 11+ policy. --- ## What the dev shell provides `flake.nix` exposes a single `devShells.default` containing: | Tool | Why | | --------------------------------- | --------------------------------------------------------- | | `nodejs_22` (Node 22.x, npm) | Runtime + package manager for both projects | | `typescript-language-server` | LSP for TypeScript / JavaScript (editor-agnostic) | | `typescript` (`tsc`) | Backing tsserver for the LSP | | `vscode-langservers-extracted` | HTML, CSS, JSON, ESLint language servers | | `prettier` | Code formatter (impro also has a local copy via npm) | | `playwright-driver` | End-to-end browser binaries for `npm run test:e2e` | | `git` | Version control | `PLAYWRIGHT_BROWSERS_PATH` is exported to the nix-installed browser bundle, so Playwright won't try to re-download Chromium/Firefox/WebKit into `~/.cache/ms-playwright`. ## Build, run, test, debug All commands run **inside the relevant project subdirectory**. ### `impro/` (host) | Task | Command | | --------------------- | --------------------------------------------- | | Dev server | `npm run start` (live-reload on `:8080`) | | Production build | `npm run build` (outputs to `build/`) | | Serve built bundle | `npm run serve:static` | | Unit tests | `npm run test:unit` | | Unit tests + coverage | `npm run test:unit:coverage` | | E2E tests | `npm run test:e2e` | | Bundle client libs | `npm run bundle:capacitor`, `npm run bundle:lit-html` | | Debug node process | `node --inspect-brk