Kirikae: A NixOS deployment tool written in Zig

kirikae


This is my first “larger” project in Zig. I’m fairly new to the language. The inspiration for the project came from colmena, which I used prior to writing this tool. I found colmena lacked features I really wanted/needed so I set out to write a similar tool myself and simultaneously further my understanding of Zig.

I am well aware the code quality is probably quite bad. I basically made a best effort of structuring and avoiding duplication, yet I am unhappy with the code’s readbility and how it is structured. The nix-side is definitely thought out more than the actual Zig code. Most importantly though, I have a logo ^^

The following will probably only make sense to people who are already familiar with Nix (flakes). The project works by mapping each kirikae.hosts entry to a nixosConfiguration with the same name. Refer to the project’s README.md for a more detailed example. It then offers a variety of subcommands, ranging from just building or applying a specific, or all configurations, to simply spawning a shell or running a command remotely. For a full list refer to the project’s README.md.

We currently use this project at our local hack space, to deploy NixOS-VMs and -LXCs.

While writing this project I learned more about how to hold the “new” Io a bit better. I hope to learn more about writing Zig, moving this project forward.

Feel free to leave feedback and suggestions for improvement, I’d love to hear it ^^

Supported Zig versions

Currently targeting 0.16.0.

Source

The source repo can be found on SourceHut or GitHub.

4 Likes

Nice project !

You made me remember I wanted to try nixos :wink:

2 Likes

Hello fellow Nix person :waving_hand:

The only suggestion I have is that the --on/--not-on syntax is a little ambiguous. When I pass those flags, is it saying to exclude the operand from the action that’s being applied, or is it saying the desired end state (“turn this machine on/off”)?

I never used colmena myself, so maybe it makes more sense to someone that has used it. I usually do the grug-brained thing and just do a rebuild/switch with a remote target.

this reply was written using NixOS :wink:

good work

1 Like