Installing Zig on Nix and Devenv

Table of Contents

I just wanted to give zig a try using Ziglings, and realized the latest available of this programming language on Nix package repository is old according to ziglings’ standards and I’m not able to run the project (at the time of this writing NixOS has version 0.13 available, while the latest beta version is 0.15).

A quick search later, I ended up with zig-overlay, by Mitchell Hashimoto, and was able to use it on devenv, as follows:

  1. Add the overlay to devenv.yaml file under inputs section:

    inputs:
      nixpkgs:
        url: github:cachix/devenv-nixpkgs/rolling
      zig:
        url: github:mitchellh/zig-overlay
    
  2. Then enable the language in devenv like:

    # https://devenv.sh/languages/
    languages.zig = {
      enable = true;
      package = inputs.zig.packages.${pkgs.system}.master;
    };
    

And that’s it!

Feedback