Introducing Codchi - NixOS Development Environments Everywhere

After quietly developing and using Codchi at aformatik for about two years, we (Johannes & Nico (/u/niicco0)) are excited to announce the public beta of Codchi today!

Codchi (Code Machines) is a tool that manages your project’s development environment in a reproducible and easy to use way. Setting up a development environment should be as easy as a git clone!

At this point, most of you might be thinking “we can do this already with nix flakes” or “great, another devenv clone”. However, Codchi is designed to complement existing tools like nix flakes, devenv.sh or flox, not compete with them.

Technically speaking, Codchi is a tool that allows installing NixOS modules on any machine (currently Windows 10, 11 and Linux) without having to worry about hardware configuration or installing Nix itself. To do this, Codchi bundles a list of NixOS modules into a code machine and builds it into a NixOS system using either WSL on Windows or LXD on Linux as shown below. Codchi also provides host integration such as GUI, sound, file sharing, secret management and GPU drivers out of the box.

Codchi's Architecture

Our goal with Codchi is to bring the reproducibility and reliability of Nix(OS) to non-Nix developers, especially in corporate environments (which mostly use Windows). Often enterprise projects are quite complex (multiple services, IDEs or programs that pollute the whole system), which is why we use actual NixOS systems instead of “just” development shells. This has several advantages:

  • Proper isolation from the host via a system container per code machine.
  • All of the 20,000+ NixOS options in nixpkgs and the existing NixOS ecosystem can be used.
  • Each code machine has a flake-enabled nix (with a shared store between code machines), allowing the use of established tools like devshells, devenv.sh, flox, and much more.

Here you can see Codchi in action:

YouTube

While Codchi is ultimately meant for all developers, including those who have never touched Nix before, we’re currently seeking feedback from people already familiar with Nix(OS). Once we collect enough input and refine the experience, we plan to release Codchi more broadly to everyone.

This is our little Christmas present to you. We look forward to your feedback! Feel free to post in the comments or send an email to <codchi [at] aformatik [dot] de>.

Learn more:

DISCLAMER

Codchi is currently in beta and still under active development and testing. Please expect potential bugs and incomplete features and report them on our GitHub. Please do not store important data in code machines yet, as the integration with WSL can still be buggy sometimes.

32 Likes

This is really cool and would possibly have saved me hours of explaining how to deploy NixOS VMs on WSL2 to coworkers. I’ll have to give it a try, thank you for the work!

2 Likes

Not working on Manjaro: LXD error:
sudo snap install lxd

error: cannot perform the following tasks:
Start snap “lxd” (31214) services (systemctl command [start snap.lxd.activate.service] failed with exit status 1: stderr:
Job for snap.lxd.activate.service failed because the control process exited with error code.
See “systemctl status snap.lxd.activate.service” and “journalctl -xeu snap.lxd.activate.service” for details.)

How about swapping out LXD (looks like only suitable for Ubuntu and there are difficulties with support)?

Currently Codchi is only tested on non snap LXD (on NixOS, but this shouldn’t matter).

We’d love to swap out LXD for docker or something similar, but there are problems with SystemD inside docker (even with podman and its systemd flag enabled). We run full NixOS in every code machine, so SystemD working inside the container is a must.

Don’t forget there’s also incus, the LXD fork which has one or two of the original main devs behind it. If nothing else I don’t think they support snap packaging any more, so they may support other more useful formats:

2 Likes

Yeah we’ll probably add incus as an alternative to LXD. The CLI should be the same

1 Like

Codchi v0.3.1.3 has added experimental[1] support for incus.


  1. I haven’t tested it yet, because I couldn’t get incus to work on my NixOS machine. ↩︎

1 Like