Commit graph

12746 commits

Author SHA1 Message Date
Vincent Ambo
7fec80cb58 feat(3p/litestream): Add derivation for litestream
This is a simple Go module build for https://litestream.io/

If this ends up being useful, we should upstream this to nixpkgs.

Change-Id: I3beb64c9adb3b57fcef4e1dfb27f293a15f90a76
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3085
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2021-05-22 17:58:31 +00:00
Vincent Ambo
814feed0ce chore(whitby): Move clbot to HackInt
Points clbot at the new local ZNC instead. This will make it part of
the things happening through the `tvlbot` account.

Relates to b/101

Change-Id: I1c15ffa5720d3af34475c15bee3fdaa537ac659b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3127
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
2021-05-22 17:57:32 +00:00
Vincent Ambo
a7b168ec9a feat(clbot): Add a flag to disable TLS connections
The local bouncer on whitby does not use TLS.

Change-Id: Idf9c56f94129b0ddce620eb559082a8f2f088078
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3128
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2021-05-22 17:54:31 +00:00
Vincent Ambo
1aad1d9beb chore(whitby): Move irccat & panettone notifications to HackInt
Change-Id: I6bd5c183d2c1c28b8c6b0201bdf22a66333d4aea
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3131
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2021-05-22 17:52:01 +00:00
multi
fd6ce088ba feat(fun/owothia): add configurable join channels.
owothia is hardcoded to join ##tvl, which is a remnant of when TVL was on
freenode, and on hackint the IRC channel is single-hash #tvl instead. Instead
of hardcoding another channel name, let's make this configurable, so we don't
need to recompile owothia for every different channel we want her in.

It's now possible to set IRC_CHANNELS in owothia's environment to '["#foo",
"#bar"]' to make her join both #foo and #bar automatically.

Additionally IRC_IDENT can now be set to configure owothia's ident,
which is required for ZNC compatibility.

Change-Id: I0fc0856f4ea35f59255b76ae0e594325f18ef993
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3130
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-05-22 15:10:17 +00:00
Florian Klink
48b052c1e4 feat(whitby): Add shadowsocks server
This adds a shadowsocks service, running on port 8443, tcp and udp.

The password is read from /etc/secrets/shadowsocks-secret.sec, and needs
to be populated externally.

Change-Id: I6797150db108ba14459502dee43d8e4ed6cfa910
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3125
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-22 13:28:36 +00:00
Florian Klink
cd2e889f41 feat(apereo-cas): move away from 127.0.0.1:8443
The following commit itends to bind on port 8443 on all interfaces,
so let's move this to something else.

Change-Id: Ibb94a0f4e6892b6e543b542b89bcdaaefb617f23
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3126
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-21 11:33:13 +00:00
Vincent Ambo
5036ae4376 feat(whitby): Initial ZNC configuration
Bouncer to be used for TVL's IRC bots, see b/101

Change-Id: Ic9f71ecd94365d3baa31e0552b1ce16362f94557
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3124
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2021-05-21 11:30:42 +00:00
Vincent Ambo
dbb011850a fix(ops/nixos): Fix typo in NIX_PATH name
Change-Id: Ic29b219ca1c536f8a99860ecdf2957a62ba95889
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3123
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2021-05-20 23:11:02 +00:00
Vincent Ambo
f748f40d0a docs: Minor updates & fixes for depot README
* update some of the project listings
* remove an invalid link to my previous Twitter account (this is from
  back before TVL was a multi-person project)

Change-Id: I049c05704d5feecc8c40718665fe98315008423f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3122
Tested-by: BuildkiteCI
Reviewed-by: cynthia <cynthia@tvl.fyi>
2021-05-19 00:10:04 +00:00
Profpatsch
952afb7da9 feat(tools): add rust-crates-advisory
We have a bunch of crates in `third_party/rust-crates`; it would be
great if we could check them for existing CVEs.

This tool does that, it takes the rust security advisory database,
parses the applicable CVEs, and cross-checks them against the actual
crate versions we list in our package database.

The dumb parser we wrote is tested against all entries in the
database, so we will notice when upstream breaks their shit.
Checking the semver stuff is easy enough with the semver crate.

If an advisory matches, it prints the whole thing and fails the build.

Change-Id: I9e912c43d37a685d9d7a4424defc467a171ea3c4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2818
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-05-17 23:00:57 +00:00
Profpatsch
72924facae fix(nix/writers/rust): remove args override
We can be closed world, so let’s restrict the arguments to the subset
we need for now.

The existing override was wrong, in that `// args` would use the
arguments we already added, again. So instead of deliberating about
how to make this work right in all cases, we don’t need it, we trim
it.

Change-Id: I6443a0808b8bfd5e4db939b669c6afc741954db8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3057
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-05-17 23:00:57 +00:00
Vincent Ambo
8dfc7a9f9d feat(grfn/modules/laptop): Enable TLP service
This service performes automatic power tuning and has effectively
replaced powertop's tuning functionality in modern systems.

Change-Id: I63c6999beed64d96c77b8b9287ed0d5fa6ddd9fa
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3121
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2021-05-13 12:24:08 +00:00
Vincent Ambo
3033de5792 fix(yeren): Force enable ASPM in kernel parameters
This might help with the issue of devices being stuck in a slow
power-saving mode after hibernation. Dell enables this on laptops
shipping with Linux by default according to some forum posts.

Change-Id: I3d7fdb5c2ed5e24289a6c20f21d027e11b7826e5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3120
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2021-05-13 12:24:08 +00:00
sterni
c8ecea1032 docs(cheddar): fix typo in build.rs comment
Change-Id: Id323b4a187b3837d60ac6b8917f3e8571954b8e6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3119
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-05-12 15:38:57 +00:00
sterni
5177743f77 feat(tvl/template): use atward for dispatching to README.md
Ideally this means everyone gets to use their preferred code viewer.

Change-Id: I11005023c33eb111afd6c19b36d05dc581494ceb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3118
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-12 15:37:40 +00:00
sterni
1da235518a feat(web/atward): make checkbox label clickable
Change-Id: I147f1f2eee4f6b8f7ecea1b341d192477182d61c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3116
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-12 15:36:44 +00:00
sterni
c92f4ceacc refactor(web/atward): translate index page to markdown
Change-Id: I03ccbec1dd8ba58d80bd97eb40148dd395e500b2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3115
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-12 15:36:44 +00:00
sterni
25ff41452b feat(tvl/template): support markdown via cheddar
Since the template already was a derivation we can just reimplement a
specialized writeText which runs cheddar on parts of its input to avoid
import from derivation.

Change-Id: I0cffd0e86fd23a749599174260d04269379f4b5f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3114
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-12 15:36:44 +00:00
sterni
513e733f8a feat(tvl/template): link to atward in footer
Change-Id: I929b8344251ceaba5a22c735c599407a0ec162a6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3113
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-12 15:36:44 +00:00
sterni
040416b3eb refactor(web): common template for index pages of tvl and atward
Use simple string interpolation based approach to templating and allow
changing the main body, the title and to inject extra HTML into the head
element. Additionally we can use `https://tvl.fyi/` instead of `/` when
referring to assets.

One limitation currently is that the template only works for index pages
(it link to self using `href="/"`), but this should be easy to fix.

For atward, instead of using the `onload` attribute of `body`, we now
register an event listener in JavaScript which makes the template code
less complicated. When building the derivation the template is rendered
to HTML and injected into the source.

Change-Id: I2ea0c5bf5f6286e781285ade7751a348bab3bdc8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3112
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-12 15:36:44 +00:00
Vincent Ambo
a989a91f9f chore(tazjin/emacs): Ignore messages from blocked senders in telega
telega actually supports this for group chats, too, which is very
pleasant.

https://zevlg.github.io/telega.el/#client-side-messages-ignoring

Change-Id: I510207c2de19f748359168d460a25aa9c4e45975
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3111
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-12 13:25:42 +00:00
Vincent Ambo
ebf6301941 feat(atward): Support reading configuration from cookies
Adds support for reading configuration (currently only the `cs`
parameter) from cookies and from URL query parameters. The latter take
precedence if set explicitly.

This is useful for users which can not edit their search query
parameters.

To make this easier to use the atward landing page has been updated
with a simple form where settings can be toggled. This requires
Javascript, but the script is small, embedded and MIT licensed (as is
the rest of this project). Users without Javascript will be shown a
notice about this.

It is of course possible to set the cookies manually, too.

Change-Id: Ie9a9dbeab4d9a97a349d7988e21f1b46037e1f72
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3110
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-05-12 13:19:11 +00:00
Griffin Smith
2a97eda3b3 feat(gs/emacs): Update async test snippet for tokio 1.x
Change-Id: I897f3efae7920dee678f6ca03d743b12212b766c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3109
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
2021-05-12 10:33:37 +00:00
Griffin Smith
f790e72763 fix(gs/emacs): Correct next/prev error bindings
next-error and prev-error are weirdly broken in ways I don't entirely
understand, but I only really use flycheck so I can just use the
flycheck ones instead

Change-Id: Icdb25950f6fdcca163c68db30366af0f6fa28d7d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3108
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
2021-05-12 10:33:37 +00:00
Florian Klink
85001c3540 fix(web/tvl): add two pixels to make favicon square
Fixes b/126.

Change-Id: I5caac45797738bccdbc346288fdf891dafdcefbb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3106
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-05-11 22:50:58 +00:00
Vincent Ambo
cb497a0cca feat(atward): Serve OpenSearch XML file to support Firefox
Firefox users can not easily add search engines to the browser unless
the page serves an OpenSearch description. This CL adds said
description according to the documentation:

https://developer.mozilla.org/en-US/docs/Web/OpenSearch

Change-Id: I358c5940304f4abd9e45dd72a64e46d3ce44b3e3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3105
Tested-by: BuildkiteCI
Reviewed-by: cynthia <cynthia@tvl.fyi>
2021-05-11 22:45:08 +00:00
Vincent Ambo
99d11bef5f feat(atward): Add an index page with setup instructions
Adds an index page that is rendered when there is no query parameter
in the URL. This means that going to at.tvl.fyi / atward.tvl.fyi
yields an actually useful page.

Change-Id: I018973a3c3e8b7b7167876fa99f34a008a17a4f2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3104
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2021-05-11 22:45:08 +00:00
Vincent Ambo
259cbfd0b2 chore(owothia): move to //fun/owothia
Owothia graduates, or something.

Mostly I don't want infrastructure to depend on stuff in //users.

Does anyone know where owothia is running anyways?

Change-Id: I198c7ac935736c7aee3ba4fbda1453b82aa10283
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3103
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2021-05-11 21:34:51 +00:00
Vincent Ambo
13336c6057 feat(atward): Add 'cs' query parameter to toggle Sourcegraph support
Users can set `?cs=true` to be sent to cs.tvl.fyi instead of
code.tvl.fyi for things that look like code paths.

Change-Id: I7c8f9b71cde25d35787c941e5308330c6f16f8d7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3102
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-11 14:20:31 +00:00
Vincent Ambo
d4bdfe8127 refactor(atward): Construct an atward query type from user requests
Rather than dealing with passing down the rouille request to
handlers (which would have become necessary as we start supporting
more user-controlled features), a new `atward::Query` type is
constructed from requests and passed to the dispatching logic instead.

For now this introduces no new features, it just shuffles things
around to prepare for that.

Change-Id: I08e18422c1fdbac4712c739a7acbb810ada697ca
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3101
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-11 14:20:31 +00:00
Vincent Ambo
8c2084d0a1 feat(tvix/proto): Add evaluator communication proto
This adds the proto messages and service definition used for
communicating with our evaluator.

Please refer to the `Tvix - Component interaction` document for a
detailed description of the interactions that this service is used
for.

Change-Id: If44cdbff66c6cfe88c22a748fe29c0bbd8510b0d
Co-Authored-By: Florian Klink <flokli@flokli.de>
Co-Authored-By: Adam Höse <adisbladis@gmail.com>
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2685
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Reviewed-by: grfn <grfn@gws.fyi>
2021-05-08 22:50:34 +00:00
Vincent Ambo
61783bd2ba fix(atward): Better align unsupported query error with inspiration
If you can make sense of this commit, it will make sense to you.

Change-Id: Ib223bf97b7a28828a04f01bc96365f654549fa60
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3100
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-06 21:33:39 +00:00
Vincent Ambo
4de6648ae9 refactor(atward): Rename Query -> Handler
Query is actually going to be a ... Query.

Change-Id: Icc910a8eef47e201054cb1346bc4059c0458659f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3099
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-06 21:33:39 +00:00
Vincent Ambo
c7af7ca91d chore(sourcegraph): Increase nofile ulimit for Sourcegraph
Sourcegraph logs warnings about this on startup otherwise. Unclear
to what degree it really affects operation though.

Change-Id: I6ee7c5358631aafd9a7f8155150361bf7499314d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3098
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-06 19:28:14 +00:00
Vincent Ambo
90db61a6f4 feat(web/atward): Support depot paths (to cgit for now)
Sends depot paths (such as //web/atward or //nix/readTree/README.md)
to cgit. If Markdown files are detected the user is sent to the about
page to get the rendered view.

Future work will make cgit vs. SourceGraph configurable.

Change-Id: I48dea2dc8994644fb5a6f4bfbb846c771996cfc3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3095
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-06 13:39:23 +00:00
Vincent Ambo
67389b6b0b fix(atward): Use 'q' query parameter for query instead
This removes a bunch of awkwardness around slashes in URLs, which also
frequently feature in our patterns.

Change-Id: I68c69d4c68436421951ee133bfbc067609f27bb6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3097
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-06 10:23:46 +00:00
Vincent Ambo
55c4b8d4c0 fix(ops/www): Fix typo in nginx configuration
Change-Id: I5ee7307acae548cc7779fe715ea4aad620fe8f5c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3096
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-05-05 09:48:49 +00:00
Vincent Ambo
7926482f1c feat(ops/www): Configure atward.tvl.fyi and its aliases
Change-Id: I20dfb057f8184899226bcb4527010a6982d426f0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3094
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-05-05 09:02:58 +00:00
Vincent Ambo
47d07e7b5f refactor(atward): Configure listen address
This appeases the flokli.

Change-Id: Ib6a6c1a2cc8780e7944913d9204b42505b29fdc0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3093
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-05-05 09:02:58 +00:00
Vincent Ambo
a9902dadcf feat(cheddar): Implement highlighting of CL and bug shortlinks
Implements highlighting of shortlinks like cl/123, or b/123.

Highlighting works by replacing the input Markdown using a simple
regular expression replacement.

We also considered parsing and replacing these links in the Markdown
AST, but it would have been significantly more complex (due to arena
allocation) for little upside and no obvious performance benefit.

Change-Id: I53f03fb17491046d89d0b7f605929571c11ee9a8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3082
Tested-by: BuildkiteCI
Reviewed-by: eta <eta@theta.eu.org>
2021-05-04 15:50:26 +00:00
Vincent Ambo
57502cfc46 feat(atward): Add query for changelists
Adds a query for things like cl/42

Change-Id: I144ee25c0f2c9956c81b349d653c5fec42602f9f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3092
Tested-by: BuildkiteCI
Reviewed-by: eta <eta@theta.eu.org>
2021-05-04 15:47:56 +00:00
Vincent Ambo
47986fdc21 chore(3p/josh): Bump version to latest HEAD
This lets us drop the patch for pinning the git library, as this one
is now pinned to something upstream.

Change-Id: Ib8026f5f22e2e49371a2bad83aa726c2951570e4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3086
Tested-by: BuildkiteCI
Reviewed-by: eta <eta@theta.eu.org>
2021-05-04 15:47:08 +00:00
Vincent Ambo
790c0d938e feat(ops): Add NixOS module for atward
Very standard, nothing fancy.

Change-Id: Ibb286f221a4752abfb62e971b98e9496357040f5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3090
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2021-05-03 23:47:30 +00:00
Vincent Ambo
5b45eae276 feat(ops/dns): Add hostnames for atward (at.*, atward.*)
The shorter one is going to be more convenient when we get
go-link (or, well, at-link) support.

Change-Id: Ic24adcdad679b893c40c87731add818660259dac
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3091
Tested-by: BuildkiteCI
Reviewed-by: isomer <isomer@tvl.fyi>
2021-05-03 22:55:36 +00:00
Vincent Ambo
8c0776485e feat(web/atward): Wire up query resolution to a web server
Adds a simple web server which logs all incoming requests and either
sends the user to the correct destination, or gives up and displays an
error (in the future there'll be fallback searches so that peopple can
use this as their default search engine easily).

Change-Id: I4f10472dbc74fa9cc71fad0533da38eda2b6077c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3089
Tested-by: BuildkiteCI
Reviewed-by: isomer <isomer@tvl.fyi>
2021-05-03 22:55:36 +00:00
Vincent Ambo
51b5475f40 feat(web/atward): Implement match scaffolding for TVL redirector
atward is going to be a new TVL service, living at atward.tvl.fyi,
which users can configure as a search engine in their browser.

It will understand a variety of TVL-specific query types (such as
bug/CL links or code paths). In the future it might also support
features like go-links.

This commit configures the initial setup for query matchers in atward
and adds an example query type (for bugs).

This is not yet wired up to a web server.

Change-Id: Ifaf06c3f5cc378eee7894b7576ef583fc89264f0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3087
Tested-by: BuildkiteCI
Reviewed-by: isomer <isomer@tvl.fyi>
2021-05-03 22:55:36 +00:00
Profpatsch
35aa79d14b feat(users/Profpatsch/blog): add rust-string-conversions note
Change-Id: I7bee585935e65660f6b25b88ed33f09775eb01a0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3088
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-05-03 22:22:33 +00:00
Vincent Ambo
5e6685c689 feat(cheddar): Add a build script that injects BAT_SYNTAXES
The BAT_SYNTAXES environment variable is injected during Nix builds
and points to the build result of //third_party/bat_syntaxes, which is
included in the cheddar binary.

During development this is a bit annoying: Opening a Nix shell will
set the right variable, but it will also mess with the Cargo
environment in ways that make it annoying to use (*and* require a
pre-build of all dependencies as required by naersk).

For an easier development flow, this adds a build script that
automatically runs Nix, fetches the path to the syntax set and sets
the environment variable. It is a no-op if the variable is already
set.

This makes for a smoother development experience when working on
cheddar in a depot checkout.

Change-Id: Ib5435518897e3443247edd9f362821c0b9ff756b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3081
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2021-05-03 20:18:33 +00:00
Vincent Ambo
d311af9bc0 refactor(cheddar): Split out a library with rendering logic
Splits `main.rs` into `lib.rs` and `bin/cheddar.rs`, which enables
reuse of cheddar's rendering logic in other Rust applications.

Change-Id: Ifd1a44a8d1620c595550a0a497a25b0563e917ca
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3060
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2021-05-03 13:57:43 +00:00