cursery.nixDocs

Getting started

Start a new app from the flake template. You'll need Nix with flakes enabled.

Create the app#

Make a directory for it and fill it from the template:

$ mkdir my-app && cd my-app
$ nix flake init -t github:PsychoLlama/cursery.nix

It's a Vite project with a counter app:

  • src/app/default.nix: the app: its state, how actions change it, and what it renders.
  • src/page.nix: the HTML page around the app, rendered ahead of time.
  • vite.config.js: the pages to build, and the app each one mounts.
  • flake.nix: a dev shell with Node and pnpm.

Start the dev server#

Enter the dev shell, install dependencies, and start Vite:

$ nix develop
$ pnpm install
$ pnpm dev

Open localhost:5173 and click around. Then edit src/app/default.nix. Vite swaps in the new code as you save, and the app keeps its state.

Build for production#

$ pnpm build

The site lands in dist/, static files to host anywhere. Try it locally with pnpm preview.