Compiling the Matter SDK on NixOS

Matter has their own CIPD package manager, and it doesn’t seem to work in a standard Nix shell with packages from GitHub - mirrexagon/nixpkgs-esp-dev: Nix flake and overlay for ESP8266 and ESP32 development..

There’s some comments about it here: `python-matter-server` missing runtime dependencies in nixpkgs-unstable. · Issue #255774 · NixOS/nixpkgs · GitHub.

Has anyone tried this before, or know of the easiest way to run this?

I’ve taken a look at compiling the Matter SDK on NixOS, and gotten as far as a finished compilation.

The blocking issue (and why I never opened a PR), is that I couldn’t find a way to skip creating a python venv at the end, so it falls afoul of the Nix sandbox.

It looks like I deleted the wip, but there’s a few tips I can remember off the top of my head:

  • nixpkgs’s default gn is too old to build connectedhomeip, you’ll need to update it. This revision worked for me.
  • You’ll need zcl-advanced-platform (ZAP) cli. It’s not packaged in nixpkgs, but this drv will do. It’s a bit outdated from when I was working on it, but it should work.
  • A relatively standard build with gn and ninja as nativeBuildInputs should get you 70% of the way there for the derivation to build the matter sdk. You’ll need to run zap in the postPatch phase.
  • A full git submodule init will recurse for a tremendous amount of time. You’ll want to use connectedhomeip’s scripts/checkout_submodules.py, since it’ll only pull in the required dependencies.
1 Like

Even if you could fix the last issue, we couldn’t accept it as a PR because the full source directory is to big for hydra and we likely don’t want to raise that unless really required.