diff options
author | Ben Sima <ben@bsima.me> | 2020-11-18 20:20:27 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-11-18 20:20:27 -0500 |
commit | e223b28e6820dcd9fa5c38ba22de487ada2ca0e6 (patch) | |
tree | 66061bca039242bc55338280f767d0ff64d35ba0 /Que/tutorial.md | |
parent | ac3d455a9c0dc0b2f4afb88b56db3d16c0508428 (diff) |
Extend bild to nix targets properly
Also had to capitalize some stuff, and move some nix files around and rename
the metadata directive from 'exe' to 'out' because that just makes more sense,
and fix some compiler errors. But now bild treats both nix and hs files as
buildable things. So that's cool.
One interesting example is Biz/Pie.{nix,hs} - I can either create a dev build of
the hs file with ghc, or I can create a fully-encapsulated nix build. Its nice
to have both options because a dev build with ghc takes half the amount of time,
and I can rely on my locally cached hi and ho files. I think this shows the
power of bild, but also can be a somewhat subtle thing.
The issue really is with the separate command calls in nix builds vs dev builds.
I figure there are a few ways to fix this:
1. Try to use bild inside the nix rules. That could be interesting, but could
also lead to some weird behavior or worm holes forming.
2. Extract the command line invocation into a separate file, some kind of
really simple template that gets pulled into both programs.
It is important to consider that in the future I might want to have bild do a
module-by-module nix build of programs, but I'm not sure how that would effect
my choice here.
Diffstat (limited to 'Que/tutorial.md')
-rw-r--r-- | Que/tutorial.md | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/Que/tutorial.md b/Que/tutorial.md deleted file mode 100644 index 6542ad3..0000000 --- a/Que/tutorial.md +++ /dev/null @@ -1,53 +0,0 @@ -% que.run Tutorial - -## Ques - -A que is a multi-consumer, multi-producer channel available anywhere you -have a network connection. If you are familiar with Go channels, they -are pretty much the same thing. Put some values in one end, and take -them out the other end at a different time, or in a different process. - -Ques are created dynamically for every HTTP request you make. Here we -use the `que` client to create a new que at the path `pub/new-que`: - - que pub/new-que - -The `que` client is useful, but you can use anything to make the HTTP -request, for example here's the same thing with curl: - - curl https://que.run/pub/new-que - -These requests will block until a value is placed on the other -end. Let's do that now. In a separate terminal: - - echo "hello world" | que pub/new-que - - -This tells the `que` client to read the value from `stdin` and then send -it to `example/new-que`. Or with curl: - - curl https://que.run/pub/new-que -d "hello world" - -This will succeed immediately and send the string "`hello world`" over -the channel, which will be received and printed by the listener in the -other terminal. - -You can have as many producers and consumers attached to a channel as -you want. - -## Namespaces - -Ques are organized into namespaces, identified by the first fragment of -the path. In the above commands we used `pub` as the namespace, which is -a special publically-writable namespace. The other special namespace is -`_` which is reserved for internal use only. You can't write to the `_` -namespace. - -To use other namespaces and add authentication/access controls, you can -[sign up for the Power package](/_/index). - -## Events - -Just reading and writing data isn't very exciting, so let's throw in -some events. We can very quickly put together a job processor. - - que pub/new-que --then "./worker.sh '{msg}'" |