Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Replit 3 min read Announcement easyNovice

How we went from supporting 50 languages to all of them

Replit replaced its ever-growing monolithic Docker OS image with Nix, giving every repl access to over 30,000 OS packages through a declarative `replit.nix` file. The packages are prebuilt into a roughly 1 TB shared Nix store disk image that is mounted at `/nix` in every repl, so nothing needs to be downloaded. Nix's content-addressed store lets many versions coexist without conflicts, and each environment exposes only the packages it declares. Planned work includes `.replit` configuration for things like LSP and caching nix-shell environments to remove rebuild delay on run, which an edit notes has since shipped.

Related posts

  • Dynamic version for Nix derivations

    Replit mediumAdept

    Replit derives a Nix derivation's version automatically from the git short SHA instead of editing default.nix by hand for every release. The final approach copies the whole source tree, including .git, into the store with copyPathToStore and runs `git rev-parse --short HEAD` inside a runCommand. It then reads the output with builtins.readFile, strips the trailing newline and prefixes a digit to satisfy Nix's version-format rule. The write-up walks through the failures along the way (sandboxed builds can't see the host repo, fetchGit drops .git, runCommand outputs a file) and closes with lessons on Nix laziness, purity and attribute sets.

  • Faster Nix Repl Startup

    Replit mediumAdept

    Replit removed the multi-second (sometimes tens of seconds) "Loading Nix environment" delay on repl startup by caching the environment variables exported by nix-shell after evaluating replit.nix. Because each repl gets a seeded Nix store containing most of nixpkgs, evaluation rarely adds new store paths, so the cached PATH and other variables can be persisted to the repl's filesystem and reused across restarts. The cache is invalidated whenever a cached variable references a Nix store path that no longer exists, falling back to full evaluation so correctness is preserved.

  • Introducing the Replit Desktop App

    Replit mediumAdept

    Replit now ships a native desktop app for macOS, Windows and Linux, centered on the IDE workspace, with multiple windows, editor shortcuts the browser would intercept (Cmd/Ctrl+T/W), deep linking and native Chromium devtools. It is built on Electron rather than React Native, which lacked Linux support, or Tauri, which was missing deep linking and native APIs for remotely loaded URLs and brought cross-platform rendering differences and Rust iteration costs. The app remotely loads part of the website, exposes Node APIs to the web client, and is packaged and signed per platform and architecture with Electron Forge in GitHub Actions. Auto-updates go through a Hazel-based release server deployed on Replit.

  • Introducing the Python package cache

    Replit mediumAdept

    Replit pre-populates pip's cache with the most popular Python packages and pre-built wheels so UPM can skip most downloads and compilation when a repl starts. A read-only snapshot of the cache is bind-mounted into each repl and overlay-mounted onto ~/.cache/pip with a per-repl writable upper directory, giving copy-on-write isolation that prevents cross-repl cache poisoning while still letting users add packages. Because pip's cache is content-addressable, shared files can be found by hash and integrity-checked. The cache is rebuilt weekly from PyPI download stats and cut average install time by about 40% on Always On repls, with Maven and npm support planned next.

  • Building a web app with Nix (Because why not?)

    Replit mediumAdept

    A toy web app is built in the Nix language by having a Python HTTP server shell out to `nix eval`, passing the request path and body as `--arg` values. Routing is done with attribute sets and `builtins.hasAttr`. A TODO API is backed by the Replit database, using `pkgs.runCommand` with curl to get around Nix's lack of side effects. Along the way it explains Nix language basics, including `let..in`, laziness, default arguments and `import`, plus why a dummy `builtins.currentTime` attribute is needed to defeat derivation caching.

The quest for software engineering knowledge.

Look:
Layout: