Skip to content

Feature: Add an additional flake output that allows building a static binary

In this thread on the NixOS Discourse about statically-linked nix, I found this utility very useful to unpack NARs in an environment without Nix.

However, to be able to deploy it easily, I had to build it statically:

rustup target add x86_64-unknown-linux-musl
cargo build --target=x86_64-unknown-linux-musl --release --workspace

This worked perfectly, but it would be even better if there was an output on the flake for this.

Then one could just run

nix build gitlab:abstract-binary/nix-nar-rs#packages.x86_64-linux.static

to build a static binary. It would be even better if this supported all architectures. I'm willing to look into this myself soon and submit a PR for it soon-ish, but if you have a clear idea of how this could be achieved and time on your hands, don't hesitate to implement it yourself :)