Binplz: service that serves curl-able statically-linked binaries from Nixpkgs (that never was)

This blog post explains binplz.dev, and how it never came to be.

binplz.dev is a service a few friends and I tried to put together that would allow you easily download any statically-linked binary from Nixpkgs. It would give you the ability to do the following from any Linux distro:

$ curl binplz.dev/tree > tree
$ chmod +x ./tree
$ ./tree --version
tree v1.8.0 (c) 1996 - 2018 by Steve Baker, ...

We never ended up getting this service to a point where it was production ready. The blog post goes into what sort of problems we ran into.

I’m hoping that sharing this experience gets someone’s interest enough to try to create something similar.

15 Likes

Hi, I really like nixery for containers so I think this would be a really awesome service to have.
Would nix bundle help here at all making it possible to reuse binaries from hydra? Though the result wouldn’t be the same…

2 Likes

I’m not entirely sure of how nix bundle works internally, but I think it could definitely be another path to pursue.

If you want to ship a single file that is easily executable on any Linux distro, there are a couple different approaches you could take:

  • using things like Linux namespaces to create a virtual filesystem (which is how nix bundle works??)
  • shipping a whole Nix closure where /nix/store paths have been rewritten to relative paths (which I think is how a tool like exodus works)
  • shipping single static binaries (which is what binplz was trying to do)
  • shipping a whole Nix closure and give some easy way for the user to actually extract it to /nix/store. This might be fine when installing executables in containers.

There are probably many more approaches as well.

Ideally, a service like binplz or Nixery would support all these different methods, so that it is as easy as possible for end-users to pick whatever works the best for them.

1 Like