-
Notifications
You must be signed in to change notification settings - Fork 1
Description
I wanted to do a small write-up on what I think we'll need for an initial proof-of-concept release. Hopefully with this list it will be easier for us to have a conversation about how to split up the work.
-
A web api. We'll need a web api that can accept http requests like
binplz.dev/stack
, and know how to parse out that the user actually wants thestack
binary.I'm imagining doing this as a Haskell servant API, but I imagine our API will be simple enough that it doesn't really matter what we use.
In the future I'd also like to support additional url parameters like the following:
binplz.dev/stack.tar.gz
for downloading a whole package (instead of just a single binary), or potentially a whole closure. Also URL parameters like the following:binplz.dev/procps?arch=aarch64-linux&binary=ps&nixpkgs_commit=abcde1234&linking=dynamic
. We definitely don't need to support these types of things in our initial proof-of-concept release, but we should at least try to to implement our proof-of-concept in a way that doesn't makes it impossible to implement these types of additional features.Another worry I have here is whether or not we have to worry about http timeouts. Building a binary could potentially takes tens of minutes, and I'm worried that
curl
will timeout.edit: completed in Server #6
-
Determine package from bin name
We also need to decide whether we'd like the path (likestack
orprocps
in the example above) to refer to a Nixpkgs top-level attribute name, or an actual binary. Having it refer to an actual binary would be easier for end-users, but significantly harder for us. For instance, even for theps
binary, there are a bunch of packages to that provide it:$ sqlite3 ~/.nix-defexpr/channels/nixos-unstable/programs.sqlite sqlite> select * from Programs where name = "ps" and system = "x86_64-linux"; ps|x86_64-linux|busybox ps|x86_64-linux|cope ps|x86_64-linux|procps ps|x86_64-linux|ps ps|x86_64-linux|toybox ps|x86_64-linux|unixtools.procps
We don't really have a good way to know that
ps
should come fromprocps
. -
A function to take a Nixpkgs top-level attribute (like
stack
,xterm
,haskellPackages.weeder
, etc), fork off anix-build
process, monitor thenix-build
process, and return either a binary whennix-build
is finished, or an error.I think this is relatively straight-forward, except that we want to make sure the user can't build some arbitrary Nix code that includes the output of
buitins.readFile /etc/shadow
or something weird. I think there are nix-build options you can pass to disable these types of built-ins, but we'd need to research it.We also likely want to cache negative build results. We'd ideally like to cache negative build results per derivation, but I don't know how easy that would be.
We probably also want to make sure that we run builds until they finish (so that the derivation output is cached), even if a user presses Ctrl-C on
curl
and disconnects from the api. -
Some sort of static documentation website / landing-page. I'm imagining that accessing the top-level
binplz.dev/
will redirect todocs.binplz.dev
, and we can host the docs on github or something. I think https://nixery.dev/ is really nice, and we should basically just copy what they do.