/zig-overlay

Nix flake for Zig binaries

Primary LanguageNixBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Nix flake for Zig

Description

In this repository lives a Nix flake packaging the Zig compiler binaries using the data provided by the Zig team.

Provided utilities

  • Nightly versions updated daily (.master.<date>), starting from version 0.8.0-dev.1140+9270aae07 dated 2021-02-13, and latest master (.master.latest) for the sake of convenience.
  • Release versions.

Usage

Without flake support?

Import in your project as you would normally (pkgs.fetchFromGitHub or builtins.fetchgit), with (hopefully) no tinkering needed! The default.nix exposes a pkgs argument for possible pinning of the Nixpkgs repository, and a system argument which defaults to builtins.currentSystem.

To make it visible in your system configuration:

# It is a good idea to use an exact commit in place of 'main' here.
let zigf = fetchTarball "https://github.com/arqv/zig-overlay/archive/main.tar.gz" in
  # If you're using home-manager
  home.packages = [ zigf.master.latest ]; # or any available version
  # If you're using NixOS
  users.user.<username>.packages = [ zigf.master.latest ]; # or any available version
# ...the rest of your configuration

With flake support?

In your flake.nix file:

{
  inputs.zig.url = "github:arqv/zig-overlay";
  outputs = { self, zig, ... }: {
    ...
  };
}

In a shell:

# run the latest version (0.7.1)
$ nix run 'github:arqv/zig-overlay'
# open a shell with master version dated 2021-02-13 (oldest version available)
$ nix shell 'github:arqv/zig-overlay#master."2021-02-13"'
# open a shell with latest master version
$ nix shell 'github:arqv/zig-overlay#master.latest'

For contributors

The update script manages updating the information in sources.json. The only dependency is Nix, and it’s written internally in Ruby.