tvl-depot/third_party
sterni 93a746aaaa feat(web/bubblegum): nix CGI programming framework
So here is what has been keeping me up at night: At some point I
realized that nix actually made a somewhat passable language for CGI
programming:

* That `builtins.getEnv` exists as one of the impurities of Nix is
  perfect as environment variables are the main way of communication
  from the web server to the CGI application.

* We can actually read from the filesystem via builtins.readDir and
  builtins.readFile with bearable overhead if we avoid importing the
  used paths into the nix store.

* Templating and routing are convenient to implement via indented strings
  and attribute sets respectively.

Of course there are obvious limitation:

* The overhead of derivations is probably much to great for them to be
  useful via IfD.

* Even without derivations, nix evaluation is very slow to the point
  were a trivial application takes between 100ms and 400ms to produce a
  response.

* We can't really cause effects other than producing a response which
  makes it not viable for a lot of applications. There are some ways
  around this:

  * With a custom interpreter we could have streaming and multiplexed
    I/O (using lazy lists emulated via attrsets) to cause such effects,
    but it would probably perform terribly.

  * We can use builtins.fetchurl to call other HTTP-based microservices,
    but only in very limited constraints, i. e. only GET, no headers,
    and only if the tarball ttl is set to 0 in the global nix.conf.

* Terrible error handling capabilities because builtins.tryEval actually
  doesn't catch a lot of errors.

To prove that it actually works, there are some demo applications,
which I invite you to run and potentially break horribly:

    nix-build -A web.bubblegum.examples && ./result
    # navigate to http://localhost:9000

The setup uses thttpd and executes the nix CGI scripts using
users.sterni.nint which automatically passed `depot`, so they can
import the cgi library.

Change-Id: I3a22a749612211627e5f8301c31ec2e7a872812c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2746
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-04-01 18:50:36 +00:00
..
abseil_cpp merge(3p/absl): subtree merge of Abseil up to e19260f 2020-11-21 15:48:57 +01:00
alsi revert(glittershark): "Temporarily skip grfn's subtree" 2020-08-28 21:24:36 +00:00
apereo-cas chore(3p): Bump NixOS channels to 2021-02-18 2021-02-19 14:45:43 +00:00
bat_syntaxes feat(3p/bat_syntaxes): Add a derivation to extend bat syntaxes 2020-06-15 16:52:23 +00:00
bufbuild chore(3p): Bump nixos-unstable channel 2020-08-17 09:54:18 +00:00
cgit chore(third_party/cgit): use lib instead of stdenv.lib 2021-04-01 17:30:20 +00:00
elmPackages_0_18 fix(gemma): Fix build by backporting Elm 0.18 2021-03-24 00:54:43 +00:00
emacs refactor(3p/exwm): Inline build instructions instead of overriding 2021-01-10 13:32:47 +00:00
farmhash feat(third_party): Add Google's farmhash library 2020-05-08 18:39:43 +01:00
ffmpeg feat(third_party/ffmpeg): Add "libnpp" support to ffmpeg 2020-04-04 02:36:20 +01:00
gerrit chore(3p/gerrit): Update pinned dependency hash 2021-03-21 13:01:51 +00:00
gerrit_plugins chore(3p/gerrit_plugins): Build plugins separately in CI 2021-03-21 13:01:51 +00:00
git merge(3p/git): Merge git subtree at v2.29.2 2020-11-21 19:45:56 +01:00
gitignoreSource fix(gs/xanthous): update xanthous.cabal, make CI catch such errors 2021-03-19 23:21:54 +00:00
glog fix(3p/nix): Link to glog built by Nix 2020-07-05 16:54:12 +00:00
gopkgs chore(3p/gopkgs): 'depot.buildGo' -> 'depot.nix.buildGo' 2021-03-23 23:44:14 +00:00
grpc chore(3p): Bump NixOS channels to 2021-02-18 2021-02-19 14:45:43 +00:00
gtest chore(3p): Bump nixpkgs to nixos-unstable from 2020-11-21 2020-11-21 23:18:27 +00:00
hii feat(third_party): init hii at 1.0.0 2021-04-01 11:29:51 +00:00
impermanence feat(3p): Import nix-community/impermanence module 2021-03-21 00:55:58 +00:00
irccat feat(3p/irccat): init at '06a985y4' 2020-11-08 18:38:08 +00:00
kernelPatches/trx40_usb_audio feat(3p/kernelPatches): Add kernel audio patch for ASUS TRX40 Pro 2020-06-20 22:27:03 +00:00
lieer chore(3p): bump NixOS channels to 2021-03-18 2021-03-19 14:00:50 +00:00
lisp fix(3p/lisp/puri): Use fetchgit for source, update version 2021-03-27 16:10:20 +00:00
naersk chore(3p/naersk): Update to latest 'master' 2020-05-25 23:36:20 +01:00
nix chore(3p): Bump NixOS channels to 2021-02-18 2021-02-19 14:45:43 +00:00
nixpkgs-exposed feat(web/bubblegum): nix CGI programming framework 2021-04-01 18:50:36 +00:00
notmuch fix(3p/notmuch): Rebase dottime patch on notmuch 0.31 2020-12-14 19:41:30 +00:00
nsfv feat(3p/nsfv): Add derivation for NSFV 2020-06-25 02:27:38 +00:00
openldap feat(3p/openldap): Enable slapd-passwd-argon2 module 2020-07-01 19:10:13 +00:00
protobuf feat(3p/protobuf): Check in derivation for proto 3.12 with libcxx 2020-06-07 14:56:56 +01:00
python/broadlink feat(3p/python/broadlink): Add max_devices discovery parameter 2020-04-26 14:50:04 +01:00
rapidcheck feat(3p): Add rapidcheck 2020-07-19 16:26:52 +00:00
rr chore(3p/rr): Upgrade to latest master with Zen workarounds 2020-09-23 15:23:25 +00:00
smtprelay feat(nixos/smtprelay): Add derivation & module for SMTP relay 2020-06-13 01:23:01 +00:00
telega feat(3p/telega): Pin tdlib version used for telega 2021-01-26 13:25:43 +00:00
default.nix feat(third_party): add dhall packages from easy-dhall-nix 2021-04-01 11:27:39 +00:00
README.md docs(third_party): Add README 2019-06-29 14:12:38 +01:00

Third-Party Code

Code under this folder is one of the following:

  1. Externally developed dependencies which have been imported ("vendored") into this repository. These dependencies come with their own licenses and whatever else.

  2. Code that is developed inside of this repository, but released to an external repository via Copybara.