snix/web/content/docs/guides/building.md
Domen Kožar 5b81892ddf chore: load snix shell using direnv
Change-Id: I6edd4aff7b46d8f3f75462d1576b3f4ffd7f16b8
Reviewed-on: https://cl.snix.dev/c/snix/+/30304
Reviewed-by: Florian Klink <flokli@flokli.de>
Tested-by: besadii
2025-04-09 12:03:59 +00:00

2.4 KiB

title slug description summary date lastmod draft weight toc
Building Snix building 2025-03-14T14:14:35+01:00 2025-03-14T14:14:35+01:00 false 11 true

This document describes how to build the project locally, both for interactive development as well as referring to it from Nix code (for example, to run one of its binaries on your machine).

{{}} Please check the [Contribution Guide]({{< relref "contributing" >}}) on how to contribute after following this guide. {{}}

Requirements

Getting the sources

Snix is hosted in its own Forgejo instance, hosted on git.snix.dev, and a (read-only) mirror on GitHub.

Check out the source code as follows:

$ git clone https://git.snix.dev/snix/snix.git

Interactive development

$ direnv allow

This provides all the necessary tools and dependencies to interactively build the source code, using cargo build etc.

Building only

It is also possible to build the different Snix crates with Nix, in which you don't need to enter the shell. From the root of the repository, you can build as follows:

$ nix-build -A snix.cli

Alternatively, you can use the mg wrapper from anywhere in the repository (requires the direnv setup from above):

$ mg build //snix:cli

This uses crate2nix to build each crate dependency individually.

Binary cache for Development

If you want to fetch store paths built by CI, you can configure our Harmonia deployment as a Nix substituter:

{
  nix.settings.trusted-public-keys = [
    "cache.snix.dev-1:miTqzIzmCbX/DyK2tLNXDROk77CbbvcRdWA4y2F8pno="
  ];
  nix.settings.substituters = [
    "https://cache.snix.dev"
  ];
}

Keep in mind there's no guarantees on paths being available, they get GC'ed eventually.

Further reading

Checkout the [Component Overview]({{< ref "/docs/components/overview" >}}) to learn more about the project structure.