Compare commits

...

318 commits

Author SHA1 Message Date
sinavir
3389c550b9 fix(nar_bridge): Don't check if root node has a name in nar generation
Nar-bridge tried to parse the name of the protobuf node encoded in the
URL into a PathComponent but this name was empty, leading to an error
when the user tried to retrieve the nar file. This commit removes this
useless step and fixes the errors caused by it

Change-Id: I2996cdd2e0107133e502748947298f512f1cc521
2024-09-22 23:35:54 +02:00
sinavir
240b6a8ba4 fix: Fix compilation from outside
Change-Id: I6f2ad235e00b8a08a8ec061f0a822881a2d83bca
2024-09-18 18:39:38 +02:00
Yureka
85fd360bfa feat(tvix/castore/directoryservice): add Router combinator
Change-Id: Iea945a119bfc70d5f089506fcde7d7a466496808
2024-09-18 18:39:38 +02:00
sinavir
3b16bacb8c feat(tvix/store): Add a signing PathInfoService
- Add a new PathInfoService implementation that wraps transparently
around another except that it dynamically signs all the incoming
path-infos with the provided signer.

- Add a ServiceBuilder for this PathInfoService that provides a
SigningPathInfoService with a keyfile signer

Change-Id: I845ddfdf01d14c503c796b2b80c720dab98be091
2024-09-18 18:39:38 +02:00
Vincent Ambo
1f5a20736a chore(3p/sources): bump channels & overlays (2024-09-17)
* users/aspen: disable readyset overlay

  sysbench + postgresql is broken, which breaks the overlay, but I suspect the
  overlay is no longer needed

Change-Id: I1845370c88f5fab35fd700535e6fb0972a4ca556
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12494
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: flokli <flokli@flokli.de>
Reviewed-by: aspen <root@gws.fyi>
2024-09-17 21:16:21 +00:00
Vincent Ambo
e2aa81c0b2 chore(tazjin/dotfiles): reduce gaps
Change-Id: Ia73627328c8ebb6e3e4decf9236f4c155f1c4669
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12496
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-17 16:23:50 +00:00
Vincent Ambo
29f160963e chore(tazjin/niri-reap): bump to niri 0.1.9
This is a stable release that has the IPC features this crate depends on.

Change-Id: I4aaba076a53d7a95a00dd2d59a02c69af6c4d63a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12495
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
2024-09-17 16:23:50 +00:00
Vincent Ambo
e04bbe92a0 fix(tazjin/koptevo): fix yggdrasil listening configuration
Change-Id: Ic7b89fc61f7d5b74e420ae633b2ced26c20909c3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12492
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-09-16 08:20:45 +00:00
Vincent Ambo
684a06ac3c fix(tazjin/dotfiles): ensure EDITOR=emacsclient is set
Change-Id: I5ab162545493367c0e92c7737800c0c5e23f221e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12491
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-09-15 00:42:12 +00:00
Vincent Ambo
9b6ebb947b fix(3p/radicle-explorer): remove dependency on plausible
This is some sort of calling home analytics thing. Lets not have that.

Change-Id: I59fcf747c8269052dd3d346bb0873adc38834803
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12490
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-15 00:25:02 +00:00
Vincent Ambo
10c2866ccd fix(tazjin/nixos): set rad.tazj.in as preferred seed in explorer
This requires overriding build-time configuration, so I've added a little fixed
point that takes care of that.

Change-Id: Ie990e362c6e00aa6e3be66b04af4b62034b03515
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12489
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
2024-09-15 00:18:28 +00:00
Vincent Ambo
767bc726ef feat(tazjin/nixos): serve radicle explorer UI on koptevo
Change-Id: Ie5075ee8d2663bfffb3f90388a46f9bc19f6e462
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12488
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-09-14 23:47:29 +00:00
Vincent Ambo
e737488d92 feat(3p/radicle-explorer): package radicle web interface
For some reason this is not included. The build is based on their experimental
Nix code upstream which I copy&pasted and modified a bit.

Change-Id: I523f9e90a3f5feca0deb317eec1d5283e2a3ca98
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12487
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-09-14 23:47:29 +00:00
Vincent Ambo
af6dc48971 feat(tazjin/nixos): run Radicle seed node & httpd on koptevo
Change-Id: Icd433f433c0abe8f54735ab45a636b4561fe8d3e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12486
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-09-14 23:47:29 +00:00
Vincent Ambo
0022285600 feat(tazjin/nixos): set up yggdrasil on all physical machines
Change-Id: I1d722c6d2e6192c445e77cb9b186a5320c2a60ec
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12485
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-14 23:47:29 +00:00
Vincent Ambo
c9eeb7da70 feat(tazjin/nixos): serve homepage on yggdrasil
First test of running an Yggdrasil service, lets see how that goes!

Change-Id: Iac10b72f7314a45df13ea539c5c1cef6c994154f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12484
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-14 23:47:29 +00:00
Vincent Ambo
7593592241 chore(users/tazjin): move my homepage module into //users
This was in //ops for legacy reasons, but this is really not necessary.

Change-Id: I758b257838993ef0f7d55809c137118826e2ba85
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12483
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-09-14 23:47:29 +00:00
Vincent Ambo
7f5956b2be feat(tazjin/koptevo): configure yggdrasil network
I'm looking to replace tailscale with this for some use-cases.

Change-Id: I00f765a403879ef048e635a6fedcfdde3f685159
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12482
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-14 23:47:29 +00:00
Vincent Ambo
adf8a7da87 feat(tazjin/nixos): issue wildcard cert for yggdrasil services
Issue a wildcard certificate using the Yandex Cloud DNS plugin (which is where
DNS for tazj.in is hosted).

Change-Id: I44fa48add660f4f4324ec4b056a81d78c45ff4f4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12481
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-14 23:47:29 +00:00
Profpatsch
e5edb3b192 feat(users/Profpatsch/lyrics): fall back to plain lyrics
if there are not synced lyrics.

Change-Id: I3e8d452fc63847505886ea0bb01d29dd5dcb56d1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12477
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2024-09-13 13:44:03 +00:00
Profpatsch
e826ffb19c feat(users/Profpatsch): add lyric
Change-Id: I3171d19f1cd550ef22a3a7e851f9d27d3bf34949
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12476
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2024-09-13 13:44:03 +00:00
Profpatsch
5c57529675 feat(users/Profpatsch): add xdg-cache-home
Change-Id: I0f4efa16426f590cee9332d11c13dd07569b4acb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12475
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2024-09-13 13:44:03 +00:00
Profpatsch
af5ce5489f chore(users/Profpatsch): remove git-db & rust deps
This never went anywhere.

We had problems with `git2` breaking, so let’s remove everything that
this pulled in.

Change-Id: Ia29d827cd6fc7b97aedca36a37f8418384579c38
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12474
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2024-09-13 12:06:12 +00:00
Profpatsch
fcd4bfccdf fix(users/Profpatsch/README): typo
Change-Id: I7176289cd7884e795cfe283fc1ec3fcc674acae6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12473
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2024-09-13 11:13:59 +00:00
Profpatsch
1bddd9a001 fix(users/Profpatsch/.gitignore): add nix results
Change-Id: I44322b61b0653220173c3b5008ffa0ff727cfd35
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12472
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2024-09-13 11:13:59 +00:00
Profpatsch
9d02fc4ff1 feat(users/Profpatsch/MonadPostgres): add unzipPGArray fns
Change-Id: I47ae3520998c1da7a8ad34231fd5af39240a771d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12471
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2024-09-13 11:13:59 +00:00
Profpatsch
f49e047588 fix(users/Profpatsch/whatcd-resolver): refresh table on delete
Instead of serving a stale table when a torrent gets deleted, fetch
the whole view again. This is a little wasteful, but torrents
shouldn’t get deleted very often, so it’s fine.

Change-Id: If33d517270421881852158f27dbc3e7d24880d3b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12333
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2024-09-13 11:13:59 +00:00
Profpatsch
f6dc1f1819 fix(users/Profpatsch/whatcd-resolver): also delete db torrent file
If transmission does not know about a torrent file anymore, we should
not only delete our local transmission torrent hash, but also the
torrent file.

Before, it would always display the old weighted torrent, even after
removing it from transmission. Now, it will automatically clear and
switch to the new top-weighted mp3 version.

Small bug: since we only clean the torrents after already fetching the
table data, we get a stale result right after clean-up. Maybe we
should re-do the fetch instead.

Also logs what gets deleted and only ever deletes if there is
something to delete, leading to more obvious traces.

Change-Id: I0f6c1dc3669d0f549efaba2c46c34b77c1eb7e33
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12332
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2024-09-13 11:13:59 +00:00
Profpatsch
861b7caa06 feat(users/Profpatsch/whatcd-resolver): add format to table
Change-Id: I6ca18ad9f73a8e75e4bfb77156d19604ab27b284
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12331
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2024-09-13 11:13:59 +00:00
Profpatsch
95640e7be4 fix(users/Profpatsch/whatcd-resolver): prefer downloaded torrents
I changed the seeding weight, so now it would not show already
downloaded torrents, prompting me to fetch stuff that I already have
in new qualities. Obviously, that’s not the best idea.

Kinda surprised it’s this easy to fix heh.

Change-Id: I6bbf325672a91d794d144c006ccf3d702a581bce
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12330
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2024-09-13 11:13:59 +00:00
Profpatsch
9e2ecf9101 chore(users/Profpatsch/whatcd-resolver): ignore .ninja
Change-Id: I1b89161c9b4b763abcf74bd19f03275f987924ca
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12329
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2024-09-13 11:13:59 +00:00
Profpatsch
2edafd0a5a fix(users/Profpatsch/whatcd-resolver): set empty favicon
Change-Id: Id1fbcb39579f2d3c68989e4395cdadaa04790cec
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12328
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2024-09-13 11:13:59 +00:00
Profpatsch
b800bf2bd4 fix(users/Profpatsch/whatcd-resolver): pretty AppException
AppException would be a console-pretty-printed version for http
errors, which would print all the escape codes in the jaeger traces of
the exception, making it more-or-less unreadable.

So instead, let’s make AppException two cases, an ErrorTree case which
is printed as-is (no color), and a “Pretty” case which is printed
using the pretty module (colors on console, no colors in otel).

Somewhat involved, I guess this is temporary until I figure out what
is really needed.

Change-Id: Iff4a8651c5f5368a5b798541efc19cc7ab9de34b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12232
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2024-09-13 11:13:59 +00:00
Profpatsch
e9f1bb9917 fix(users/Profpatsch/whatcd-resolver/services): dont unset builders
Change-Id: I3fdf15d7a3a8e04fd73f22ad9c33a2c011609e3e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12231
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2024-09-13 11:13:59 +00:00
Profpatsch
5e8729188b feat(users/Profpatsch/whatcd-resolver): adjust seeding_weight
* Prefer MP3 versions to save on ratio
* Definitely never download 24bit flacs, they are not worth it at all

One needs to remove the `seeding_weight` column and restart
for it to have any effect (no real migrations yet, but eh)

bump

Change-Id: I30cc3ea05c4352316e3929f93d90fc27ce833682
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12222
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2024-09-13 11:13:59 +00:00
Vincent Ambo
158ba0d607 feat(tazjin/niri-reap): add a workspace compacting tool
I don't use workspaces and don't have them bound to anything in my Niri
configuration. However, when an external screen is unplugged, its workspace
(and windows) move to one of the remaining outputs.

This adds a tool that makes the windows available again by "reaping" them from
the other workspaces and moving them to the current one.

For starters I'll bind this to a key and see how it works in practice.

Change-Id: I18b2d60e93c8397dd637cdc426b4e46af5725558
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12451
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-13 10:52:38 +00:00
Vincent Ambo
8206f68aea refactor(eaglemode/avif): use build input parameter from buildPlugin
This somewhat condenses the derivation, which is always nice.

Change-Id: I4e2dd81620b54ab000898337007ffcea509a054b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12468
Reviewed-by: emery <emery@dmz.rs>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-13 10:36:15 +00:00
Vincent Ambo
773ddcb209 feat(tazjin/nixos): install radicle-node on all machines
Change-Id: I67ce259d890bd508cd9c9516702d51d5e70f4065
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12470
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-13 09:48:50 +00:00
Vincent Ambo
485fb81edf fix(tazjin/nixos): fix font name collision
Change-Id: I8780f5906855d2ce39ec78530ede84bbcfb5fbf2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12469
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
2024-09-13 09:23:36 +00:00
Vincent Ambo
374cde20f2 chore(3p/sources): bump channels & overlays (2024-09-10)
Includes the following fixes:

* users/wpcarro: disable pulseaudio option (can't have pipewire _and_ PA)
* users/aspen: disable pipewire (there's PA config here, so whatever)
* bump wasm-bindgen in Rust frontend projects
* users/tazjin: disable builds for frog (it's in storage)

Change-Id: Ia508b14b84619d06c1d98f7245e84d66bc791592
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12466
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: aspen <root@gws.fyi>
2024-09-12 12:42:44 +00:00
Vincent Ambo
7fa52f5933 refactor(tazjin/niri): configure seamless monitor/column movements
Makes it possible to just keep switching focus or moving a column in the
direction of the target screen. This is MUCH easier to think about.

Change-Id: I0488b8d338261b83327dc476e0173b222de9221a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12467
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-09-11 21:34:35 +00:00
edef
e573f8389c docs(tvix/nix-compat/wire/bytes/reader): None case doesn't exist
We always read the length before returning a BytesReader, so len()
cannot be called before the length is read.

Change-Id: Ifa1cbc2c0923dd24d59e0af5e135ab8ed7314aa9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12453
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-09-08 02:32:57 +00:00
Vincent Ambo
bdf1162d47 fix(tazjin/home): fix cursor sizes on hidpi/non-hidpi machines
Change-Id: If2e2c7ffeadcd920e518c107b30156a62ea7c5c4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12449
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-07 17:18:58 +00:00
Vincent Ambo
7903d26054 refactor(tazjin/dotfiles): move waybar configuration into Nix
Change-Id: Ia031fd755ecf451b0ef1f9e63f3aec8b56fe2d57
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12448
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-07 15:58:40 +00:00
Yureka
863146295b feat(tvix/nix-compat/nar/writer/sync): trait objects -> generics
This will later be used to allow the user to access the original writer.

Change-Id: I1734600c5d580d18b16727f892cd2f6335cc9459
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12442
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-09-07 12:23:06 +00:00
Yureka
cec28377d8 feat(tvix/castore): expose ValidatedDirectoryGraph type
Change-Id: Id994258e74f75df8790159ed3180ce360874d0de
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12438
Reviewed-by: benjaminedwardwebb <benjaminedwardwebb@gmail.com>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-09-07 12:22:58 +00:00
Vincent Ambo
0a38618675 feat(tazjin/eaglemode): install new eaglemode plugins
Change-Id: Ic5044ada0a3e07f3982cabb8e16c5dd9b2a38472
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12447
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
2024-09-07 12:17:48 +00:00
Vincent Ambo
c352306491 feat(tazjin/home): configure chicago95 theme in home-manager
Finally no more setting this up manually!

Change-Id: I75d7a53623cc05a0a88f70e20e881a944b6ed818
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12446
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-07 11:40:09 +00:00
Vincent Ambo
732b46c6fa feat(3p/chicago95): package chicago95 theme for GTK/Qt/etc.
Change-Id: Ib72ac7e4490b793940f25b0e6b8fac8c62686092
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12445
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-07 11:40:09 +00:00
sterni
f51d27acb2 refactor(sterni/backup-minecraft-fabric): use systemd-creds
The bundled tool is sort of convenient, I first tried it when debugging
an issue (that doesn't affect this module) and it seems a bit nicer.

Change-Id: Ief948f8e46e51f05b04fe7628ab9298284f780e9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12444
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
2024-09-06 21:43:55 +00:00
Vincent Ambo
31f55d7ce7 fix(tazjin/khamovnik): clean /tmp on boot
Change-Id: I5d71319be952f6524d5804d50e3178858371b4cf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12443
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-06 16:25:09 +00:00
Vincent Ambo
72bdb15958 feat(tazjin/dotfiles): add waybar configuration
This configuration is not automatically placed anywhere yet, because I'm also
still actively iterating on it.

Change-Id: I0a13fcbc2b9a5587480f6a69a73ab99b36d209e6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12435
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
2024-09-05 22:11:42 +00:00
Vincent Ambo
730d1cc77b feat(tazjin/dotfiles): check in Niri configuration
Adds the current (fairly simple) Niri configuration, which is annealed from
a few days of being poked constantly.

This isn't yet deployed through home-manager or anything as I'm still doing
stuff with it manually.

Change-Id: I3dfcafb55d98d9655585d3128e1088fc13e60cc7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12434
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
2024-09-05 22:10:40 +00:00
Vincent Ambo
317962fbed fix(tazjin/nixos): add fonts for waybar configuration
These don't actually really work the way I want, but I have no idea how font
configuration works.

Change-Id: I228ab234f37d8ae0847cbdc6a3431fc29a2585e6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12433
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
2024-09-05 22:10:09 +00:00
Vincent Ambo
609b68031b chore(3p/sources): bump channels & overlays (2024-09-01)
Included changes:

* users/aspen: explicitly use open-source nvidia driver

  This now has to be specified explicitly, otherwise evaluation fails with an
  error.
* users/aspen: nixfmt -> nixfmt-classic
* users/aspen: fixes for renamed packages & options
* users/tazjin: fixes for renamed packages & options
* 3p/overlays: remove cbtemulator patch (merged upstream)
* tvix/shell: remove unnecessary patches (merged upstream)
* 3p/rust-crates: mark libgit2_sys as broken
* users/Profpatsch: mark git-db as broken
* 3p/overlays: pick `mypaint` from stable channel
* tvix: fix comments that clippy doesn't like anymore
* tvix/glue: disable a misfiring clippy lint (applying its suggestion breaks
  code below)

Change-Id: I6d3fc027694bbe7425a2d25dc53d65467a44f3b0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12403
Tested-by: BuildkiteCI
Reviewed-by: aspen <root@gws.fyi>
Reviewed-by: Profpatsch <mail@profpatsch.de>
Autosubmit: tazjin <tazjin@tvl.su>
2024-09-05 20:56:31 +00:00
Vincent Ambo
200d49a0e1 feat(tazjin/home): configure screen locking with swayidle
Change-Id: I73e42071710f481c0f1acf965e18446c18e7c94b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12430
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-05 11:58:30 +00:00
Vincent Ambo
32cc8016df feat(depot-deps): add git-review CLI
This is a CLI for uploading changes to Gerrit.

Change-Id: I45fe592934174ab86af267c54b1f6a190617be62
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12392
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: Yury Shvedov <yury.shvedov@kaspersky.com>
Tested-by: BuildkiteCI
2024-09-05 11:47:54 +00:00
Vincent Ambo
33f30573f9 fix(tazjin/nixos): fix wayland screen sharing
Apparently something called a "desktop portal" needs to provide a magic
"service" and blabla; the TL;DR is that adding all this Gnome stuff makes screen
sharing work.

Tested using the Mozilla WebRTC test page:
https://mozilla.github.io/webrtc-landing/gum_test.html

Seems like our Chromium/Firefox are new enough not to require magic settings for
Wayland.

Change-Id: I250d857a0e941ef63fffca17a9c9feed14ec1bd9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12432
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-03 22:34:13 +00:00
Vincent Ambo
a9403664e1 fix(tazjin/nixos): always start pipewire before niri
According to discussions in the Niri issue tracker, pipewire must be started
before niri in order for screen sharing to work. Why? No idea.

Change-Id: Id4ff890dd2536b3cc98b14992cd799d257eec9be
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12431
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-03 22:34:13 +00:00
Vincent Ambo
632e74e435 fix(tazjin/khamovnik): try to force suspend on all lid close events
logind doesn't like reliably suspending, and apparently it has a bunch of bugs
around dock detection (I don't even use docks), but maybe this helps

Change-Id: Ia822799cde838d8d41a67f9d39d59d1fa0306116
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12429
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-09-03 22:26:31 +00:00
Emery Hemingway
1c898f7ddc feat(tools/eaglemode/plugins/avif): AVIF image plugin
Animation not implemented.
https: //en.wikipedia.org/wiki/AVIF

Change-Id: I80f8c4132c4335b2e60ce7b70eb424457e50c73f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12428
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-09-03 19:44:05 +00:00
Emery Hemingway
e4714db2d5 feat(tools/eaglemode/plugins): QOI image plugin
https://qoiformat.org/

Change-Id: I0c11095c1ac0e65075d032f7c29649cbba9f213f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12427
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-03 19:44:05 +00:00
Florian Klink
c60f4ccfda docs(tvix/contributing): remove reference to b/201
This should be fixed with the switch to a "GitHub App" for
authentication.

Change-Id: I0bd8b4b9c9f53a754a12ce07f193d19f61f56014
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12414
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
2024-09-03 15:17:30 +00:00
Vincent Ambo
7f1ecff989 refactor(tazjin/emacs): change key bindings for telega/term-switcher
Change-Id: Ia083a337f69aa258b9d4487affc594f5c4f1096d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12426
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-03 13:45:24 +00:00
Vincent Ambo
69dcd8e92c feat(tazjin/nixos): install waybar on desktop machines
Change-Id: I3b60b12175168e67df55d4eff28d2cac4f30aff1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12425
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-03 13:45:24 +00:00
Vincent Ambo
9ea1862750 fix(tazjin/nixos): replace wezterm with alacritty again
wezterm has very strange rendering bugs which I have no interest in debugging

Change-Id: I59a068df9b4474830ba4706bf8e626b45cd015f0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12424
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-09-03 13:45:24 +00:00
Vincent Ambo
6cfae6c423 feat(tazjin/nixos): enable Qt theming with qt5ct
Change-Id: I1ce0ab9085951d48021f2034a32bcf91c0a675df
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12423
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-09-03 13:45:24 +00:00
Emery Hemingway
0f519a6f13 feat(tools/eaglemode/commands): add Sam/Acme plumb command
Change-Id: I80443e88180e87c7f7b7c8ae322c5076d1ce0a02
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12422
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-09-03 12:51:48 +00:00
Vincent Ambo
a115238f1b feat(tazjin/eaglemode): add example plugin to config
Change-Id: I5993c429dfa066295823d5666763ca0120cc209c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12391
Reviewed-by: tazjin <tazjin@tvl.su>
Reviewed-by: emery <emery@dmz.rs>
Tested-by: BuildkiteCI
2024-09-02 21:26:16 +00:00
Vincent Ambo
84bdc582ea feat(eaglemode/plugins): bootstrap Yandex Tracker plugin
Bootstraps a plugin (that doesn't do anything yet) for accessing Yandex Tracker
through Eagle Mode.

This commit only initialises the plugin files, it doesn't actually do anything
other than print the word "Loaded".

API docs for future development: https://yandex.cloud/ru/docs/tracker/about-api

The next steps will be to figure out the emModel classes and the threading model
for fetching the remote data.

Change-Id: Ifce8bc2a61c4fd0c4a591013acbf428a9f5803f8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12398
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-09-02 21:26:16 +00:00
Vincent Ambo
18578c3458 feat(tools/eaglemode): add plugin builder for eagle mode
Adds a buildPlugin function which can build Eagle Mode plugins that can
ultimately be linked into Eagle Mode using the existing etcDir function.

Change-Id: I338171779d3547faecbfb708fbaa78cd1cfd59ac
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12387
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: emery <emery@dmz.rs>
Reviewed-by: azahi <azat@bahawi.net>
2024-09-02 12:58:12 +00:00
Vincent Ambo
3abc104584 chore(corp/rih): bump Rust dependencies
Required to bump past the broken time crate.

Change-Id: I10c979f2b3abc10ad66ac438834f4caceb661279
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12408
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-09-01 15:47:29 +00:00
Vincent Ambo
8efd6b3cd2 chore(ops/journaldriver): bump Rust dependencies
Required to bump past the broken time crate.

Change-Id: Ied9e3367f5fc69db0671732a75f2e410f4f234f6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12407
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-09-01 14:09:05 +00:00
Florian Klink
7eb6900129 fix(ops/keycloak): update client ID and client secret
This points to a "GitHub App" now
("https://github.com/organizations/tvlfyi/settings/apps"), rather than an
"OAuth App"
("https://github.com/organizations/tvlfyi/settings/applications").

Apparently this makes a big difference, and we should be using a "GitHub
App", not an "OAuth App".

The defails on why are in
https://github.com/keycloak/keycloak/issues/9429#issuecomment-1578953468

The App can be configured at
https://github.com/organizations/tvlfyi/settings/apps/tvl-keycloak .

With this, we should get rid of spurious Exceptions with some GitHub
users trying to log in, hopefully fixing https://b.tvl.fyi/issues/201.

Change-Id: I25d0d6cd1b05ad54ed3d760d3a48ce1f430c0e7d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12413
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-09-01 13:19:19 +00:00
Florian Klink
ebf4647976 fix(ops/keycloak): ignore delete_default_mappers field
Without this, terraform wants to recreate the resource, just because we
do /not/ want to delete the default mappers:

```
  # keycloak_ldap_user_federation.tvl_ldap must be replaced
-/+ resource "keycloak_ldap_user_federation" "tvl_ldap" {
      + delete_default_mappers          = false # forces replacement
      ~ id                              = "4e68e9f0-7aba-4465-8357-f2af6a55fd0e" -> (known after apply)
        name                            = "tvl-ldap"
      ~ use_truststore_spi              = "ALWAYS" -> "ONLY_FOR_LDAPS"
        # (27 unchanged attributes hidden)
    }
```

Keycloak lists the a few mappers. which are likely the default ones,
but in any case, we don't want to recreate this resource.

Change-Id: I170a91a44b2efa426fae268cf7fc97a7f28a5760
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12412
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
2024-09-01 13:18:47 +00:00
Florian Klink
e74378a324 fix(ops/keycloak): set base_path
The docs mention this applies to "users of the legacy distribution of keycloak".
However, we get a "failed to perform initial login to Keycloak: error
sending POST request to https://auth.tvl.fyi/realms/master/protocol/openid-connect/token: 404 Not Found"
if we don't set this.

With this, the provider is able to talk to the API, as long as the
secrets are sourced.

Change-Id: I0b9cdd45b1628aa0870a1673491c12c07bf7f8d6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12411
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
2024-09-01 13:18:47 +00:00
Florian Klink
5119cae360 fix(ops/buildkite): fix terraform state config
The same fix from cl/11021 also needs to be applied to other states.

Change-Id: I205b03aab49130639c79702f4bf16f0bf28d89ab
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12410
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: flokli <flokli@flokli.de>
2024-09-01 13:18:14 +00:00
Florian Klink
23f97d0df0 fix(ops/keycloak): fix terraform state config
The same fix from cl/11021 also needs to be applied to other states.

Change-Id: I0df3ee2e8970e0d08a119ecc6347f24aef0448c2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12409
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-09-01 13:18:14 +00:00
Vincent Ambo
53908b1b96 chore(tools/cheddar): bump rust dependencies
This is required because of the `time` breakage due to a bugfix in rustc.

Change-Id: I232dabec8bf5498a9e868e811f5822ba39b44d97
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12406
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-09-01 10:22:16 +00:00
Vincent Ambo
1c73c1c703 style(tazjin/wallpapers): add some new Stålenhag content
Change-Id: I693378ae6904f2658b4cf3477aff37d54b3c41f3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12405
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-31 23:55:03 +00:00
Vincent Ambo
a2eb46e3d8 feat(tazjin/home): configure wpaperd
Change-Id: Ic4eecdff48f947a44d2a06039573274a9edb35c8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12404
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-31 23:47:57 +00:00
Vincent Ambo
11aacd7857 feat(tazjin/nixos): setup niri (scrolling window manager)
This commit is experimental for now.

The backstory is this: There are use-cases where tiling windows (as in EXWM,
which I normally use) annoy me. There are also use-cases where stacking
windows (as in e.g. XFCE, which I tried for a bit) are annoying.

Scrolling WMs are a new thing which is sort of similar to tiling, but as it adds
more screen real estate doesn't require shuffling around or resizing of existing
windows basically ever.

I'm going to trial this (assuming I can get everything that's relevant for me
set up) and see how it goes.

Change-Id: I603c87b8ebd7fbde763d9d4708e098e9079889c5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12402
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
2024-08-31 23:47:57 +00:00
Vincent Ambo
b3c790a81e fix(tazjin/khamovnik): ensure networkmanager is always enabled
Got into weird states more than once while the private configuration wasn't
available ...

Change-Id: I75b1a242d9cf10f5e4ac27ad7fce3e40a79898cc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12401
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-31 23:46:55 +00:00
Vincent Ambo
a28c495c38 feat(tazjin/nixos): ensure eaglemode is always installed
Change-Id: I6084e041b760d90929f7e9b3d6f7cd6ca12370ba
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12400
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-31 23:46:55 +00:00
Vincent Ambo
a60998c234 chore(tazjin/emacs): use emacs-pgtk
I'm doing a wayland experiment, this is necessary for now. This disables some
parts of the configuration which are not going to work with wayland.

Change-Id: I61d0042fd52f2c7cade2794c0d5b5849ecaf5229
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12399
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-08-31 23:45:23 +00:00
Yury Shvedov
6f4d3fec5c chore: Introduce .gitreview file
Useful for [`git review`](https://docs.opendev.org/opendev/git-review/latest/)
ui.

Change-Id: I4a64b87df1539301570ad02da4262e44ade72755
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12380
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-08-31 13:05:23 +00:00
Vincent Ambo
06f03b4518 feat(eaglemode/emacsclient): use actual Emacs icon for command
Adds a new function that converts anything to a TGA image (imagemagick really is
magic), with which arbitrary icons can be converted.

This is demoed with the emacsclient command, which just takes the icon out of
the Emacs package tree.

Change-Id: I771bafed7b07a37c847bd07db986228b9fda60a0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12374
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: azahi <azat@bahawi.net>
Reviewed-by: tazjin <tazjin@tvl.su>
2024-08-30 18:05:59 +00:00
Vincent Ambo
91e76a90a0 refactor(tools/eaglemode): overridable mkCommand
People might especially want to change the default configuration.

Change-Id: If046e036a6d1a702abb8dcd1c08dac4730a01b98
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12371
Reviewed-by: tazjin <tazjin@tvl.su>
Reviewed-by: azahi <azat@bahawi.net>
Tested-by: BuildkiteCI
2024-08-30 18:05:59 +00:00
Ilan Joselevich
9803712ab8 fix(tvix): Follow-up fixing no-default-features and comments
In https://cl.tvl.fyi/c/depot/+/12389 I accidentally deleted some
comments. Also fixed some useless no-default-features with futures crate, making it match the previous feature combination.

Change-Id: I72bb2cfb88719ff2f8812d90193de2bd49149cce
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12395
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-30 13:55:11 +00:00
Vincent Ambo
55b0726571 feat(tazjin/eaglemode): add my eaglemode config
Very barebones for now.

Change-Id: I05b89f5f392eda221d0a61999d47d83f9bf3354a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12370
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-30 13:30:07 +00:00
Vincent Ambo
c4654fe373 feat(tools/eaglemode): add configuration wrapper script
Adds a new eaglemode.withConfig function that creates a specially wrapped Eagle
Mode, in which a configuration script joins the user's configuration with the
config passed in.

This produces a fully working and configured Eagle Mode with custom stuff out of
the box.

Change-Id: I6282cafd0b1ac6e77bede90cc91d4ede19ee1d2f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12369
Reviewed-by: azahi <azat@bahawi.net>
Tested-by: BuildkiteCI
Reviewed-by: emery <emery@dmz.rs>
2024-08-30 13:30:07 +00:00
Vincent Ambo
8c8861cb3c feat(tools/eaglemode): add function for creating etc dir
Adds an eaglemode.etcDir function which creates a directory structure suitable
for use with EM_USER_CONFIG_DIR.

The catch is that Eagle Mode requires this to be always writable, so it isn't
possible to just point the environment variable at the Nix store and launch it
from there.

The idea of this function is to make it possible to reuse it in a wrapper
script, a home manager module, a NixOS module or whatever that would make it
possible to provide the result to Eagle Mode in a mutable location.

Change-Id: I95c8b16c6c6fe8510ce9759c9d9b9e36e836e290
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12368
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Reviewed-by: azahi <azat@bahawi.net>
2024-08-30 13:30:07 +00:00
Vincent Ambo
4a4c21482b feat(tools/eaglemode): add command for opening Emacsclient
Adds a command that opens the current target in the file browser in Emacsclient.

Change-Id: Idbbec3905eb7763ce5bdc2931415db74bc5a5c31
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12367
Tested-by: BuildkiteCI
Reviewed-by: emery <emery@dmz.rs>
Reviewed-by: azahi <azat@bahawi.net>
2024-08-30 13:30:07 +00:00
Vincent Ambo
d235fd99c2 feat(tools/eaglemode): add helper function for Eagle Mode commands
This generates the correct `.pl` files for adding Eagle Mode commands. This
commit does not yet contain the wiring for adding these into Eagle Mode
directly, which is a bit involved.

Change-Id: I7d88128ba3ddaebfbb618db45e8fa843a3f17dea
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12366
Tested-by: BuildkiteCI
Reviewed-by: emery <emery@dmz.rs>
2024-08-30 13:30:07 +00:00
Ilan Joselevich
0979379980 fix(tvix/utils): Add missing src filtering for nix-compat-derive[-tests]
Change-Id: I2beed2cdcb5423d3594562e0011b1cb889add07f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12390
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
2024-08-30 12:09:41 +00:00
Florian Klink
f2d9255a98 feat(ops/users): add domenkozar
Change-Id: I4d10a17b43918857188c2b1f1babb8890346d9c0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12397
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: lukegb <lukegb@tvl.fyi>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-30 11:03:07 +00:00
Florian Klink
348998e1fa docs(tvix): update account creation instructions
This is tvix/docs, so asking to be a member of #tvl here is confusing.
Being a member of #tvix-dev is sufficient, we can still mention #tvl
though.

Change-Id: If9fbf7d098c0a8d77a45a95e321fc0a553f4c63b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12396
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: yuka <yuka@yuka.dev>
Tested-by: BuildkiteCI
2024-08-30 10:36:23 +00:00
Ilan Joselevich
5a97888d8b chore(tvix): Migrate members to inherit deps from workspace
From now on we will add the dependencies and their version in the root
Cargo.toml and in order to enable the dependency for a workspace member
we set `workspace = true` in the member's Cargo.toml.

Change-Id: I9738c1cf99810b7ace87ca712c3ea965ba846e25
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12389
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-29 14:37:22 +00:00
Ilan Joselevich
2945a359b4 chore(tvix): Bump versions of all compatible deps via cargo upgrade
This updates all the dependencies and their "minimum" versions in
Cargo.{lock,toml} to the latest compatible version using `cargo-edit`'s
`cargo upgrade` command that will eventually be merged into `cargo
update`.

Change-Id: Iccb2aa4a1c84a0465222244a0bd0cafe2a82e781
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12388
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
2024-08-29 11:26:15 +00:00
Florian Klink
02ee441626 chore(tvix/[ca]store): bump bigtable_rs
This bumps bigtable_rs to
https://github.com/liufuyang/bigtable_rs/pull/86, allowing us to drop
our second set of prost/tonic/http/axum crates.

Change-Id: I70f9150289c3e8611ebe8a7d99490e3dfd085a6e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12384
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Autosubmit: flokli <flokli@flokli.de>
2024-08-28 20:15:55 +00:00
Florian Klink
b6dd9d2d5b chore(tvix/[ca]store): bump hyper-util to 0.1.7
Change-Id: Ia5eaf7f4614701ad4dd06114476a73e1a041d830
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12383
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
2024-08-28 20:15:55 +00:00
Florian Klink
b2b38f23d0 chore(tvix): bump tonic[-build] from 0.12.1 to 0.12.2
Change-Id: If7d1ae4491d3c70f323cf872d1a70afe6238f78a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12382
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-08-28 19:01:04 +00:00
Vincent Ambo
c622af481e feat(tvix/eval): allow external users to construct native thunks
This interface is the only way to construct lazy builtins outside of eval, which
is actually a useful feature to have.

Change-Id: I386323af20aa3134bb4f669fa66fbb21e9b05fd4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12386
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: Yury Shvedov <yury.shvedov@kaspersky.com>
2024-08-28 18:05:30 +00:00
Vincent Ambo
82429f0661 refactor(tvix/eval): remove useless impl block
There's no need to duplicate this.

Change-Id: If3d930211a1d625d6c7ef129b05034e7a915da83
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12385
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: Yury Shvedov <yury.shvedov@kaspersky.com>
2024-08-28 18:04:58 +00:00
Florian Klink
fef2fdcf8e feat(users/flokli/nixos): add awscli to shell
Change-Id: I665ba215de12fad58b91604700c09a87444ac3ac
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12381
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: flokli <flokli@flokli.de>
2024-08-28 16:02:41 +00:00
Brian Olsen
a5fcfd80a1 fix(tvix/nix-compat-derive): Get rid of external feature flag
The external feature flag was there because I couldn't find a way to
refer to crate and nix-compat with the same name so that the generated
code could be the same.

In essence `use nix_compat::nix_daemon:🇩🇪:NixDeserialize` is an error
when used inside nix_compat crate.

So my best fix was the external feature flag until I found the solution
used here which also removes the flag completely.

Change-Id: Ia3e89c6c350c3fb22ca87f974a39c21542aae152
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12376
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Brian Olsen <me@griff.name>
2024-08-28 14:43:00 +00:00
Brian Olsen
743407e7ab fix(tvix/nix-compat-derive): Fix doctest for Rust older than 1.80
Exclusive range patterns were stabilized in Rust version 1.80 but Tvix
still uses Rust 1.79 and so would fail this one test when you ran
doctests from `mg shell //tvix:shell`.

It was not caught by CI because that does not currently run doctests.

The fix is just to use an inclusive pattern instead.

Fixes: b/417
Change-Id: Ifea7a3b84bb8f6f8c76e277979833713bdf51f46
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12375
Autosubmit: Brian Olsen <me@griff.name>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-28 14:08:39 +00:00
Alexander Kiselyov
7bf6563da1 fix(ops/users): fix email address for yl3dy
Change-Id: Id943cbb486073173a8391074c326749bffb990f7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12361
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: yl3dy <aleksandr.kiselyov@gmail•com>
Tested-by: BuildkiteCI
2024-08-28 01:26:05 +00:00
Yury Shvedov
5ef54a5583 feat(ops/users): add ein-shved
Change-Id: Idf8083d7f48fb1eca40596003fad1552b87bcef4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12364
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-27 13:54:54 +00:00
Alexander Kiselyov
2bca043c33 feat(users/yl3dy): test gpg-signed commit
Change-Id: I71f34d7ef9c9db106bf6994ee8fdb3047769817a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12363
Reviewed-by: yl3dy <aleksandr.kiselyov@gmail•com>
Tested-by: BuildkiteCI
2024-08-27 13:28:33 +00:00
Alexander Kiselyov
ca695a6f7c chore(users/yl3dy): add OWNERS file
Change-Id: I6618fb8de137c5887d3bd9e1cb0507cc818cb525
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12360
Reviewed-by: yl3dy <aleksandr.kiselyov@gmail•com>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-27 13:00:52 +00:00
azahi
c3645b590e feat(users/azahi/pkgs): add bruh
Just testing out depot workflow by adding random stuff.

Change-Id: I8acafe73b86d1936b64f8a4dd084c21c04e305bf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12358
Tested-by: BuildkiteCI
Autosubmit: azahi <azat@bahawi.net>
Reviewed-by: azahi <azat@bahawi.net>
2024-08-27 12:58:56 +00:00
Vincent Ambo
8edfb085f5 docs: add notes about importing existing projects into depot
Change-Id: Idc8572ae68eb9513c6c63642737ce8fd004ee67e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12325
Reviewed-by: azahi <azat@bahawi.net>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: benjaminedwardwebb <benjaminedwardwebb@gmail.com>
2024-08-27 12:24:38 +00:00
azahi
3e4b9e56a5 chore(users/azahi): add OWNERS file
Change-Id: Ic192e12b8858cc321a91c9ff545bdaaee75503c5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12354
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-27 10:58:48 +00:00
Florian Klink
2fa5e71d5e fix(tvix/store): restore v1alpha reflection endpoint
tonic-reflection 0.12.x moved from the v1alpha to v1 of the reflection
protocol.

However, most clients, like Postman, Kreya and evans don't support that
one yet.

Bump tonic-reflection to 0.12.2, which re-introduces v1alpha support
alongside the v1 version of it, registering both services.

This fixes the example documented in tvix/store/README.md, it was
previously failing as evans couldn't find the v1alpha reflection
service.

See https://github.com/hyperium/tonic/pull/1888 for details.

Change-Id: I55438877317f82dc39face13afeb9594cda07a4e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12353
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-08-27 10:34:43 +00:00
Vincent Ambo
d292203235 feat(tazjin/cursed): add bubblegum demo from VolgaSprint talk
Change-Id: I4d9bd21e3dd6dbc24d46907e6270d49b97f50b99
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12352
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-08-27 10:02:59 +00:00
Vincent Ambo
b9a614a90f fix(web/bubblegum): third_party/sources is required in bubblegum
Change-Id: Ifb63ab95a0a11f07e8ad2346aff5893fe7c268cd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12351
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2024-08-27 10:02:44 +00:00
Vincent Ambo
ae8758c966 feat(ops/users): add yl3dy
Change-Id: I05a11bb1f3496680c22b31a4450e4675d028c59d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12350
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
2024-08-26 10:07:44 +00:00
Florian Klink
248f46e7fc chore(users/aspen): use cargo-* packages from nixpkgs
These started throwing eval warnings due to usage of cargoSha256, and
are both available in nixpkgs.

Change-Id: Ice636bebc0a839410125bc19b2252158add2b96e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12337
Tested-by: BuildkiteCI
Reviewed-by: aspen <root@gws.fyi>
Autosubmit: flokli <flokli@flokli.de>
2024-08-25 21:44:41 +00:00
Florian Klink
7a85fb4c64 chore(users/aspen): hardware.opengl -> hardware.graphics
Change-Id: I388a26221b805bc2aa7563d464888cc8b9ea9c92
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12336
Tested-by: BuildkiteCI
Reviewed-by: aspen <root@gws.fyi>
Autosubmit: flokli <flokli@flokli.de>
2024-08-25 21:44:40 +00:00
Brian Olsen
228bf55646 fix(tvix/nix-compat): Feature flag code only used in async
When only the wire feature was enabled two methods were unused and so
would faild `cargo check --no-default-features --features wire`.

This feature flags those two methods on async feature since that is the
only place they are used.

Change-Id: I6ec18a670e3c6e3ecee8d1417c99f1a5084e0ae7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12346
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Brian Olsen <me@griff.name>
Tested-by: BuildkiteCI
2024-08-25 15:05:53 +00:00
Brian Olsen
ced05a2bb6 feat(tvix/nix-compat-derive): Add deriver for NixDeserialize
This adds a nix-compat-derive derive crate that implements a deriver
for NixDeserialize implementations. This is to reduce the amount of
code needed to implement deserialization for all the types used by
the Nix daemon protocol.

Change-Id: I484724b550e8a1d5e9adad9555d9dc1374ae95c2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12022
Autosubmit: Brian Olsen <me@griff.name>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-25 15:05:50 +00:00
Brian Olsen
9af6920478 feat(nix-compat): Add NixDeserialize and NixRead traits
Add a trait for deserializing a type from a daemon worker connection.
This adds the NixDeserialize trait which is kind of like the serde
Deserialize trait in that individual types are meant to implement it
and it can potentially be derived in the future.

The NixDeserialize trait takes something that implements NixRead as
input so that you can among other things mock the reader.

Change-Id: Ibb59e3562dfc822652f7d18039f00a1c0d422997
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11990
Autosubmit: Brian Olsen <me@griff.name>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-25 15:05:50 +00:00
Azat Bahawi
a774cb8c10 feat(ops/users): Add azahi to users
Change-Id: I4df81b7f08e173d3c887bc89f869889a7901dbf0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12347
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-25 13:12:50 +00:00
Vincent Ambo
fe07ebfb30 feat(volgasprint-cache): enable auto deploy
Change-Id: I3b0a4695f69ef24a4f1f6280402c8a72223ff0c9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12344
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: mrflos <mrflos@yeswiki.pro>
2024-08-25 11:29:56 +00:00
Vincent Ambo
a77b1d176b chore(ops/machines): add nixery & cache machines to system list
Change-Id: I40a4e7b9b993b2af57b03da1036ddeca2a0d298a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12343
Reviewed-by: mrflos <mrflos@yeswiki.pro>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
2024-08-25 11:29:24 +00:00
Vincent Ambo
6167e63e07 feat(tazjin/german-string): impl Clone for GermanString
Small strings are always copied fully, without allocations.

Large transient strings copy the data and allocate.

Large persistent strings are also a trivial copy.

Change-Id: I319c0b800fa7a4a62e634176b959bb2fa766a4eb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12342
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-08-25 10:07:03 +00:00
Vincent Ambo
d504f668e0 feat(ops/machines): add temporary VolgaSprint cache machine
Change-Id: I5b5bb98f591e7bf3b1f16673f7f670b758444066
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12327
Reviewed-by: mrflos <mrflos@yeswiki.pro>
Tested-by: BuildkiteCI
2024-08-25 09:38:57 +00:00
Florian Klink
6dff303c5f chore(users/tazjin): hardware.opengl -> hardware.graphics
Change-Id: I649a6de6eef0b9b8c9cb658fdb6e4e46f5c8be1c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12335
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-25 09:19:25 +00:00
Florian Klink
a742fafdbf chore(tvix/tools/turbofetch): bump deps
h2:
 - https://rustsec.org/advisories/RUSTSEC-2024-0332.html
 - https://rustsec.org/advisories/RUSTSEC-2024-0003.html

mio:
 - https://rustsec.org/advisories/RUSTSEC-2024-0019.html

shlex:
 - https://rustsec.org/advisories/RUSTSEC-2024-0006.html

zerocopy:
 - https://rustsec.org/advisories/RUSTSEC-2024-0006.html

Change-Id: I7ce3cab410b9c2b6c28474ca81c3fa5b5283f3fd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12341
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
2024-08-24 18:08:08 +00:00
Florian Klink
25f8ddca6d chore(tvix/tools/crunch-v2): bump deps
h2:
 - https://rustsec.org/advisories/RUSTSEC-2024-0332.html
 - https://rustsec.org/advisories/RUSTSEC-2024-0003.html

mio:
 - https://rustsec.org/advisories/RUSTSEC-2024-0019.html

shlex:
 - https://rustsec.org/advisories/RUSTSEC-2024-0006.html

zerocopy:
 - https://rustsec.org/advisories/RUSTSEC-2024-0006.html

Change-Id: Ia5f6f96378d5f7e77e178dc054f47bda8b766a30
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12340
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
2024-08-24 18:08:08 +00:00
Florian Klink
478a746a92 chore(tvix/tools/weave): bump mio
https: //rustsec.org/advisories/RUSTSEC-2024-0019.html
Change-Id: I03543105b35da6407a4930893b1514b379a89fbc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12339
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
2024-08-24 18:08:08 +00:00
Vincent Ambo
47ff0d0893 chore(depotfmt): exclude users/emery/*
Change-Id: I971456e97a809665fdd011c31b0437510f4b7fba
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12306
Reviewed-by: emery <emery@dmz.rs>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
2024-08-24 09:27:31 +00:00
Vincent Ambo
f22defa541 fix(cgit-tvl): disable follow-links in cgit
These cause segfaults in cgit due to an old wontfix git issue:

https://bugzilla.redhat.com/show_bug.cgi?id=1791810

Change-Id: I831655faf3cfdef5bad13eba8cb8bb274de83ea0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12307
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-24 08:38:06 +00:00
Vincent Ambo
bfab474d0c fix(ops/modules): re-add cheddar highlighting server
This was deleted when removing the Sourcegraph module, but it turns out it is
also needed by panettone.

Change-Id: I8f14165bf783743247894c2b64882fbb032ffbf8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12295
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-23 23:41:39 +00:00
Ilan Joselevich
8b624f93bf feat(users/picnoir/tvix-daemon): Add crate2nix-check
Change-Id: I92a2fd6369e1f45c8afa25f778ac424782699b55
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12304
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
2024-08-23 19:55:10 +00:00
Ilan Joselevich
e7ff04b5f1 feat(tvix/tools/weave): Add crate2nix-check
Change-Id: I4e02f56678e6efa6e2656b2f7398b6ad92581c57
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12303
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-23 19:55:10 +00:00
Ilan Joselevich
beb6713983 feat(tvix/tools/turbofetch): Add crate2nix-check
Change-Id: Ie615d824032c85af6f8f40419bc22d7e3f38bb4c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12302
Tested-by: BuildkiteCI
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: flokli <flokli@flokli.de>
2024-08-23 19:55:10 +00:00
Ilan Joselevich
424b1ab5ad feat(tvix/tools/narinfo2parquet): Add crate2nix-check
Change-Id: I22bc6e7711e5e2c0a76d4eea4dd6edaf724e4cef
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12301
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-23 19:55:10 +00:00
Ilan Joselevich
a8d2d6e97e feat(tvix/tools/crunch-v2): Add crate2nix-check
Change-Id: I922caae2ec3f87a7f3a5dcc8e9d366f0e71ce900
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12300
Tested-by: BuildkiteCI
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: flokli <flokli@flokli.de>
2024-08-23 19:55:10 +00:00
Emery Hemingway
4157fbad43 feat(users/emery/pkgs): add syndicate-server
Change-Id: I3cd358e55a7f0208af8fe8aa990b9f2ee7ffe865
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12299
Reviewed-by: emery <emery@dmz.rs>
Tested-by: BuildkiteCI
2024-08-23 17:23:06 +00:00
Ilan Joselevich
43cf713417 feat(web/tvixbolt): Add crate2nix-check and re-generate Cargo.nix
Change-Id: Ib9881efd6a78ba28e283759e0ed5125fb175b89e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12221
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-23 17:03:02 +00:00
Ilan Joselevich
6da55dc1a6 feat(tvix/utils): Add mkCrate2nixCheck
This adds a function which can be used across the monorepo to create a
an extra CI step that checks whether the Cargo.nix file is up-to-date.

Change-Id: Idb8298b29ddc2ca5dff1facb1b9ed86a236ee66d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12227
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-23 17:03:02 +00:00
Vincent Ambo
afef485221 feat(ops/users): add mrflos
Patch submitted via public inbox.

Change-Id: I5dc2d86aefd909216e8a16f428fc2cf818a125c2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12296
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-23 16:24:25 +00:00
Vincent Ambo
3530841a13 chore(tools/depotfmt): remove terraform fmt
This adds almost a gigabyte of closure size for formatting files that almost
never change.

I'll look into building just the formatter somehow, but it's not a very high
priority task.

Change-Id: Ib0f841e1a98133381c5ae154e2a57df8af52dc1f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12293
Tested-by: BuildkiteCI
Reviewed-by: emery <emery@dmz.rs>
Autosubmit: tazjin <tazjin@tvl.su>
2024-08-23 16:13:19 +00:00
Emery Hemingway
6c31d72000 feat(users/emery): add custom Cyrillic keyboard layout
Change-Id: I37f95c904e8a05cf8d8e437c41b9710c2ebf0300
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12294
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-23 16:07:08 +00:00
Florian Klink
a4ebc8da7c feat(tvix/nar-bridge): send content-type headers
This prevents browsers from treating NARInfo and nix-cache-info paths as
a separate "Download", but just show it in plaintext.

Change-Id: If99abe20ef1d24e4fa86c055160861ca47aa81ce
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12267
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
2024-08-23 15:02:14 +00:00
Florian Klink
35d5811eec feat(nix-compat): add constants for mime types
This adds the MIME types Nix uses when uploading files to a S3 bucket /
HTTP endpoint. It ignores them when retrieving.

Change-Id: I75fa96d5e53349f0470bbe8cbba93f961fbd5f05
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12266
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
2024-08-23 15:02:14 +00:00
Vincent Ambo
c321a5136f feat(ops/users): add nikiv
Patch submitted to me IRL.

Change-Id: Idd8aa75313ba73d5c1e92b98d390e43e7108c6b6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12292
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
2024-08-23 14:53:08 +00:00
Vincent Ambo
1099b5603c docs: remove mention of Sourcegraph from depot README
Change-Id: I721d08d2862256e5e973792b8fc7fac73b0326fc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12288
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-23 14:40:09 +00:00
Vincent Ambo
caf653be32 chore(ops/besadii): remove sourcegraph index update support
Change-Id: I4ee9a5a69c90e2050c60b2ef8483431d691b499f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12287
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-23 14:40:09 +00:00
Vincent Ambo
11665f4e0a chore(whitby): remove Sourcegraph instance
Change-Id: I4d03f98e79de5e3a9c8c4a33682d5c78e3e0f028
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12286
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-23 14:40:09 +00:00
Vincent Ambo
83a6ad9717 feat(ops/users): add aziz
Patch submitted to me IRL.

Change-Id: I43805e3932ccbe383fb5ec7780a29fae187f64db
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12290
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-23 14:26:24 +00:00
Vincent Ambo
1694ff4e22 feat(ops/users): add emery
Patch submitted to me IRL.

Change-Id: I4cbfb138f616adf8635ca84f25cb77f8b8af7959
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12289
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-08-23 14:15:18 +00:00
Vincent Ambo
73896eb075 feat(ops/www): redirect cs.tvl.fyi to livegrep & cgit
Goodbye, Sourcegraph.

Relates to b/290.

Change-Id: Ic1cf3c1cf52ae17cdcc18c675b4c01d477644a3c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12285
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-23 11:07:15 +00:00
Vincent Ambo
8041ce7cbd chore(web/atward): remove sourcegraph support
We're moving away from sourcegraph to livegrep and so on, as Sourcegraph has
gone fully proprietary.

This removes support for redirecting to Sourcegraph.

Relates to b/290

Change-Id: I04ccf8dfef72113cd49d444151cb0c3eb834845d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12268
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2024-08-23 11:07:15 +00:00
Vincent Ambo
8f6f45097e feat(tazjin/german-string): add constructor that leaks a Vec<u8>
Change-Id: Id0b6b4794128573ddb62e82fd77d080e564978be
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12264
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
2024-08-22 14:02:15 +00:00
Vincent Ambo
012da7d0e1 feat(tazjin/german-string): add persistent construction from statics
Makes it possible to construct persistent German Strings from data with 'static
lifetime. This doesn't leak any additional data.

Change-Id: Ifb3a36ff72b106724883302e4c2195ac54acd352
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12263
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
2024-08-22 14:02:15 +00:00
Vincent Ambo
95ebcc24b0 refactor(tazjin/german-string): add type for encoding storage class
Adds a StorageClassPtr type that is set up to be able to steal bits from an
aligned pointer to encode the storage class of a German String.

Change-Id: I64591174eac1ebcb73e624a59bd107ba1e02c69d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12262
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-22 14:02:15 +00:00
Ben Webb
565c0fd24c fix(tvix/castore): u32 -> u64 in DirectoryError::SizeOverflow message
Fix a discrepancy in the error message for DirectoryError::SizeOverflow.

The message indicates that the SizeOverflow error occurs when total size
exceeds u32::MAX, but that's not true. All size fields within the
castore's internal Directory ADT are u64, and the SizeOverflow error is
only returned after a call to the checked_add implementation on u64.

See tvix/castore/nodes/directory.rs +111
and tvix/castore/nodes/directory.rs +88
as of this commit.

Change-Id: I74d161ea8927362e1cb601ba163489aa96fb91b1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12259
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-21 22:05:57 +00:00
Florian Klink
e03ea11bad feat(nix-compat/nix_http): init parse_nar[info]_str
This moves the URL component parsing code we had in nar-bridge to
nix-compat.

We change the function signature to return an Option, not a
Result<_, StatusCode>.

This allows returning more appropriate error codes, as we can
ok_or(…) at the callsite, which we now do: on an upload to an
invalid path, we now return "unauthorized", while on a GET/HEAD, we
return "not found".

This also adds support to parse compression suffixes. While not
supported in nar-bridge, other users of nix-compat might very well want
to parse these paths.

Also fix the error message when parsing NAR urls, it mentioned 32, not
52, which is a copypasta error from the narinfo URL parsing code.

Change-Id: Id1be9a8044814b54ce68b125c52dfe933c9c4f74
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12260
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-21 09:40:32 +00:00
Armin Schlegel
2357079891 feat(kontemplate): defaults can now have nested values
See https://b.tvl.fyi/issues/409 for details.

Change-Id: Ibb54fab7a78e0e5f708c2a7dc8bb26ac0b2b4689
Signed-off-by: Armin Schlegel <a.schlegel@gridx.de>
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11972
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-08-20 17:09:57 +00:00
Florian Klink
2beabe968c refactor(nix-compat/store_path): make StorePath generic on S
Similar to how cl/12253 already did this for `Signature`, we apply the
same logic to `StorePath`.

`StorePathRef<'a>'` is now a `StorePath<&'a str>`, and there's less
redundant code for the two different implementation.

`.as_ref()` returns a `StorePathRef<'_>`, `.to_owned()` gives a
`StorePath<String>` (for now).

I briefly thought about only publicly exporting `StorePath<String>`
as `StorePath`, but the diff is not too large and this will make it
easier to gradually introduce more flexibility in which store paths to
accept.

Also, remove some silliness in `StorePath::from_absolute_path_full`,
which now doesn't allocate anymore.

Change-Id: Ife8843857a1a0a3a99177ca997649fd45b8198e6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12258
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
2024-08-20 15:14:27 +00:00
Florian Klink
413135b925 refactor(nix-compat/aterm): update function names a bit
Don't call functions bstr or str when they return BString or String,
it's confusing.

Rename them to `string` and `bytes`. We might be able to generalize over
this being BString or Vec<u8> later.

Change-Id: I8198551ed3ba1cfc479bf7e3cbbc13a426faf4c0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12257
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
2024-08-20 15:14:27 +00:00
Ilan Joselevich
e579d3869d feat(tools/depotfmt): Get gofmt from pkgs.go instead of buildGo
This allows importing just //tools/depotfmt.nix when using a josh
workspace.

Change-Id: Idf7eb438be1cc1e60445aace982fdca1f4367595
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12254
Tested-by: BuildkiteCI
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: flokli <flokli@flokli.de>
2024-08-20 05:13:39 +00:00
Aspen Smith
01af37c532 chore(aspen/system): Turn off disableWhileTyping for libinput
I... actually really hate this, it turns out. Plus it breaks video
games, lol.

Change-Id: I4b86e38ee78f5f3b6ffec5e7cc4f1dc054d91c56
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12256
Reviewed-by: aspen <root@gws.fyi>
Autosubmit: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
2024-08-20 02:27:13 +00:00
Ryan Lahfa
a4e40d1dfa feat(tvix/nix-compat): entry locator in listing structures
This implements a simple DFS locator in listing structures.

It is interoperable with the Rust standard library paths, we also build our
own errors to restrict path values to reasonable secure defaults, e.g.
relative paths with no `..` component.

Tests are added for this new feature for a positive and a negative
check.

In addition, a path validation test was added. The Windows-style prefix
is gated on the Windows platform as UNIX does not parse `C:\\` as a
`Component::Prefix(_)` but as a `Component::Normal(_)`.

Change-Id: Iae2a80bebd8138e41af94aa7d09f2842c3c5a786
Signed-off-by: Ryan Lahfa <tvl@lahfa.xyz>
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12255
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-19 22:32:09 +00:00
Florian Klink
a259613c76 feat(nix-compat/narinfo/signature): generalize name field
Requiring `name` to be a `&str` means it'll get annoying to pass around
`Signature`, but being able to pass them around in an owned fashion is
kinda a requirement for a stronger typed `PathInfo` struct, where we
want to have full ownership.

Rework the `Signature` struct to become generic over the type of the
`name` field. This means, it becomes possible to have owned versions
of it.

We don't want to impose `String` or `SmolStr` for example, but want to
leave it up to the nix-compat user to decide.

Provide a type alias for the existing `&str` variant (`SignatureRef`),
and use it where we previously used the non-generic `Signature` one.

Add some tests to ensure it's possible to *use* `Signature` with both
`String` and `SmolStr` (but only pull in `smol_str` as dev dependency
for the tests).

Also, add some more docstrings, these were a bit sparse.

Change-Id: I3f75691498c6bda9cd072d2d9dac83c4f6c57287
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12253
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2024-08-19 19:46:34 +00:00
Ryan Lahfa
7612cb4c31 feat(tvix/nix-compat): add a basic listing deserializer
.ls files are useful to seek in a NAR without parsing it entirely.

The responsibility of validating the files is on the caller.

Change-Id: I5d1da28b5479c38f20ca5babe60e362a2217c9ea
Signed-off-by: Ryan Lahfa <tvl@lahfa.xyz>
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12196
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-19 19:18:42 +00:00
Ilan Joselevich
73e16c1855 feat(tvix): drop usage of sparseTree in favor of lib.sourceByRegex
We can avoid depending on things outside //tvix by just using a similar
util from nixpkgs.

Change-Id: I9ea3e1f0a8a059ea10caaec173569ba9f316aec6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12247
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-19 16:56:19 +00:00
Ilan Joselevich
bc967c538d feat(tvix/boot/tests): use pkgs.nixos instead of nixosFor
Using pkgs.nixos directly allows us to create a smaller nixos closure
for the tests and also not depend on things in depot.ops which can be
beneficial for extending the tvix josh workspace.

Change-Id: Ic6ad2122733418114b43aa692d6e42ac1e308eeb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12251
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
2024-08-19 16:55:22 +00:00
Florian Klink
70d199ea44 refactor(nix-compat/narinfo/signature): use ed25519::SignatureBytes
It's a `[u8; SIGNATURE_LENGTH]` type alias, and conveys what we're
accepting or returning a bit nicer.

Change-Id: I974cd97d56d383e51417eb0f26e1431a05711922
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12252
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2024-08-19 14:34:35 +00:00
Vincent Ambo
ed4f68b1d3 feat(tazjin/german-string): add constructor method from owned data
Makes it possible to construct a GermanString from an owned byte vector, without
having to clone the data.

This is done by "disowning" the vector using ManuallyDrop to access its internal
pointer. For transient strings, this memory is then owned (and freed) by the
GermanString instance.

Small strings are copied out of the heap and stored inline as before, to avoid
any dereferencing operations.

Change-Id: I754736099f71d646d430aed73e558a5a7626c394
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12249
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-08-19 13:19:40 +00:00
Vincent Ambo
0d6d31bc66 feat(tazjin/german-string): add pointer equality check in Eq
This can short-circuit two large string comparisons.

Change-Id: If45e7cf33921fe571482dc710c27ef8cc7c70885
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12245
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-08-19 13:19:40 +00:00
Vincent Ambo
a521f9e5f8 chore(tazjin/german-string): add Nix build
Change-Id: I1e8c500c9bb4ba365ba32f53f60bcf657f62ed62
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12243
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-19 13:19:40 +00:00
Vincent Ambo
56d4f01e9f feat(tazjin/german-string): add [Partial]Ord implementation
Change-Id: I8002ec63be45a15160387c21ed1fa8721a7c3eb4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12242
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
2024-08-19 13:19:40 +00:00
Vincent Ambo
86f467cee6 test(tazjin/german-string): add roundtrip proptests
Change-Id: Iee392368252d5c6e96d879b213aee34a301d13d6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12241
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-19 13:19:40 +00:00
Vincent Ambo
64a085cf52 feat(tazjin/german-string): add Eq impl & corresponding proptests
Change-Id: I66a258fad5d4e249268b9d2743d46b30c5ac1dac
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12240
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
2024-08-19 13:19:40 +00:00
Vincent Ambo
ab6a4815ff feat(tazjin/german-string): add Debug implementation
Change-Id: I9a4a8a4815ac210c402cfc2feb1fe0606affb327
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12239
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-19 13:19:40 +00:00
Vincent Ambo
2284c00417 feat(tazjin/german-string): PartialEq implementation for GermanString
This is where one of the advantages of this string representation starts to
shine: For small strings there's no derefencing any heap memory at all, and for
the long representation we can compare the prefix before moving on.

Change-Id: Iac333a52e8d7c9dd09e33dbcf51754e321c880e6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12238
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-19 13:19:25 +00:00
Ilan Joselevich
0714184b1f feat(tvix/boot): Use buildGoModule instead of buildGo for tvix-init
//tvix depending less on other parts of depot is prefered as it will
help with extending the josh workspace of tvix.

Change-Id: Ifcac3af1782dfd82e7543cb4c3ae57fbd186edff
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12250
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-19 12:42:44 +00:00
Ilan Joselevich
7b1acc5c16 feat(third_party/gitignoreSource): Get gitignore-nix from sources (niv)
It's easier to implement readTree/depot polyfills for gitignoreSource
when it's imported from third_party.sources, rather than in a file at
//third_party.gitignoreSource.

Change-Id: I1323f932bd0feeb2c50ccc76397a80e035842992
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12248
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-08-19 12:14:08 +00:00
Vincent Ambo
9aa1c2dd19 fix(tazjin/german-string): add maximum length check
Change-Id: I4fd9b2a31749d65632b662807c4e703a9df9ec9e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12237
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-19 11:50:11 +00:00
Vincent Ambo
d8640b6e67 feat(tazjin/german-string): add data accessors for &str and &[u8]
Change-Id: I992e625861f79ef6d9993e8caee4e02d3fc5557e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12236
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
2024-08-19 11:50:11 +00:00
Vincent Ambo
4d5abbe232 feat(tazjin/german-string): add Drop impl for transient strings
All of these strings are currently transient (the storage class is not yet
represented anywhere), and the ones that are heap allocated need to be
deallocated when the transient string dies.

Change-Id: Iba0ca926df5db7594f304c5d5318db9d69c6f42c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12235
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-19 11:50:11 +00:00
Vincent Ambo
ef75a6300b feat(tazjin/german-string): init initial representation
This adds an initial implementation of the so-called "German Strings" in Rust.

https://cedardb.com/blog/german_strings/

This implementation is *far from* complete, the only thing that can be done
right now is construct a string, and even that I'm not fully happy with.

Change-Id: I2697932a0ef373be76ffd14d59677493a5783b58
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12234
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-08-19 11:42:56 +00:00
Vincent Ambo
abff828ccc refactor(tvix/eval): remove use of imbl::OrdMap
Removes imbl::OrdMap in favour of an Rc over the standard library's BTreeMap,
which allows us to drop the imbl dependency completely.

In my local tests this is actually slightly faster for `hello` and `firefox`.

Change-Id: Ic9597ead4e98bf9530f290c6a94a3c5c3efd0acc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12201
Reviewed-by: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
2024-08-19 11:02:50 +00:00
Vincent Ambo
adf9b4c54a refactor(tvix/eval): remove use of imbl::Vector
This vector type has served us well for now, but it contains internal refcounts
which are incompatible with upcoming changes related to garbage collection.

The performance impact of this change within all benchmarks I ran was within the
margin of error:

[nix-shell:/tmp/perf]$ hyperfine "./before -E '(import <nixpkgs> {}).firefox.outPath' --log-level ERROR --no-warnings"
Benchmark 1: ./u64 -E '(import <nixpkgs> {}).firefox.outPath' --log-level ERROR --no-warnings
  Time (mean ± σ):      7.528 s ±  0.272 s    [User: 6.578 s, System: 0.631 s]
  Range (min … max):    7.160 s …  8.012 s    10 runs

nix-shell:/tmp/perf]$ hyperfine "./std-vec -E '(import <nixpkgs> {}).firefox.outPath' --log-level ERROR --no-warnings"
Benchmark 1: ./std-vec -E '(import <nixpkgs> {}).firefox.outPath' --log-level ERROR --no-warnings
  Time (mean ± σ):      7.515 s ±  0.178 s    [User: 6.508 s, System: 0.652 s]
  Range (min … max):    7.276 s …  7.861 s    10 runs

Change-Id: Ib95f871956e336a1e5771f6293583854b1efb276
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12197
Reviewed-by: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
2024-08-19 11:02:50 +00:00
Vincent Ambo
d6c57eb957 refactor(tvix/eval): ensure VM operations fit in a single byte
This replaces the OpCode enum with a new Op enum which is guaranteed to fit in a
single byte. Instead of carrying enum variants with data, every variant that has
runtime data encodes it into the `Vec<u8>` that a `Chunk` now carries.

This has several advantages:

* Less stack space is required at runtime, and fewer allocations are required
  while compiling.
* The OpCode doesn't need to carry "weird" special-cased data variants anymore.
* It is faster (albeit, not by much). On my laptop, results consistently look
  approximately like this:

  Benchmark 1: ./before -E '(import <nixpkgs> {}).firefox.outPath' --log-level ERROR --no-warnings
  Time (mean ± σ):      8.224 s ±  0.272 s    [User: 7.149 s, System: 0.688 s]
  Range (min … max):    7.759 s …  8.583 s    10 runs

  Benchmark 2: ./after -E '(import <nixpkgs> {}).firefox.outPath' --log-level ERROR --no-warnings
  Time (mean ± σ):      8.000 s ±  0.198 s    [User: 7.036 s, System: 0.633 s]
  Range (min … max):    7.718 s …  8.334 s    10 runs

  See notes below for why the performance impact might be less than expected.
* It is faster while at the same time dropping some optimisations we previously
  performed.

This has several disadvantages:

* The code is closer to how one would write it in C or Go.
* Bit shifting!
* There is (for now) slightly more code than before.

On performance I have the following thoughts at the moment:

In order to prepare for adding GC, there's a couple of places in Tvix where I'd
like to fence off certain kinds of complexity (such as mutating bytecode, which,
for various reaons, also has to be part of data that is subject to GC). With
this change, we can drop optimisations like retroactively modifying existing
bytecode and *still* achieve better performance than before.

I believe that this is currently worth it to pave the way for changes that are
more significant for performance.

In general this also opens other avenues of optimisation: For example, we can
profile which argument sizes actually exist and remove the copy overhead of
varint decoding (which does show up in profiles) by using more adequately sized
types for, e.g., constant indices.

Known regressions:

* Op::Constant is no longer printing its values in disassembly (this can be
  fixed, I just didn't get around to it, will do separately).

Change-Id: Id9b3a4254623a45de03069dbdb70b8349e976743
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12191
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-19 11:02:50 +00:00
Florian Klink
ddca074886 docs(tvix/glue/tvix_io): update doc-comments
Since we switched from reference scanning to string context, this only
handles the `__corepkgs__` hack. Update the docstrings.

Change-Id: Ie857c8c99ae1cdb4697323ec738f88be0580df3e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12246
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-19 10:24:37 +00:00
Florian Klink
bb5d7c9678 feat(ops/pipelines): support buildkite retries
cl/12228 did enable automatic retries for some flaky tests, which
generally did work, as can be seen in
https://buildkite.com/tvl/depot/builds/35893

However, "🦆" still reports as failing, because we check the number
of steps to be nonzero, which is not the case if retries have happened.

We cannot check for the overall status of the build, as it's still
"RUNNING", but instead of counting all failed steps so far, we can query
all failed jobs and then filter out the ones that were already retried.

Change-Id: Ib9d27587c8a8ba7970850812c4302fecdc4482e7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12233
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-08-19 10:07:08 +00:00
Florian Klink
98863e7312 docs(views): update where josh-filter is coming from
We started using josh from nixpkgs since cl/11457, but forgot to update
this documentation.

Change-Id: I6e07227bcd3e955076d46146024edd89b69f08f7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12244
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
2024-08-18 20:44:39 +00:00
Aspen Smith
5382cbb93a refactor(tvix/eval): Pull context out into its own module
I'm gonna be doing some poking around in the internals of Context, so in
preparation this pulls it out into its own module.

Change-Id: I72ea7df80b5f36f838934ee07bdba66874c334c9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12189
Autosubmit: aspen <root@gws.fyi>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-18 19:49:14 +00:00
Florian Klink
e086c76ee9 refactor(tvix/castore): have SymlinkTarget-specific errors
Don't use ValidateNodeError, but SymlinkTargetError.

Also, add checks for too long symlink targets.

Change-Id: I4b533325d494232ff9d0b3f4f695f5a1a0a36199
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12230
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: edef <edef@edef.eu>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
2024-08-18 17:22:21 +00:00
Florian Klink
56fa533e43 refactor(tvix/castore): have PathComponent-specific errors
Don't use DirectoryError, but PathComponentError.

Also add checks for too long path components.

Change-Id: Ia9deb9dd0351138baadb2e9c9454c3e019d5a45e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12229
Tested-by: BuildkiteCI
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: edef <edef@edef.eu>
2024-08-18 17:22:21 +00:00
Florian Klink
0cfe2aaf6a feat(tvix/castore/proto): add owned conv to castore::Directory
Replace the hand-rolled code comparing names with a try_fold. Also, make
it slightly stricter here, detecting duplicates in the same fields
earlier.

Change-Id: I9c560838ece88c3b8b339249a8ecbf3b05969538
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12226
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: edef <edef@edef.eu>
Tested-by: BuildkiteCI
2024-08-18 17:22:21 +00:00
Florian Klink
96832c0411 feat(tvix/castore): add Directory::try_from_iter()
This provides a batched variant to construct a Directory, which reuses
the previously calculated size.

Checking and inserting code is factored out into a check_insert_node
function, taking the current size as a parameter and returning the new
size.

Change-Id: Ia6c2970a0c12181b7c40e63cf7ce8c93298ea37c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12225
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: edef <edef@edef.eu>
Tested-by: BuildkiteCI
2024-08-18 16:49:58 +00:00
Florian Klink
76839683a7 fix(tvix/boot): workaround test flakiness
The boot tests are sometimes flaky, and we don't want them to
periodically fail other build. Have Buildkite auto-retry them 2 times
on failure.
Logs for individual failures are still available, so it won't hinder
flakiness debuggability.

See https://buildkite.com/docs/pipelines/command-step#retry-attributes
for a documentation of a parameter, and cl/8983 for the introduction of
that feature to //nix/buildkite.

Change-Id: I1c0d25fa1d0ca940b3bdcd145ede87154b0c28eb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12228
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
2024-08-17 20:36:05 +00:00
Florian Klink
c75b0d08ce chore(tvix/glue): drop some explicit allow(clippy::mutable_key_type)
This is covered by clippy.toml these days.

Change-Id: I2330af5781844d5f9d975793d770efcea48d371b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12223
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
2024-08-17 15:59:10 +00:00
Florian Klink
5d01892274 refactor(tvix/castore): add name back to edge weights
Make this a proper struct with named fields. We apparently never access
B3Digest in there, so it can be removed.

Change-Id: Ifc07310393e1afb0a835778eae137a19b54070b9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12224
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-17 15:59:10 +00:00
Florian Klink
21ceef4934 refactor(tvix/castore): add into_nodes(), implement consuming proto conv
Provide a into_nodes() function on a Directory, which consumes self and
returns owned PathComponent and Node.

Use it to provide a proper conversion from Directory to the proto
variant that doesn't clone.

There's no need for the one taking only &Directory, we don't use it
anywhere, and once someone needs that they might as well clone Directory
before converting it.

Update all other users of the `.nodes()` function to use `.into_nodes()`
where applicable, and avoid some more cloning there.

Change-Id: Id4577b9eb173c012e225337458898d3937112bcb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12218
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
2024-08-17 15:59:10 +00:00
Florian Klink
5ec93b57e6 refactor(tvix/castore): add PathComponent type for checked components
This encodes a verified component on the type level. Internally, it
contains a bytes::Bytes.

The castore Path/PathBuf component() and file_name() methods now
return this type, the old ones returning bytes were renamed to
component_bytes() and component_file_name() respectively.

We can drop the directory_reject_invalid_name test - it's not possible
anymore to pass an invalid name to Directories::add.
Invalid names in the Directory proto are still being tested to be
rejected in the validate_invalid_names tests.

Change-Id: Ide4d16415dfd50b7e2d7e0c36d42a3bbeeb9b6c5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12217
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
2024-08-17 15:59:10 +00:00
Florian Klink
8ea7d2b60e refactor(tvix/castore): drop {Directory,File,Symlink}Node
Add a `SymlinkTarget` type to represent validated symlink targets.
With this, no invalid states are representable, so we can make `Node` be
just an enum of all three kind of types, and allow access to these
fields directly.

Change-Id: I20bdd480c8d5e64a827649f303c97023b7e390f2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12216
Reviewed-by: benjaminedwardwebb <benjaminedwardwebb@gmail.com>
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
2024-08-17 09:46:01 +00:00
Florian Klink
49b173786c refactor(tvix/castore): remove name from Nodes
Nodes only have names if they're contained inside a Directory, or if
they're a root node and have something else possibly giving them a name
externally.

This removes all `name` fields in the three different Nodes, and instead
maintains it inside a BTreeMap inside the Directory.

It also removes the NamedNode trait (they don't have a get_name()), as
well as Node::rename(self, name), and all [Partial]Ord implementations
for Node (as they don't have names to use for sorting).

The `nodes()`, `directories()`, `files()` iterators inside a `Directory`
now return a tuple of Name and Node, as does the RootNodesProvider.

The different {Directory,File,Symlink}Node struct constructors got
simpler, and the {Directory,File}Node ones became infallible - as
there's no more possibility to represent invalid state.

The proto structs stayed the same - there's now from_name_and_node and
into_name_and_node to convert back and forth between the two `Node`
structs.

Some further cleanups:

The error types for Node validation were renamed. Everything related to
names is now in the DirectoryError (not yet happy about the naming)

There's some leftover cleanups to do:
 - There should be a from_(sorted_)iter and into_iter in Directory, so
   we can construct and deconstruct in one go.
   That should also enable us to implement conversions from and to the
   proto representation that moves, rather than clones.

 - The BuildRequest and PathInfo structs are still proto-based, so we
   still do a bunch of conversions back and forth there (and have some
   ugly expect there). There's not much point for error handling here,
   this will be moved to stricter types in a followup CL.

Change-Id: I7369a8e3a426f44419c349077cb4fcab2044ebb6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12205
Tested-by: BuildkiteCI
Reviewed-by: yuka <yuka@yuka.dev>
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: benjaminedwardwebb <benjaminedwardwebb@gmail.com>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
2024-08-17 09:45:58 +00:00
Ilan Joselevich
04e9531e65 feat(tvix/cli): Extend nixpkgs eval test to include NixOS installer
The tvix-cli tests now include evaluating the NixOS GNOME installer ISO
image and making sure that its drvPath and outPath matches the one
evaluated by Nix. (This required extending the helper function a bit and
adding docs).

NixOS docs generation is disabled for now, see comments in diff.

Change-Id: Ia510f209b1ec3ef9a823f1e5ac0ef2f5f193976f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12177
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-16 20:59:51 +00:00
Brian Olsen
3cd57ce4e3 feat(tvix/glue): Add refscanner pattern and AsyncRead
This splits the existing ReferenceScanner into a ReferenceScanner and
ReferencePattern as well as adds an AsyncRead implementation that can
do a scan while you read from it.

The reason to split the scanner in two is that generating the pattern
is expensive and when ingesting build results with multiple outputs you
want to do several independant scans that look for the same pattern.

The reader is for scanning files without having to load the entire file
into memory.

Change-Id: I993f5a32308c12d9035840f8e04fe82e8dc1d962
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12052
Autosubmit: Brian Olsen <me@griff.name>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-16 16:26:18 +00:00
Florian Klink
9d20176241 docs(tvix/build/protos): clarify content-addressing
This comment is a bit misleading - everything that's not in this field
is referenced in a content-addressed fashion (by their digest).

Change-Id: I5097131530fd188173393063643c057f588ea2c4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12219
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
2024-08-16 16:03:08 +00:00
Florian Klink
d3c32f214c chore(tvix): bump object_store
Fix for RUSTSEC-2024-0358.

Change-Id: Id9e8c6ae67845d95a52c884035fcea02d2d71505
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12214
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-16 06:52:15 +00:00
Florian Klink
1d3fce5857 chore(tvix/tools/crunch-v2): bump curve25519-dalek
Fix for RUSTSEC-2024-0344.

Change-Id: I11651ea56e52988ee7cef2e02d0cbf61062f5c7b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12213
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
2024-08-16 06:52:15 +00:00
Florian Klink
fa05f12d5d chore(tvix/tools/narinfo2parquet): bump curve25519-dalek
Fix for RUSTSEC-2024-0344.

Change-Id: Iad02bcf312af8b6bf450ab3c4c6de31d9c02ab87
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12212
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-16 06:52:15 +00:00
Florian Klink
65d8b85dca chore(tvix/tools/weave): bump curve25519-dalek
Fix for RUSTSEC-2024-0344.

Change-Id: I414c1424941af1352f4d3b4e5908083ab0cf4e9d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12211
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
2024-08-16 06:52:15 +00:00
Florian Klink
5d3ae11aa5 chore(tvix/nix-compat): bump curve25519-dalek
Fix for RUSTSEC-2024-0344.

Change-Id: I9e9cac5f0dac9e5b2e5a934c99762d982136c0e4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12210
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
2024-08-16 06:45:37 +00:00
Florian Klink
a0a13126ee chore(tvix/tools/crunch-v2): update Cargo.{lock,nix}
These were out of date.

Change-Id: Ideaf888c2851bb9ec36ae01b11d93165b62cd7a5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12209
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-08-16 06:45:37 +00:00
Brian Olsen
39ef171e00 chore(tvix): Retain original passthru in Rust builds
When using the runTests feature of crate2nix the derivation that runs the
tests is put into passthru.test but all default.nix files for Rust crates
in Tvix threw that away.

This commit retains passthru so that you can get access to the test
derivation.

Change-Id: I8b7b7db57a49069348f08c12c00a3b1a41a0c05b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12215
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-15 23:37:00 +00:00
Florian Klink
ad92083dea chore(tvix/tools/narinfo2parquet): update Cargo.{lock,nix}
These were out of date.

Change-Id: I89df37f088ad6c53b676d965f0dc1023f40481f4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12208
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-08-15 21:10:44 +00:00
Florian Klink
38b94f5591 chore(tvix/tools/turbofetch): update Cargo.nix
This was out of date.

Change-Id: Icea6ee865d389d56bc46941f6049721db293ef7e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12207
Tested-by: BuildkiteCI
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Autosubmit: flokli <flokli@flokli.de>
2024-08-15 21:10:44 +00:00
Florian Klink
a4748e5fa6 chore(tvix/tools/wave): update Cargo.lock and Cargo.nix
This apparently was out of date.

Change-Id: I9768d5e62f200169d7815ad85aa0f12eadc56a8e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12206
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-08-15 21:10:44 +00:00
Aspen Smith
83e25fdd19 fix(aspen/system): Remove duplicate email
Change-Id: I7b30ca4940bcc65488b2fbb190b3f51dc4d76c15
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12204
Autosubmit: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: aspen <root@gws.fyi>
2024-08-15 01:28:10 +00:00
sterni
9d8832474c chore(tvix/verify-lang-tests): update latest Nix version
Change-Id: I656c183d970806565d45ffd31f99f73c804dda1d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12203
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-08-14 15:01:03 +00:00
sterni
41706c8764 chore(3p/sources): Bump channels & overlays
* //users/sterni/machines/ingeborg: adjust to yet another API
  change in the fcgiwrap module

Change-Id: Ic601bb7161887dec5cfbe68205be816cf9b92d17
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12202
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: sterni <sternenseemann@systemli.org>
2024-08-14 14:10:44 +00:00
Florian Klink
97c60d9857 docs(tvix/TODO): castore Directory struct is done
There's some followup work on making tvix-build use the stricter structs
natively, but that should probably be combined with the overall trait
changes there.

Add an item there so we won't forget, but this isn't really castore
territory anymore.

Change-Id: I6b1f9fa02d5c87c821d4ddc4b1dcc6a98c4eeaa5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12200
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: yuka <yuka@yuka.dev>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-08-13 18:52:25 +00:00
Florian Klink
c7845f3c88 refactor(tvix/castore): move *Node and Directory to crate root
*Node and Directory are types of the tvix-castore model, not the tvix
DirectoryService model. A DirectoryService only happens to send
Directories.

Move types into individual files in a nodes/ subdirectory, as it's
gotten too cluttered in a single file, and (re-)export all types from
the crate root.

This has the effect that we now cannot poke at private fields directly
from other files inside `crate::directoryservice` (as it's not all in
the same file anymore), but that's a good thing, it now forces us to go
through the proper accessors.

For the same reasons, we currently also need to introduce the `rename`
functions on each *Node directly.

A followup is gonna move the names out of the individual enum kinds, so
we can better represent "unnamed nodes".

Change-Id: Icdb34dcfe454c41c94f2396e8e99973d27db8418
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12199
Reviewed-by: yuka <yuka@yuka.dev>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-13 18:39:49 +00:00
Florian Klink
2f4185ff1a docs(tvix/TODO): DirectoryService with bucketed directories is done
We have this (`ObjectStoreDirectoryService`), as well as some store
composition.

Change-Id: I876f85da1d5b183d80b148c378f825033ec080e4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12198
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
2024-08-13 17:50:27 +00:00
Yureka
3ca0b53840 refactor(tvix/castore): use Directory struct separate from proto one
This uses our own data type to deal with Directories in the castore model.

It makes some undesired states unrepresentable, removing the need for conversions and checking in various places:

 - In the protobuf, blake3 digests could have a wrong length, as proto doesn't know fixed-size fields. We now use `B3Digest`, which makes cloning cheaper, and removes the need to do size-checking everywhere.
 - In the protobuf, we had three different lists for `files`, `symlinks` and `directories`. This was mostly a protobuf size optimization, but made interacting with them a bit awkward. This has now been replaced with a list of enums, and convenience iterators to get various nodes, and add new ones.

Change-Id: I7b92691bb06d77ff3f58a5ccea94a22c16f84f04
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12057
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-13 12:17:01 +00:00
Florian Klink
5d3f3158d6 docs(tvix/store/utils): add docstrings for ServiceUrls*
Describe what these structs are used for, and for each of it, explain
which usecases it's used for.

Change-Id: I8b7857bc68ec2b37df9f5163e06d028a64a12c79
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12195
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-08-12 15:26:31 +00:00
Ilan Joselevich
d2a80dda88 feat(tvix/cli): Add derivation file dumping functionality
Provides a derivation file dumping functionality for tvix-cli that can
be used when passing the --drv-dumpdir CLI arg to tvix-cli.

This will dump all the known derivation files into the specified
directory, making it easier to debug derivation divergences between Tvix
generated drvs and the drvs generated by Nix.

Supersedes: https://cl.tvl.fyi/c/depot/+/11265

Change-Id: I0e10b26eba22032b84ac543af0d4150ad87aed3e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12192
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-12 14:50:17 +00:00
Florian Klink
fd64df0511 fix(tvix/cli): add toplevel docstring to Args struct
Otherwise the flattened `ServiceUrlsMemory` docstring becomes the main
binary description, which doesn't make an awful lot of sense.

The help now describes what this CLI does currently (an interface to use
the different Tvix component.

Also, describe what it does not, so people running it without looking
too much other documentation might not get confused about why this
doesn't do anything in `/nix/store`, or doesn't provide the same CLI
surface as Nix.

Change-Id: Ia4838b444f03a10821801a6171d3e956b3cdfdaf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12194
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
2024-08-12 13:41:50 +00:00
Aspen Smith
1f5a85740e chore(tvix/eval): Update module comment for value::string
This sentence is a little stale; let's just link to NixString directly
for the authoritative source of truth.

Change-Id: I64e065c4148d29702b09820a0e7724a65fae7c67
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12181
Autosubmit: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-11 16:41:34 +00:00
Aspen Smith
e176e1f11a feat(tvix/value): Print derivation values specially
Just like tvix-repl does (except we don't force values when printing
them, so... not entirely like tvix-repl does). But it's something.

Change-Id: I2e69b08d7d82b0b2d337f1d4c5d87ed28475fa84
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12180
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Autosubmit: aspen <root@gws.fyi>
2024-08-11 16:41:34 +00:00
Elle Najt
a781cfcc49 feat(ops/users): Add elle to users
Change-Id: I18492d6e6167f3c010e8f66670a127807ac7d99c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12183
Reviewed-by: aspen <root@gws.fyi>
Autosubmit: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
2024-08-11 03:32:13 +00:00
Aspen Smith
12e6c0bfc0 chore(mailmap): Add my name and email
Change-Id: I109da892dc01368ceb38d34e9095559895cbd60c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12182
Tested-by: BuildkiteCI
Reviewed-by: aspen <root@gws.fyi>
Autosubmit: aspen <root@gws.fyi>
2024-08-11 01:23:46 +00:00
Aspen Smith
f5c6acbbeb fix(tvix/cli): always configure nix path
Configure the nix path even if globals is already set.

Change-Id: I6598c92ab40ff952f73da04d9e7d3aeb13c16b53
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12176
Tested-by: BuildkiteCI
Autosubmit: aspen <root@gws.fyi>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-08-11 01:12:42 +00:00
Aspen Smith
7c2ac040db chore(tvix/eval): Drop obsolete todo
the answer is at https://cl.tvl.fyi/c/depot/+/10798

Change-Id: I5f0ed51a3954c7241ef15a8268e0e51695e994c6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12175
Autosubmit: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-10 19:18:40 +00:00
Aspen Smith
d378111d77 feat(tvix/eval): Store hash in key of interner
Rather than storing the leaked allocation for the string as the key in
the interner, store the hash (using NoHashHashBuilder). I thought this
would improve performance, but it doesn't:

hello outpath           time:   [736.85 ms 748.42 ms 760.42 ms]
                        change: [-2.0754% +0.4798% +2.7096%] (p = 0.72 > 0.05)
                        No change in performance detected.

but it at least doesn't *hurt* performance, and it *does* avoid an
`unsafe`, so it's probably net good.

Change-Id: Ie413955bdb6f04b1f468f511e5ebce56e329fa37
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12049
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: aspen <root@gws.fyi>
2024-08-10 15:28:30 +00:00
Vincent Ambo
a6d6fc418d chore(tazjin/khamovnik): enable ADB
Change-Id: I1c754fdc54465f93dfb10e9d903a66a90447ab85
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12070
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-10 11:37:45 +00:00
Vincent Ambo
c06e26f1cc chore(tazjin/emacs): add tree-sitter grammar for typescript
Had to fix some stuff in a typescript project, it's better with highlighting.

Change-Id: I984540a791167427acde3494182521b8839aed6d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12069
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-08-10 11:37:45 +00:00
Florian Klink
3ea69235a4 fix(web/tvl/2024-08-tvix-update): small fixes
The `Fetch` is an enum, not a struct, and "Type" probably makes more
sense here. Slightly reword the "generic" to not be confused with
generics.

Also fix the link to Tvixbolt, which got eaten by the line wrapping.

Change-Id: I677229f0365523620a640c2333e76790573f7318
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12174
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
2024-08-09 19:18:01 +00:00
Profpatsch
8e13838451 fix(web/tvl): fix 24-08 update typo
Change-Id: I0dc69e527a258c298275f688e728b0f951e3071d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12173
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-08-09 18:29:12 +00:00
Florian Klink
c9a2783d2d feat(web/tvl): add Tvix August Update
Change-Id: I97caa794a2573f7b34f25030c84b5531a9136c44
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12170
Tested-by: BuildkiteCI
Reviewed-by: benjaminedwardwebb <benjaminedwardwebb@gmail.com>
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: flokli <flokli@flokli.de>
2024-08-09 16:24:30 +00:00
edef
7f8997fc80 test(tvix/nix-compat/nar/wire): cover TOK_PAD_PAR
Change-Id: Ib4da612a4144d062f55a22b437c725b8566bee70
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12172
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-09 15:28:46 +00:00
Ilan Joselevich
e505880fde feat(tvix/eval): Re-enable testing for eval-okay-readDir
When we moved to building tvix with crate2nix we had to disable the
readDir tests for the same reasons mentioned in
https://cl.tvl.fyi/c/depot/+/12131. But now with the 12131 CL, we can
re-enable the readDir tests.

In this change I re-enabled the readDir tests in nix_tests by moving
them out of notyetpassing and I also deleted them from tvix_tests
because we don't need them in both places.

Change-Id: I82ac39605299a8b22d80f8b51fc8ec2476d21dc9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12133
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
2024-08-09 14:56:57 +00:00
Ilan Joselevich
3511e328ec feat(tvix/eval): Implement builtins.readFileType
builtins.readFileType was added to Nix back in version 2.14.

The tests were also moved out of notyetpassing in addition to the
readDir fixtures they depend on.

I caught a bug where we previously used std::fs::metadata (via the
.metadata() method on File) which follows symlinks so it would always
return false for is_symlink(). Instead we now use
std::fs::symlink_metadata directly which does not follow symlinks, so
tests now pass. This wasn't an issue for builtins.readDir as it uses
walkdir and walkdir doesn't follow symlinks either.

Change-Id: I58eb97bdb5ec95df4f6882f495f8c572fe7c6793
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12130
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
2024-08-09 14:35:57 +00:00
Ilan Joselevich
9c4b57ac63 fix(third_party/overlays): Patch crate2nix to use mkDerivation for tests
The problem with using runCommand and recreating the src directory with
lndir is that it changes the file types of individual files, they will
now be a symlink instead of a regular file. If you have a crate that tests
that a file is of regular type then it will fail inside the crate2nix
derivation.

Also regenerate Cargo.nix for //tvix as it will be needed in the next
commit.

Change-Id: I9275602cc17a428f9fdf0e55daf12cd673bbc030
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12131
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-09 14:35:57 +00:00
Ilan Joselevich
549e86d95b feat(tvix/verify-lang-tests): Test nixVersions.nix_{2_3,2_23}
With this change the latest Nix version being checked is 2.23
(previously was 2.18). A warning will now be printed when the
latest verified Nix version is out of date.

I added a test to the skip-list because the behavior of
builtins.dirOf has changed in Nix 2.22

Change-Id: Iaf7fa98dbfa599a2d2723df0e42bb459711e2413
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12105
Tested-by: BuildkiteCI
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: flokli <flokli@flokli.de>
2024-08-09 14:19:25 +00:00
Ilan Joselevich
c554c1c1c0 feat(tvix/eval): Implement Display for io::FileType
In newer versions of Nix there's a builtins.readFileType builtin, we
should try to avoid duplicating the enum -> string conversion by
implementating Display before we implement builtins.readFileType.

Change-Id: I579e95949a76eb33d2e7bda0000ed84859df765e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12129
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
2024-08-09 14:03:46 +00:00
edef
591c5ffe53 docs(tvix/nix-compat/nar/wire): fix TOK_EXE grammar
Change-Id: I12b640fe1cbe7a4c69efe4660040486e510deadc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12171
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-09 08:33:01 +00:00
Ilan Joselevich
f648f17ec3 feat(tvix): Jemalloc -> MiMalloc
Use the faster and newer MiMalloc memory allocator for all endpoints in
the workspace.

Change-Id: Ic60237284ed168e46ec6e8f28e2710bae4385c6f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12149
Tested-by: BuildkiteCI
Reviewed-by: aspen <root@gws.fyi>
2024-08-08 08:06:23 +00:00
Aspen Smith
000fb856be chore(aspen/web): some tweaks
Change-Id: I268728af52785efb5e6b3df7d4bfe0e0d54c13a1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12169
Autosubmit: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: aspen <root@gws.fyi>
2024-08-08 03:22:53 +00:00
Aspen Smith
3536a7c7fa feat(aspen/web): Link to some more music i released this year
Change-Id: Ib55b5b02d85257e2d9c30697df7dbb303a6b3c27
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12168
Tested-by: BuildkiteCI
Autosubmit: aspen <root@gws.fyi>
Reviewed-by: aspen <root@gws.fyi>
2024-08-08 03:16:18 +00:00
Aspen Smith
6bd2760aa7 feat(aspen/web): freshen up, mention tvix in projects list
Change-Id: I34d1c3efd32882271ca553f180deb6249014fb32
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12165
Autosubmit: aspen <root@gws.fyi>
Reviewed-by: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
2024-08-08 00:59:17 +00:00
Aspen Smith
d33fd78202 fix(web/tvl/tvl.dot): Update my name
it's about time

Change-Id: Ib93dd8313a0006da1190ca371e83662746333d34
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12062
Autosubmit: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: aspen <root@gws.fyi>
2024-08-08 00:39:18 +00:00
Aspen Smith
172405c40c fix(aspen/system): Drop a broken remote builder
bye bye mugwump

Change-Id: Ie30771caaf23dd10872c33ad60f904f089fa6b6c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12150
Autosubmit: aspen <root@gws.fyi>
Reviewed-by: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
2024-08-08 00:24:53 +00:00
Aspen Smith
6559ab4cf5 feat(tvix/eval): Put interner in a thread-local RefCell
Rather than making the interner be a global lazy_static mutex, put it in
a thread-local RefCell. This doesn't change anything in terms of
sharing (since we're currently actually just single threaded), but
avoids the overhead of a mutex, for a nice performance boost (compared
to the mutex version):

hello outpath           time:   [726.71 ms 729.79 ms 735.69 ms]
                        change: [-5.7277% -3.9733% -2.1144%] (p = 0.00 < 0.05)
                        Performance has improved.

Change-Id: I240b238dcbaf854ebafc3017b4425fb7d7b91b03
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12048
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: aspen <root@gws.fyi>
2024-08-08 00:02:36 +00:00
Aspen Smith
6366cee717 feat(tvix/eval): Intern (and leak) small strings, behind a mutex
This is the most naive version of string interning possible - we store a
map from the string itself to the pointer behind a global mutex, and
memoize the allocation of all strings below a threshold length (16
bytes, for now) into that map. This requires leaking /all/ strings,
since it's not easy to know just from the pointer that a string has been
interned - so interning is disabled if string leaking is also disabled.

In the case where we're leaking strings (the default), even the naive
version of this gets us a pretty nice perfomance boost:

hello outpath           time:   [742.54 ms 745.89 ms 749.14 ms]
                        change: [-2.8722% -2.0135% -1.0654%] (p = 0.00 < 0.05)
                        Performance has improved.

However, in the case where we're not leaking strings, we have to keep
track of which strings have and haven't been interned, which makes this
a little worse:

hello outpath           time:   [779.30 ms 792.82 ms 808.74 ms]
                        change: [+2.5258% +4.0884% +5.8931%] (p = 0.00 < 0.05)
                        Performance has regressed.

Hopefully we can close the gap here a bit with some clever
tricks (coming next).

Change-Id: If08cb48ede703c7fe3bdd8d617443f8a561ad09b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12047
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: aspen <root@gws.fyi>
2024-08-08 00:02:36 +00:00
Aspen Smith
b8f92a6d53 feat(tvix/eval): Forbid Hash{Map,Set}, use Fx instead
Per https://nnethercote.github.io/perf-book/hashing.html, we have
basically no reason to use the default hasher over a faster,
non-DoS-resistant hasher. This gives a nice perf boost basically for
free:

hello outpath           time:   [704.76 ms 714.91 ms 725.63 ms]
                        change: [-7.2391% -6.1018% -4.9189%] (p = 0.00 < 0.05)
                        Performance has improved.

Change-Id: If5587f444ed3af69f8af4eead6af3ea303b4ae68
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12046
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Autosubmit: aspen <root@gws.fyi>
2024-08-07 12:38:40 +00:00
Yureka
1d7ba89c19 chore(tvix): change deprecated default_features to default-features
Change-Id: Ida31fe9a1205cdfc852d2ecbcbda32933b634562
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12143
Reviewed-by: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
2024-08-07 11:36:04 +00:00
Florian Klink
5b0264223f docs(tvix/TODO): document blob prefetching dependency
This depends on the ChunkReader work.

Change-Id: I38878d0f822c312151131e55baee4db6ef1c3650
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12142
Tested-by: BuildkiteCI
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Autosubmit: flokli <flokli@flokli.de>
2024-08-07 10:50:46 +00:00
Florian Klink
c2c4169e49 docs(tvix/TODO): add Correctness > Performance section
Explain the current caveats as far as performance tuning is concerned.

Change-Id: I1a9c11c81de09350240fb61e3c130fc401ef6618
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12141
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: yuka <yuka@yuka.dev>
Tested-by: BuildkiteCI
2024-08-07 10:50:46 +00:00
Profpatsch
f9703a9af5 fix(users/Profpatsch/whatcd-resolver): reduce json data from db
We’d transfer the full json data for each torrent from the db instead
of just the 2 or 3 fields we need.

Adds some more helpers for parsing database values.

Adds some better logging events & traces.

Change-Id: I5db386c4ea247febf5f9fc3815da2e7f11286d41
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12140
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2024-08-06 09:59:40 +00:00
Profpatsch
13d79e04d8 fix(users/Profpatsch/whatcd-resolver): fix postgres query log
The queries would not be interpolated anymore, because we didn’t pass
the thing down deep enough.

Also only init the `pgFormatPool` if we want to use the formatter,
this saves on a bunch of subprocesses.

Change-Id: I8d69ef5aab4d8eac1cbfb1c3991d4edaacba254f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12139
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2024-08-06 09:59:40 +00:00
Profpatsch
2510cd6a5c fix(users/Profpatsch/whatcd-resolver): SQL formatting off
It turns out the pg_format thing is just too slow for my use-cases
most of the time, even when pooling the mf. Most queries stay 90%+ in
the perl script, even though they are very fast to execute on their
own, screwing up the traces a lot.

So instead I replace the `postgres-simple` quasi-quoter that strips
whitespace (and tends to screw up queries anyway) with a simple one
that just removes the outer indentation up to the first line.

Why did I spend so much time on pg_format haha

Change-Id: I911cd869deec68aa5cf430ff4d111b0662ec6d28
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12138
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2024-08-06 09:59:40 +00:00
Profpatsch
3202d008d5 chore(users/Profpatsch): park ical-smolify
Parked projects: I might pick these up again, but don’t want to
maintain them right now. Might delete later, or reinstate.

Change-Id: Ieb4f51dfaeba33c84820ca804b57c016e05bf566
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12137
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2024-08-06 09:59:40 +00:00
Profpatsch
37b2c2ce78 refactor(users/Profpatsch/whatcd-resolver): continue http
Ideally there’d be a better generic abstraction of doing basic http
calls (with tracing) in the future, but for now just reexport.

Change-Id: Id7548739ea62e9172f2773f8db79fe726096b7f1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12136
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2024-08-06 09:59:40 +00:00
Profpatsch
8908fd18ca refactor(users/Profpatsch/whatcd-resolver): start moving http stuff
There’s a bunch of duplication in how http client things are done,
let’s move that all to a single module.

Change-Id: Ic08c9bce49d562e4fa640a5bdfc15973a28a7bcb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12135
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2024-08-06 09:59:40 +00:00
Aspen Smith
59056cf705 feat(tvix/eval): Leak strings (with flag to disable)
Default to always leaking strings, and copying strings by copying
pointers rather than cloning the underlying allocation. This (somewhat
bafflingly) doesn't seem to affect any benchmarks, but paves the way for
some tricks around string allocation that do.

Unfortunately, we can't do this (yet?) for contextful strings, for
reasons I don't currently understand but which I will address later,
when I address contextful strings more holistically.

I've left a flag in here to disable this, both to test the cloning logic
for strings for when/if we decide to bring this back, and to allow
people who care more about memory usage than perf to disable leaking.

Change-Id: Iec44bcbfe9b3d20389d2450b9a551792a79b9b26
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12045
Autosubmit: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-08-05 10:49:27 +00:00
Ilan Joselevich
480a8106cf feat(tvix/store): Sled{PathInfo,Directory}Service -> Redb…
Use redb instead of sled for the default filesystem implementation of
PathInfoService and DirectoryService. In the future we'll also drop sled
support completely.

Change-Id: I513ff0c2ff953d59714aa50b9aa1301b02f53d40
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12085
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-08-04 13:58:07 +00:00
Ilan Joselevich
26129c1761 fix(tvix/crate2nix-check): Revert use of depotfmt.check wrapper
This is a partial revert of https://cl.tvl.fyi/c/depot/+/12068 where I
changed tvix/crate2nix-check to use depotfmt.check. It turns out that we
don't actually want to be using it in this case as the wrapper sets
`--fail-on-change` which would always fail because the Cargo.nix
generated by crate2nix will always need to be changed (It's not
formatted properly).

Change-Id: Ife35c812ca69c90459ce4445f4252d0a24c218fa
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12132
Tested-by: BuildkiteCI
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: flokli <flokli@flokli.de>
2024-08-04 13:47:31 +00:00
Aspen Smith
9c01ab3e84 feat(aspen/system): Switch to podman
Change-Id: Ifc5e724f455627d34b784509c62900fd112cb492
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12134
Autosubmit: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: aspen <root@gws.fyi>
2024-08-04 01:31:49 +00:00
Aspen Smith
66c75ef694 feat(aspen/system): Tweak trackpad settings on laptops
Change-Id: Ie04c97b9b043bdfd8d2d20138d5bc795f340e8b7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12126
Tested-by: BuildkiteCI
Reviewed-by: aspen <root@gws.fyi>
Autosubmit: aspen <root@gws.fyi>
2024-08-03 19:50:45 +00:00
Aspen Smith
af61d64209 chore(aspen/system): Update NixOS config for renamed options
Change-Id: If25502452070492a698326e9f101f9ae421e2426
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12125
Reviewed-by: aspen <root@gws.fyi>
Autosubmit: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
2024-08-03 19:50:45 +00:00
Ilan Joselevich
41dc9ee6a2 feat(tvix/castore): add RedbDirectoryService
This provides a DirectoryService implementation which uses
redb (https://github.com/cberner/redb) as the database. It provides both
in-memory and persistent on-filesystem implementations.

Change-Id: Id8f7c812e2cf401cccd1c382b19907b17a6887bc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12038
Tested-by: BuildkiteCI
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: flokli <flokli@flokli.de>
2024-08-01 13:20:01 +00:00
Ilan Joselevich
87d4b00ff5 chore(web/tvixbolt): Update to latest yew version
Change-Id: I8e89aea317f088142e8006b3a888ec6d28467b47
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12064
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
2024-08-01 11:32:32 +00:00
Aspen Smith
756539a596 chore(3p/sources): Bump channels & overlays (2024-07-28)
* Treewide: re-run depotfmt

* //third_party/nixpkgs:html5validator: build with Python 3.11,
  dependency openstackdocstheme doesn't support 3.12

* //users/sterni/machines/ingeborg: adapt to poorly handled fcgiwrap
  module API change: https://github.com/NixOS/nixpkgs/pull/318599

* //tvix/*-go: regenerate protobuf files

* //third_party/nixpkgs:treefmt: Remove patch for merged pull request

* //users/flokli/ipu6-softisp: rebase, drop upstreamed kernel patches

Change-Id: Ie4e0df007c287e8cd6207683a9a25838aa5bd39a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11971
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: flokli <flokli@flokli.de>
Reviewed-by: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-08-01 10:06:33 +00:00
Aspen Smith
bdf8269859 fix(tvix/glue): coerce path argument to builtins.path to a path
The "path" key in the arguments to builtins.path supports any
path-coercible type (a string, a path...). Coerce it to a path in the
argument rather than just requiring it already be one and throwing an
error if it's not.

This is... annoying to test, since it requires a file with known
contents that's available in the build sandbox. But it works! Trust me!

Fixes: b/412
Change-Id: I3c8e339bf344a208d5ed5990193942651f318745
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12053
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: aspen <root@gws.fyi>
2024-07-31 20:18:46 +00:00
Ilan Joselevich
13720d90bf fix(tvix): Reuse now exposed depotfmt wrapper in crate2nix-check
This change exposes the already existing wrapper for treefmt/depotfmt
that supports running it inside a sandbox. We now reuse it inside
//tvix/crate2nix-check, where we previously duplicated the code. The
check is now stricter and will also fail on changes, so I had to set the
rust edition in the treefmt config.

Change-Id: I000e52421258979c038ba6b1f1ff2db14e391b0c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12068
Tested-by: BuildkiteCI
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: flokli <flokli@flokli.de>
2024-07-31 20:07:43 +00:00
Florian Klink
7cfac04b7d chore(tvix): drop nar-bridge-go
This functionality exists in nar-bridge(-rs) now.

Change-Id: I717484ef64aafad9466c982d2aa8195fe8b98bb9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12065
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-07-30 14:36:31 +00:00
Ilan Joselevich
a595d409de fix(tvix/nar-bridge): filter src in utils.nix
Change-Id: I3c8956a50ecdcc53f882fb46ffdc221dd1515b1a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12066
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-07-30 14:26:58 +00:00
Florian Klink
4277aa0db6 docs(tvix/boot): update README more
The environment variables caused both nar-bridge and tvix-store daemon
to try to connect to the same store, which fails due to locking issues.

Pass the config to `tvix-store daemon` directly. Also, add the
`--otlp=false` to the instructions to remove spam, most users don't have
a OTLP collector running.

Explain when to use gRPC in `tvix-store virtiofs` and when not.

Also, point out to be able to boot a NixOS closure, it needs to be
copied into the store first.

Change-Id: If4eda07bba28ad0bbe70e468cb727441a21b0588
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12067
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2024-07-30 14:14:24 +00:00
Ilan Joselevich
b21ca2ac26 docs(tvix/boot): Update README example
It was previously pointing to a sled implementation which no longer
exists. It was also using nar-bridge-go instead of the new nar-bridge
(rust).

Closes: https://b.tvl.fyi/issues/413
Change-Id: Id0df61d4728198c3ae95a8e27ba7303434892966
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12063
Reviewed-by: aspen <root@gws.fyi>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
2024-07-30 13:10:12 +00:00
Profpatsch
e682e5ce2a fix(users/Profpatsch/whatcd-resolver): make getTorrent no js
Start of an effort to make the app work without javascript
enabled (graceful degradation yay).

We use a trick where buttons are nested into a form element, passing
their value as input; this should be better than depending on
`hx-vals`. If htmx is disabled, just redirect and reload the full page
instead of sending back the snippet. Probably depends on the use-case
of each snippet though.

Change-Id: I6c73e624c4bd29b1cbd5492b2f84f48102edc68b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12056
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2024-07-30 12:41:26 +00:00
Profpatsch
a86dca8c78 feat(users/Profpatsch/whatcd-resolver): read redacted key from env
Change-Id: I5667710423aeeacfbb8dddf5b0b8750dc8f878aa
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12055
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2024-07-30 12:41:26 +00:00
Profpatsch
1f65a7b0d0 fix(users/Profpatsch/whatcd-resolver): better show ApplicationError
Change-Id: I7a1087afc4000299529a7518f273bfee8d651c72
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12054
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2024-07-30 12:41:26 +00:00
Aspen Smith
8aa038a90e test(tvix/glue): Add a benchmark for firefox outPath
This is nice to test too - it's similar to hello, but runs for a lot
longer (like 7.5 seconds on my laptop) which means we get even better
stats for stuff.

Change-Id: I7935818f10a6d846d446e685b9263a72d7e2aabd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12061
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: aspen <root@gws.fyi>
2024-07-30 08:58:49 +00:00
Ilan Joselevich
3f6cd7aebc fix(tvix/store): Immediately return an error when using sled on /
We already do this for redb and for sled in SledDirectoryService.

Change-Id: I34c7178257a6a04e9f12ed4037a4ef585d7b0d54
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12060
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
2024-07-29 16:43:04 +00:00
Ilan Joselevich
47a8baf178 docs(tvix/docs): Remove redb path info service from TODO
It is now implemented and tested since https://cl.tvl.fyi/c/depot/+/11995

Change-Id: Ie08f511edf10bba4f46efc2c13f8db17eb7182a9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12059
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-07-29 15:50:11 +00:00
Ilan Joselevich
9cbebfea27 fix(tvix/store) RedbPathInfoService: improve logs and errors
Add more logging and remove context from errors because that's already
provided by the logs (Errors also need to be refactored anyway, there's
also confusion about StorageError vs InvalidRequest, there's no
consistency)

Change-Id: Ia43c0d237d9075152490c635b05fb3fb343abcc8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12058
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-07-29 15:50:11 +00:00
Brian Olsen
a794790203 fix(tvix/nix-compat): Fix panic in nixbase32 decoding
The decode function didn't check that the input had a valid length and
so would panic when given input with invalid length.

Change-Id: Ie27d006b8fe20f005b4a47a1763821a61e9a95c7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12051
Reviewed-by: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
Autosubmit: Brian Olsen <me@griff.name>
2024-07-28 20:55:51 +00:00
Ilan Joselevich
a982f73477 fix(tvix/store): adjust from_addr redb test to do what it says
Change-Id: If15f161d5c7aba05ac1d8e2a4f6fac5a7053943a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12040
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-07-28 17:47:41 +00:00
Ilan Joselevich
d17f0592da docs(tvix/store): Document redb in from_addr
Change-Id: Id2ef4ee1b22c20e5b79156f40821578979105ddc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12039
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-07-28 16:40:40 +00:00
Matthew Tromp
038d1dd551 feat(tvix/eval): ConstantIdx expansion for more ops
Previously, OpConstant would display some detail about its
ConstantIdx: whether it's a thunk or closure, and what its address
is. This has been expanded to also show when the ConstantIdx is a
blueprint, along with the blueprint's address, and to the other
opcodes that use a ConstantIdx.

Currently, it seems like blueprint addresses don't correspond to the
address of the thunk listed in the bytecode output, but it's still
useful to see that the constant being grabbed is a blueprint, and
maybe this pointer can be made to make more sense in the future.

Change-Id: Ia212b0d52b004c87051542c093274e7106ee08e4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12044
Tested-by: BuildkiteCI
Reviewed-by: aspen <root@gws.fyi>
Autosubmit: chickadee <matthewktromp@gmail.com>
2024-07-27 22:37:59 +00:00
edef
f3c80c10b9 feat(tvix/tools/narinfo2parquet): preserve the deriver
Change-Id: Idbada585b87eef81cad5d40cb7592a7890704695
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12037
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-07-27 21:31:18 +00:00
Matthew Tromp
0b987a509f fix(tvix/eval): don't bubble up io errors from path_exists
path_exists was returning an error when certain common IO errors were
encountered. e.g. in the path "/dev/null/.", path_exists would throw
an error because the underlying call to Path::try_exists threw an
error because null isn't a directory. But if null isn't a directory,
then the path is invalid, so this should really be returning
false. That's what nix's behavior is and that's what makes sense.

The trait function isn't being changed because some other
implementers (e.g. tvix_store_io) have actual errors they can throw.

Fixes: b/411
Change-Id: I9e810e7a198bffe61365697c6d3d7e71f264c20b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12042
Tested-by: BuildkiteCI
Autosubmit: chickadee <matthewktromp@gmail.com>
Reviewed-by: aspen <root@gws.fyi>
2024-07-27 21:29:46 +00:00
Aspen Smith
4769d047b2 fix(tvix/cli): Make :q actually quit
whoops

Change-Id: I5f24163c276992c7858b038ae2bb636da75f3f91
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12043
Autosubmit: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: lukegb <lukegb@tvl.fyi>
2024-07-27 21:19:43 +00:00
Florian Klink
c8f92c6e9f refactor(tvix/nix-compat): introduce CaHash::algo_str
This is the `{fixed,fixed:r,text}:{sha*,md5}` prefix used in various
string representations.

Factor that code out, and use it in the two places it can be used in.

Change-Id: Ic9555fa9e1884198d435e55c7f630b8d3ba2a032
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12041
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Brian Olsen <me@griff.name>
2024-07-27 10:53:56 +00:00
Yureka
5114504b67 test(tvix/castore/dirsvc): check for a pitfall with deduplicated dirs
Change-Id: I3cff2c2e8b2c8a2fd8d8074647d0d99a1db8e693
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12034
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-07-25 09:52:29 +00:00
Yureka
6a988a1598 fix(tvix/castore/GRPCDirectorySvc): fix a bug in the get_recursive fn
When retrieving a closure with get_recursive, the following could happen in the GRPC client:
- The first reference to the deduplicated directory is added to expected_directory_digests
- The deduplicated directory is obtained removed from expected_directory_digests
- The second reference to the deduplicated directory is added to expected_directory_digests
- The deduplicated directory has already been sent, but is still in the
  expected_directory_digests. It looks to the GRPC client like the
  closure is incomplete and the stream ended prematurely.

Change-Id: Ic62bca12e7f8fb85af5fa4dacd199f0f3b8eea8c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12033
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-07-25 09:52:29 +00:00
Yureka
e97202e54a refactor(directoryservice): get rid of NaiveSeeker helper
Use the ChunkedReader in CombinedBlobService instead which also supports seeking.

Change-Id: I681331a80763172c27e55362b7044fe81aaa323b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12031
Autosubmit: yuka <yuka@yuka.dev>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-07-23 20:53:08 +00:00
Florian Klink
9385b3bcfb fix(tvix/boot/tests): check nar-bridge being fully up
Ensure nar-bridge is healthy before connecting to it, don't just check
for the unix socket to be present.

We don't have a proper /health endpoint yet, but nix-cache-info works
fine for now.

Change-Id: I22df2c3b7bffcf52dbd3d00f3ba5382dc06ab03d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12030
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: yuka <yuka@yuka.dev>
Tested-by: BuildkiteCI
2024-07-23 14:47:03 +00:00
Florian Klink
636647ce03 fix(tvix/boot/tests): use grpc health check
Ensure the service is healthy before connecting to it, don't just check
for the unix socket to be present.

Change-Id: If6501828677c247910d91f35b860960802084691
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12029
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
2024-07-23 14:47:03 +00:00
Florian Klink
ca5134c3da feat(3p/overlays/tvl): init grpc-health-check
Change-Id: Icc2429070b0daea9fd230f1f4bb97b9c2eaf24d2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12027
Tested-by: BuildkiteCI
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Autosubmit: flokli <flokli@flokli.de>
2024-07-23 14:34:59 +00:00
Yureka
94a0e21e68 fix(tvix/directoryservice): clarify get_recursive not found
Change-Id: I47f21b4b7db9304eadb04094d41bf04d443fcc3b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12025
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: yuka <yuka@yuka.dev>
2024-07-23 14:04:23 +00:00
Florian Klink
b9aa6456e2 docs(tvix/docs): add TODO for protobuf
Change-Id: Iacf4ef517885bdd6d6366446124863d9a138b12b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12024
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2024-07-23 13:24:42 +00:00
Ilan Joselevich
9f10a71ec5 feat(tvix/store): add redb PathInfoService
This provides a PathInfoService implementation using redb
(https://github.com/cberner/redb) as the underlying storage engine.

Both an in-memory variant, as well as a filesystem one is provided,
similar how it's done with the sled implementation.

Supersedes: https://cl.tvl.fyi/c/depot/+/11692
Change-Id: I744619c51bf2efd0fb63659b12a27cbe0b2fd6fc
Signed-off-by: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11995
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-07-22 18:49:04 +00:00
Yureka
dbe698042d test(tvix/store): add xp-store-composition to feature powerset
Change-Id: Ibbd9a7585ec2f70c8f0f4d25ad858aa5ebc031dd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12023
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Autosubmit: yuka <yuka@yuka.dev>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-07-22 16:30:08 +00:00
Yureka
2547ff2cf6 feat(tvix/store): add grpc healthcheck service to daemon
Change-Id: Ib95fc9352a45d54f9a16c8841c7e8f7cbeeaee8c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12019
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: yuka <yuka@yuka.dev>
2024-07-22 15:57:30 +00:00
Yureka
39c8b6dece fix(store): add toml dependency for feature xp-store-composition
Fixes 'use of undeclared crate or module ' with --features xp-store-composition

Change-Id: I44dce86e656094d180b91a00f385f685d21f3fbd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12021
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: yuka <yuka@yuka.dev>
2024-07-22 15:56:59 +00:00
Vincent Ambo
849e639c71 fix(tazjin/emacs): fix Go indentation offset in tree-sitter mode
Change-Id: Id72ddc6345ee3eb70b7a1d594fe6bcd60d8d0868
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12020
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-07-22 14:39:44 +00:00
Yureka
14a4b4cbc3 feat(tvix): add experimental-store-composition option
Change-Id: I61661fbb0e77ce3c00c2a467dfabdf3fc77d8575
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12011
Autosubmit: yuka <yuka@yuka.dev>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-07-22 13:36:08 +00:00
Yureka
67335c41b7 refactor(tvix): move service addrs into shared clap struct
Change-Id: I7cab29ecfa1823c2103b4c47b7d784bc31459d55
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12008
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: yuka <yuka@yuka.dev>
2024-07-22 13:36:08 +00:00
Yureka
6774d9c59c chore(tvix/tracing): switch tracing-opentelemetry from git to release
Change-Id: Ib830c8b642496a6cdf3d4b9093f0343f5fb80622
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12018
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-07-22 13:36:08 +00:00
Yureka
8342f70c60 feat(tvix/composition): improve error message for unknown tag
Change-Id: I61a31488de17725ae4311f5f5bf8e02edb752cf9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12017
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-07-22 13:36:08 +00:00
sinavir
5d82e1e62f fix(tvix/store): Fix narinfo compression selection
Parsing of the narinfo file sets the compression field to None instead
of Some("none"). The mapping selecting the decompression reader expected
the former in //tvix/store/src/pathinfoservice/nix_http.rs.

Change-Id: I254a825b88a4016aab087446bdc0c7b6286de40c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12007
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-07-21 22:11:20 +00:00
Florian Klink
a3194e9280 feat(tvix/nix-compat): add SigningKey, NARInfo::add_signature
This adds a generic `SigningKey` struct that can be used to sign
NARInfos with signers.

It also includes tooling to parse keypairs from bytes generated by Nix,
returning a specialized ed25519_dalek variant.

Change-Id: Ic9780c370939af54e7177c93cde3321adf189fc3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12014
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-07-21 21:41:54 +00:00
Florian Klink
05b4e805ee refactor(tvix/nix-compat): rename PubKey to VerifyingKey
Align these with the way it's called in the ed25519 crates.

Change-Id: Ia52d3bb9bf831dc6b5f7d5356f5ac62135672883
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12013
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
2024-07-21 21:41:54 +00:00
Florian Klink
62184ee35a docs(tvix): document the builder API
This documents some thoughts and goals of the Tvix Build protocol, and
how it is possible to express Nix builds with it.

Additionally, it explains a proposed design for reference scanning.

Change-Id: I4b1f3feb2278e3c7ce06de831eb8eb1715cba1c9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12012
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: yuka <yuka@yuka.dev>
Tested-by: BuildkiteCI
2024-07-21 21:35:22 +00:00
Yureka
e408783bac test(tvix/composition): add recursion and concurrent tests
Change-Id: Ic10773b08d940b45c3067bd514c3080cadac9606
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12003
Autosubmit: yuka <yuka@yuka.dev>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-07-21 21:18:17 +00:00
Yureka
eea9f3d9ee docs(tvix/composition): add comment about stack
Change-Id: I3888b5034c53728e2f9cfe24213f8854eb38bfe1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12005
Autosubmit: yuka <yuka@yuka.dev>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2024-07-21 18:37:50 +00:00
Yureka
76394daca3 feat(tvix/composition): downcast boxed error if possible
We still have the unique store name to identify which instantiation caused the error. For recursion errors, the full chain is still retained inside the CompositionError.

Change-Id: Iaddcece445a5df331e578d7c69d710db3d5f8dcd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12002
Tested-by: BuildkiteCI
Autosubmit: yuka <yuka@yuka.dev>
Reviewed-by: flokli <flokli@flokli.de>
2024-07-21 17:03:27 +00:00
507 changed files with 23184 additions and 34896 deletions

5
.gitreview Normal file
View file

@ -0,0 +1,5 @@
[gerrit]
host=cl.tvl.fyi
port=29418
project=depot
defaultbranch=canon

View file

@ -1 +1,2 @@
Alyssa Ross <hi@alyssa.is>
Aspen Smith <root@gws.fyi> <aspen@gws.fyi> <grfn@gws.fyi>

View file

@ -15,10 +15,9 @@ partially see this as [an experiment][] in tooling for monorepos.
## Services
* Source code is available primarily through Sourcegraph on
[cs.tvl.fyi](https://cs.tvl.fyi), where it is searchable and even semantically
indexed. A lower-tech view of the repository is also available via cgit-pink
on [code.tvl.fyi](https://code.tvl.fyi).
* Source code can be viewed primarily via `cgit-pink` on
[code.tvl.fyi](https://code.tvl.fyi), with code search being available through
Livegrep on [grep.tvl.fyi](https://grep.tvl.fyi).
The repository can be cloned using `git` from `https://cl.tvl.fyi/depot`.

File diff suppressed because it is too large Load diff

View file

@ -1500,19 +1500,20 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
dependencies = [
"cfg-if",
"once_cell",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
dependencies = [
"bumpalo",
"log",
@ -1537,9 +1538,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -1547,9 +1548,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
dependencies = [
"proc-macro2",
"quote",
@ -1560,9 +1561,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
[[package]]
name = "web-sys"

View file

@ -19,7 +19,7 @@ yew-router = "0.17"
wasm-bindgen-futures = "0.4"
# needs to be in sync with nixpkgs
wasm-bindgen = "= 0.2.92"
wasm-bindgen = "= 0.2.93"
uuid = { version = "1.3.3", features = ["v4", "serde"] }
[dependencies.serde]

View file

@ -363,19 +363,20 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "wasm-bindgen"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
dependencies = [
"cfg-if",
"once_cell",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
dependencies = [
"bumpalo",
"log",
@ -400,9 +401,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -410,9 +411,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
dependencies = [
"proc-macro2",
"quote",
@ -423,9 +424,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
[[package]]
name = "web-sys"

View file

@ -9,4 +9,4 @@ lazy_static = "1.4"
yew = "0.19"
# needs to be in sync with nixpkgs
wasm-bindgen = "= 0.2.92"
wasm-bindgen = "= 0.2.93"

View file

@ -0,0 +1,91 @@
Importing projects into depot
=============================
Before importing an existing `git`-based project into depot, a few questions
need to be answered:
* Is the project licensed under a free software license, or public domain?
* Do you need to import existing history?
* Do you need to export new history with hashes that continue on from the old
history? (e.g. importing an existing repository, and exporting from depot to
the old upstream)
Think about this and then pick an approach below:
## Import with no history (just commit)
Simply copy the files to where you want them to be in depot, and commit. Nothing
else to do!
## Import without continuous history (subtree merge)
This import approach lets you drop an existing project into depot, keep its
existing history, but not retain the ability to continue external history.
This means that if you, for example, import a project from a different git host
using this method, and then continue to commit to it inside of depot, you will
not be able to export a history consistent with your previous hashes using
`josh`.
Commit hashes before the import will exist in depot and be valid.
Still, this approach might be viable if a project "moves into" depot, or has
nothing depending on it externally.
1. Pick a location in depot where you want your project to be (`$loc` from now on).
2. Fetch your project into the same git store as your depot clone (e.g. by
adding it as an upstream and fetching it).
3. Pick the commit you want to merge (`$commit` from now on).
4. Run `git subtree add --prefix=$loc $commit`, which will create the correct
merge commit.
5. Ensure Gerrit [knows about your commit](#preparing-merges-in-gerrit) for the
parent that is being merged.
6. Modify the merge commit's message to start with `subtree($project_name):`.
Gerrit **will not** allow merge commits that do not follow this format.
7. Push your subtree commit for review as normal.
## Import with continuous history
This approach imports the history using `josh`, which means that external
history before/after the import is consistent (you can continue committing in
`depot`, export the history back out, and from an external perspective nothing
changes).
This is what we did with repositories like `nix-1p` and `nixery`.
Note: Inside of depot, the pre-import commit hashes will **not make sense**.
`josh` will rewrite them in such a way that exporting the project will yield the
same hashes, but this rewriting changes the hashes of your commits inside of
depot.
1. Pick a location in depot where you want your project to be (`$loc`).
2. Fetch your project into the same git store as your depot clone (e.g. by
adding it as an upstream and fetching it).
3. Check out the commit you want to merge into depot.
4. Run `josh-filter ":prefix=$loc"`, and take note of the `FILTERED_HEAD` ref
that it produces (`$filtered` from now on).
5. Ensure Gerrit [knows about the filtered commit](#preparing-merges-in-gerrit).
6. Merge the filtered commit into depot using a standard merge, but make sure to
add the `--allow-unrelated-histories` flag. Your commit message **must**
start with `subtree($project_name):`, otherwise Gerrit will not let you push
a merge.
7. Push the merge commit for review as usual.
------------------------------------------------------
## Preparing merges in Gerrit
When pushing a merge to Gerrit, it needs to know about all ancestors of the
merge, otherwise it will try to interpret commits as new CLs and reject them for
not having a change ID (or create a huge number of CLs, if they do have one).
To prevent this, we have a special git ref called `subtree-staging` which you
can push external trees to.
Access to `subtree-staging` has to be granted by a TVL admin, so ping tazjin,
lukegb, flokli, sterni and so on before proceeding.
1. Determine the commit you want to merge (`$commit`).
2. Run `git push -f $commit origin/subtree-staging` (or replace `origin` with
whatever the TVL Gerrit remote is called in your clone).

View file

@ -1,6 +1,7 @@
{ makeSetupHook }:
makeSetupHook {
makeSetupHook
{
name = "rules_java_bazel_hook";
substitutions = {
local_java = ./local_java;

View file

@ -37,7 +37,9 @@ let
cp -R . $out
'';
};
in makeSetupHook {
in
makeSetupHook
{
name = "bazelbuild-rules_nodejs-5-hook";
propagatedBuildInputs = [
nodejs

View file

@ -16,12 +16,16 @@
let
cleanAttrs = lib.flip removeAttrs [
"bazelTargets" "depsHash" "extraCacheInstall" "extraBuildSetup" "extraBuildInstall"
"bazelTargets"
"depsHash"
"extraCacheInstall"
"extraBuildSetup"
"extraBuildInstall"
];
attrs = cleanAttrs baseAttrs;
base = stdenv.mkDerivation (attrs // {
nativeBuildInputs = (attrs.nativeBuildInputs or []) ++ [
nativeBuildInputs = (attrs.nativeBuildInputs or [ ]) ++ [
bazel
];
@ -69,7 +73,7 @@ let
inherit cache;
nativeBuildInputs = (base.nativeBuildInputs or []) ++ [
nativeBuildInputs = (base.nativeBuildInputs or [ ]) ++ [
coreutils
];
@ -102,4 +106,5 @@ let
runHook postInstall
'';
});
in build
in
build

View file

@ -23,7 +23,6 @@ let
{ name
, dependencies ? [ ]
, doCheck ? true
,
}: src:
(if doCheck then testRustSimple else pkgs.lib.id)
(pkgs.buildRustCrate ({

View file

@ -1,5 +1,5 @@
# This program is used as a Gerrit hook to trigger builds on
# Buildkite, Sourcegraph reindexing and other maintenance tasks.
# Buildkite and perform other maintenance tasks.
{ depot, ... }:
depot.nix.buildGo.program {

View file

@ -8,7 +8,6 @@
//
// Gerrit (ref-updated) hook:
// - Trigger Buildkite CI builds
// - Trigger SourceGraph repository index updates
//
// Buildkite (post-command) hook:
// - Submit CL verification status back to Gerrit
@ -55,10 +54,6 @@ type config struct {
BuildkiteProject string `json:"buildkiteProject"`
BuildkiteToken string `json:"buildkiteToken"`
GerritChangeName string `json:"gerritChangeName"`
// Optional configuration for Sourcegraph trigger updates.
SourcegraphUrl string `json:"sourcegraphUrl"`
SourcegraphToken string `json:"sourcegraphToken"`
}
// buildTrigger represents the information passed to besadii when it
@ -154,11 +149,6 @@ func loadConfig() (*config, error) {
return nil, fmt.Errorf("invalid 'gerritChangeName': %s", cfg.GerritChangeName)
}
// Rudimentary config validation logic
if cfg.SourcegraphUrl != "" && cfg.SourcegraphToken == "" {
return nil, fmt.Errorf("'SourcegraphToken' must be set if 'SourcegraphUrl' is set")
}
if cfg.Repository == "" || cfg.Branch == "" {
return nil, fmt.Errorf("missing repository configuration (required: repository, branch)")
}
@ -299,26 +289,6 @@ func triggerBuild(cfg *config, log *syslog.Writer, trigger *buildTrigger) error
return nil
}
// Trigger a Sourcegraph repository index update.
//
// https://docs.sourcegraph.com/admin/repo/webhooks
func triggerIndexUpdate(cfg *config, log *syslog.Writer) error {
req, err := http.NewRequest("POST", cfg.SourcegraphUrl, nil)
if err != nil {
return err
}
req.Header.Add("Authorization", "token "+cfg.SourcegraphToken)
_, err = http.DefaultClient.Do(req)
if err != nil {
return fmt.Errorf("failed to trigger Sourcegraph index update: %w", err)
}
log.Info("triggered sourcegraph index update")
return nil
}
// Gerrit passes more flags than we want, but Rob Pike decided[0] in
// 2013 that the Go art project will not allow users to ignore flags
// because he "doesn't like it". This function allows users to ignore
@ -458,13 +428,6 @@ func gerritHookMain(cfg *config, log *syslog.Writer, trigger *buildTrigger) {
if err != nil {
log.Err(fmt.Sprintf("failed to trigger Buildkite build: %s", err))
}
if cfg.SourcegraphUrl != "" && trigger.ref == cfg.Branch {
err = triggerIndexUpdate(cfg, log)
if err != nil {
log.Err(fmt.Sprintf("failed to trigger sourcegraph index update: %s", err))
}
}
}
func postCommandMain(cfg *config) {

View file

@ -8,7 +8,9 @@ terraform {
}
backend "s3" {
endpoint = "https://objects.dc-sto1.glesys.net"
endpoints = {
s3 = "https://objects.dc-sto1.glesys.net"
}
bucket = "tvl-state"
key = "terraform/tvl-buildkite"
region = "glesys"
@ -16,6 +18,8 @@ terraform {
skip_credentials_validation = true
skip_region_validation = true
skip_metadata_api_check = true
skip_requesting_account_id = true
skip_s3_checksum = true
}
}

View file

@ -4,18 +4,18 @@ version = 3
[[package]]
name = "aho-corasick"
version = "1.1.2"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "anyhow"
version = "1.0.75"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
[[package]]
name = "base64"
@ -25,9 +25,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "bitflags"
version = "2.4.1"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
name = "build-env"
@ -37,11 +37,11 @@ checksum = "e068f31938f954b695423ecaf756179597627d0828c0d3e48c0a722a8b23cf9e"
[[package]]
name = "cc"
version = "1.0.84"
version = "1.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f8e7c90afad890484a21653d08b6e209ae34770fb5ee298f9c699fcc1e5c856"
checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6"
dependencies = [
"libc",
"shlex",
]
[[package]]
@ -73,9 +73,9 @@ dependencies = [
[[package]]
name = "curl"
version = "0.4.44"
version = "0.4.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509bd11746c7ac09ebd19f0b17782eae80aadee26237658a6b4808afb5c11a22"
checksum = "1e2161dd6eba090ff1594084e95fd67aeccf04382ffea77999ea94ed42ec67b6"
dependencies = [
"curl-sys",
"libc",
@ -83,14 +83,14 @@ dependencies = [
"openssl-sys",
"schannel",
"socket2",
"winapi",
"windows-sys 0.52.0",
]
[[package]]
name = "curl-sys"
version = "0.4.68+curl-8.4.0"
version = "0.4.74+curl-8.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4a0d18d88360e374b16b2273c832b5e57258ffc1d4aa4f96b108e0738d5752f"
checksum = "8af10b986114528fcdc4b63b6f5f021b7057618411046a4de2ba0f0149a097bf"
dependencies = [
"cc",
"libc",
@ -98,14 +98,14 @@ dependencies = [
"openssl-sys",
"pkg-config",
"vcpkg",
"windows-sys",
"windows-sys 0.52.0",
]
[[package]]
name = "deranged"
version = "0.3.9"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3"
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
dependencies = [
"powerfmt",
"serde",
@ -113,9 +113,9 @@ dependencies = [
[[package]]
name = "env_logger"
version = "0.10.1"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece"
checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580"
dependencies = [
"humantime",
"is-terminal",
@ -124,16 +124,6 @@ dependencies = [
"termcolor",
]
[[package]]
name = "errno"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "foreign-types"
version = "0.3.2"
@ -178,9 +168,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
[[package]]
name = "hermit-abi"
version = "0.3.3"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
[[package]]
name = "humantime"
@ -190,20 +180,20 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "is-terminal"
version = "0.4.9"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b"
dependencies = [
"hermit-abi",
"rustix",
"windows-sys",
"libc",
"windows-sys 0.52.0",
]
[[package]]
name = "itoa"
version = "1.0.9"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]]
name = "journaldriver"
@ -224,15 +214,15 @@ dependencies = [
[[package]]
name = "lazy_static"
version = "1.4.0"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
version = "0.2.150"
version = "0.2.158"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
[[package]]
name = "libsystemd-sys"
@ -247,9 +237,9 @@ dependencies = [
[[package]]
name = "libz-sys"
version = "1.1.12"
version = "1.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b"
checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472"
dependencies = [
"cc",
"libc",
@ -257,17 +247,11 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "linux-raw-sys"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
[[package]]
name = "log"
version = "0.4.20"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
[[package]]
name = "medallion"
@ -285,21 +269,27 @@ dependencies = [
[[package]]
name = "memchr"
version = "2.6.4"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "num-conv"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]]
name = "once_cell"
version = "1.18.0"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "openssl"
version = "0.10.59"
version = "0.10.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a257ad03cd8fb16ad4172fedf8094451e1af1c4b70097636ef2eac9a5f0cc33"
checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1"
dependencies = [
"bitflags",
"cfg-if",
@ -329,9 +319,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-sys"
version = "0.9.95"
version = "0.9.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40a4130519a360279579c2053038317e40eff64d13fd3f004f9e1b72b8a6aaf9"
checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6"
dependencies = [
"cc",
"libc",
@ -341,9 +331,9 @@ dependencies = [
[[package]]
name = "pkg-config"
version = "0.3.27"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
[[package]]
name = "powerfmt"
@ -353,27 +343,27 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]]
name = "proc-macro2"
version = "1.0.69"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.33"
version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [
"proc-macro2",
]
[[package]]
name = "regex"
version = "1.10.2"
version = "1.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619"
dependencies = [
"aho-corasick",
"memchr",
@ -383,9 +373,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.3"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
dependencies = [
"aho-corasick",
"memchr",
@ -394,52 +384,39 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.8.2"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "rustix"
version = "0.38.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3"
dependencies = [
"bitflags",
"errno",
"libc",
"linux-raw-sys",
"windows-sys",
]
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]]
name = "ryu"
version = "1.0.15"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
[[package]]
name = "schannel"
version = "0.1.22"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88"
checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534"
dependencies = [
"windows-sys",
"windows-sys 0.52.0",
]
[[package]]
name = "serde"
version = "1.0.192"
version = "1.0.209"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001"
checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.192"
version = "1.0.209"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1"
checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170"
dependencies = [
"proc-macro2",
"quote",
@ -448,30 +425,37 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.108"
version = "1.0.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad"
dependencies = [
"itoa",
"memchr",
"ryu",
"serde",
]
[[package]]
name = "socket2"
version = "0.4.10"
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "socket2"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
dependencies = [
"libc",
"winapi",
"windows-sys 0.52.0",
]
[[package]]
name = "syn"
version = "2.0.39"
version = "2.0.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed"
dependencies = [
"proc-macro2",
"quote",
@ -494,21 +478,22 @@ dependencies = [
[[package]]
name = "termcolor"
version = "1.3.0"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64"
checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
dependencies = [
"winapi-util",
]
[[package]]
name = "time"
version = "0.3.30"
version = "0.3.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5"
checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
dependencies = [
"deranged",
"itoa",
"num-conv",
"powerfmt",
"serde",
"time-core",
@ -523,10 +508,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
[[package]]
name = "time-macros"
version = "0.2.15"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20"
checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
dependencies = [
"num-conv",
"time-core",
]
@ -548,55 +534,43 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.6"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
"winapi",
"windows-sys 0.59.0",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.48.0"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.48.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
@ -605,42 +579,48 @@ dependencies = [
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"

View file

@ -10,7 +10,9 @@ terraform {
}
backend "s3" {
endpoint = "https://objects.dc-sto1.glesys.net"
endpoints = {
s3 = "https://objects.dc-sto1.glesys.net"
}
bucket = "tvl-state"
key = "terraform/tvl-keycloak"
region = "glesys"
@ -18,12 +20,19 @@ terraform {
skip_credentials_validation = true
skip_region_validation = true
skip_metadata_api_check = true
skip_requesting_account_id = true
skip_s3_checksum = true
}
}
provider "keycloak" {
client_id = "terraform"
url = "https://auth.tvl.fyi"
# NOTE: Docs mention this applies to "users of the legacy distribution of keycloak".
# However, we get a "failed to perform initial login to Keycloak: error
# sending POST request to https://auth.tvl.fyi/realms/master/protocol/openid-connect/token: 404 Not Found"
# if we don't set this.
base_path = "/auth"
}
resource "keycloak_realm" "tvl" {

View file

@ -22,6 +22,13 @@ resource "keycloak_ldap_user_federation" "tvl_ldap" {
"inetOrgPerson",
"organizationalPerson",
]
lifecycle {
# Without this, terraform wants to recreate the resource.
ignore_changes = [
delete_default_mappers
]
}
}
# keycloak_oidc_identity_provider.github will be destroyed
@ -29,7 +36,7 @@ resource "keycloak_ldap_user_federation" "tvl_ldap" {
resource "keycloak_oidc_identity_provider" "github" {
alias = "github"
provider_id = "github"
client_id = "6d7f8bb2e82bb6739556"
client_id = "Iv23liXfGNIr7InMg5Uo"
client_secret = var.github_client_secret
realm = keycloak_realm.tvl.id
backchannel_supported = false

View file

@ -29,14 +29,30 @@ func Merge(in1 *map[string]interface{}, in2 *map[string]interface{}) *map[string
return in1
}
// The maps are map[string]interface{} with unknown depth.
// Loop over both maps into every level and merge them.
new := make(map[string]interface{})
for k, v := range *in1 {
new[k] = v
}
for k, v := range *in2 {
if existing, ok := new[k]; ok {
// If both values are maps, merge them recursively
if existingMap, ok := existing.(map[string]interface{}); ok {
if newMap, ok := v.(map[string]interface{}); ok {
new[k] = *Merge(&existingMap, &newMap)
} else {
new[k] = v
}
} else {
new[k] = v
}
} else {
new[k] = v
}
}
return &new
}

View file

@ -47,6 +47,9 @@ func TestMergeWithNilMap(t *testing.T) {
func TestMergeMaps(t *testing.T) {
map1 := map[string]interface{}{
"foo": "bar",
"baz": map[string]interface{}{
"qux": "quux",
},
}
map2 := map[string]interface{}{
@ -56,6 +59,9 @@ func TestMergeMaps(t *testing.T) {
result := Merge(&map1, &map2)
expected := map[string]interface{}{
"foo": "bar",
"baz": map[string]interface{}{
"qux": "quux",
},
"bar": "baz",
}

View file

@ -3,6 +3,8 @@
(with depot.ops.machines; [
sanduny
whitby
nixery-01
volgasprint-cache
]) ++
(with depot.users.tazjin.nixos; [

View file

@ -0,0 +1,153 @@
# temporary machine for local binary cache proxy during VolgaSprint
{ depot, lib, pkgs, ... }: # readTree options
{ config, ... }: # passed by module system
let
mod = name: depot.path.origSrc + ("/ops/modules/" + name);
in
{
imports = [
(mod "tvl-users.nix")
];
boot = {
kernelPackages = pkgs.linuxKernel.packages.linux_rpi4;
initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" ];
loader = {
grub.enable = false;
generic-extlinux-compatible.enable = true;
};
};
depot.auto-deploy = {
enable = true;
interval = "hourly";
};
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
options = [ "noatime" ];
};
"/var/public-nix-cache" = {
device = "/dev/sda1";
fsType = "ext4";
};
};
networking = {
firewall = {
enable = true;
allowedTCPPorts = [ 80 443 8098 ];
};
hostName = "volgacache";
domain = "volgasprint.org";
wireless = {
enable = true;
networks.VolgaSprint.psk = "nixos-unstable";
interfaces = [ "wlan0" ];
};
wg-quick.interfaces = {
wg0 = {
address = [ "10.10.10.2/24" "fd42::1/128" ];
dns = [ "1.1.1.1" ];
privateKeyFile = "/etc/wireguard_private_key";
peers = [
{
publicKey = "2MZzEGJzA3HrwkHf91TaKJEHwCNyVvsTLWoIYHrCxhY=";
presharedKeyFile = "/etc/wireguard_preshared_key";
allowedIPs = [ "0.0.0.0/0" "::/0" ];
endpoint = "195.201.63.240:8098";
persistentKeepalive = 15;
}
];
};
};
};
services.openssh.enable = true;
services.nginx = {
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
appendHttpConfig = ''
proxy_cache_path /tmp/pkgcache levels=1:2 keys_zone=cachecache:100m max_size=20g inactive=365d use_temp_path=off;
# Cache only success status codes; in particular we don't want to cache 404s.
# See https://serverfault.com/a/690258/128321
map $status $cache_header {
200 "public";
302 "public";
default "no-cache";
}
access_log /var/log/nginx/access.log;
'';
virtualHosts."cache.volgasprint.org" = {
sslCertificate = "/etc/ssl/cache.volgasprint.org/key.pem";
sslCertificateKey = "/etc/ssl/cache.volgasprint.org/key.pem";
sslTrustedCertificate = "/etc/ssl/cache.volgasprint.org/chain.pem";
locations."/" = {
root = "/var/public-nix-cache";
extraConfig = ''
expires max;
add_header Cache-Control $cache_header always;
# Ask the upstream server if a file isn't available locally
error_page 404 = @fallback;
'';
};
extraConfig = ''
# Using a variable for the upstream endpoint to ensure that it is
# resolved at runtime as opposed to once when the config file is loaded
# and then cached forever (we don't want that):
# see https://tenzer.dk/nginx-with-dynamic-upstreams/
# This fixes errors like
# nginx: [emerg] host not found in upstream "upstream.example.com"
# when the upstream host is not reachable for a short time when
# nginx is started.
resolver 80.67.169.12; # fdn dns
set $upstream_endpoint http://cache.nixos.org;
'';
locations."@fallback" = {
proxyPass = "$upstream_endpoint";
extraConfig = ''
proxy_cache cachecache;
proxy_cache_valid 200 302 60d;
expires max;
add_header Cache-Control $cache_header always;
'';
};
# We always want to copy cache.nixos.org's nix-cache-info file,
# and ignore our own, because `nix-push` by default generates one
# without `Priority` field, and thus that file by default has priority
# 50 (compared to cache.nixos.org's `Priority: 40`), which will make
# download clients prefer `cache.nixos.org` over our binary cache.
locations."= /nix-cache-info" = {
# Note: This is duplicated with the `@fallback` above,
# would be nicer if we could redirect to the @fallback instead.
proxyPass = "$upstream_endpoint";
extraConfig = ''
proxy_cache cachecache;
proxy_cache_valid 200 302 60d;
expires max;
add_header Cache-Control $cache_header always;
'';
};
};
};
hardware.enableRedistributableFirmware = true;
system.stateVersion = "23.11";
}

View file

@ -11,6 +11,7 @@ in
imports = [
(mod "atward.nix")
(mod "cgit.nix")
(mod "cheddar.nix")
(mod "clbot.nix")
(mod "gerrit-autosubmit.nix")
(mod "irccat.nix")
@ -24,7 +25,6 @@ in
(mod "paroxysm.nix")
(mod "restic.nix")
(mod "smtprelay.nix")
(mod "sourcegraph.nix")
(mod "teleirc.nix")
(mod "tvl-buildkite.nix")
(mod "tvl-slapd/default.nix")
@ -306,6 +306,9 @@ in
agentCount = 32;
};
# Run Markdown/code renderer
services.depot.cheddar.enable = true;
# Start a local SMTP relay to Gmail (used by gerrit)
services.depot.smtprelay = {
enable = true;
@ -374,9 +377,6 @@ in
};
services.depot = {
# Run a SourceGraph code search instance
sourcegraph.enable = true;
# Run a livegrep code search instance
livegrep.enable = true;

29
ops/modules/cheddar.nix Normal file
View file

@ -0,0 +1,29 @@
{ depot, config, pkgs, lib, ... }:
let
cfg = config.services.depot.cheddar;
description = "cheddar - markdown/highlighting server";
in
{
options.services.depot.cheddar = with lib; {
enable = mkEnableOption description;
port = mkOption {
description = "Port on which cheddar should listen";
type = types.int;
default = 4238;
};
};
config = lib.mkIf cfg.enable {
systemd.services.cheddar-server = {
inherit description;
wantedBy = [ "multi-user.target" ];
script = "${depot.tools.cheddar}/bin/cheddar --listen 0.0.0.0:${toString cfg.port} --sourcegraph-server";
serviceConfig = {
DynamicUser = true;
Restart = "always";
};
};
};
}

View file

@ -1,60 +0,0 @@
# Run sourcegraph, including its entire machinery, in a container.
# Running it outside of a container is a futile endeavour for now.
{ depot, config, pkgs, lib, ... }:
let
cfg = config.services.depot.sourcegraph;
in
{
options.services.depot.sourcegraph = with lib; {
enable = mkEnableOption "SourceGraph code search engine";
port = mkOption {
description = "Port on which SourceGraph should listen";
type = types.int;
default = 3463;
};
cheddarPort = mkOption {
description = "Port on which cheddar should listen";
type = types.int;
default = 4238;
};
};
config = lib.mkIf cfg.enable {
# Run a cheddar syntax highlighting server
systemd.services.cheddar-server = {
wantedBy = [ "multi-user.target" ];
script = "${depot.tools.cheddar}/bin/cheddar --listen 0.0.0.0:${toString cfg.cheddarPort} --sourcegraph-server";
serviceConfig = {
DynamicUser = true;
Restart = "always";
};
};
virtualisation.oci-containers.containers.sourcegraph = {
image = "sourcegraph/server:3.40.0";
ports = [
"127.0.0.1:${toString cfg.port}:7080"
];
volumes = [
"/var/lib/sourcegraph/etc:/etc/sourcegraph"
"/var/lib/sourcegraph/data:/var/opt/sourcegraph"
];
# TODO(tazjin): Figure out what changed in the protocol.
# environment.SRC_SYNTECT_SERVER = "http://172.17.0.1:${toString cfg.cheddarPort}";
# Sourcegraph needs a higher nofile limit, it logs warnings
# otherwise (unclear whether it actually affects the service).
extraOptions = [
"--ulimit"
"nofile=10000:10000"
];
};
};
}

View file

@ -1,3 +1,5 @@
# This configuration redirects from the previous Sourcegraph instance to
# livegrep/cgit where appropriate.
{ config, ... }:
{
@ -13,17 +15,50 @@
forceSSL = true;
extraConfig = ''
location = / {
return 301 https://cs.tvl.fyi/depot;
set $lineno "";
# depot root
location = /depot {
return 301 https://code.tvl.fyi/tree/;
}
# folder/file on canon
location ~ ^/depot/-/(blob|tree)/([^\s]*)$ {
set $path $2;
if ($args ~ ^L(\d+)(-\d+)?$) {
set $lineno "#n$1";
}
return 302 https://code.tvl.fyi/tree/$path$lineno;
}
# folder/file on specific commit
location ~ ^/depot@([a-f0-9]+)/-/(blob|tree)/([^\s]*)$ {
set $commit $1;
set $path $3;
if ($args ~ ^L(\d+)(-\d+)?$) {
set $lineno "#n$1";
}
return 302 https://code.tvl.fyi/tree/$path?id=$commit$lineno;
}
# commit info
location ~ ^/depot/-/commit/([a-f0-9]+)$ {
set $commit $1;
return 302 https://code.tvl.fyi/commit/?id=$commit;
}
# search handler
# This only redirects to the new search, it doesn't try to parse and
# rewrite the query.
location /search {
return 302 https://grep.tvl.fyi/search;
}
location / {
proxy_set_header X-Sg-Auth "Anonymous";
proxy_pass http://localhost:${toString config.services.depot.sourcegraph.port};
}
location /users/Anonymous/settings {
return 301 https://cs.tvl.fyi;
return 404 "TVL code search has moved to grep.tvl.fyi and we could not figure out how to rewrite your query. Sorry!";
}
'';
};

View file

@ -1,54 +0,0 @@
# serve tazjin's website & blog
{ depot, config, lib, pkgs, ... }:
{
imports = [
./base.nix
];
config = {
services.nginx.virtualHosts."tazj.in" = {
enableACME = true;
forceSSL = true;
root = depot.users.tazjin.homepage;
serverAliases = [ "www.tazj.in" ];
extraConfig = ''
location = /en/rss.xml {
return 301 https://tazj.in/feed.atom;
}
${depot.users.tazjin.blog.oldRedirects}
location /blog/ {
alias ${depot.users.tazjin.blog.rendered}/;
if ($request_uri ~ ^/(.*)\.html$) {
return 302 /$1;
}
try_files $uri $uri.html $uri/ =404;
}
location = /predlozhnik {
return 302 https://predlozhnik.ru;
}
# redirect for easier entry on a TV
location = /tv {
return 302 https://tazj.in/blobs/play.html;
}
# Temporary place for serving static files.
location /blobs/ {
alias /var/lib/tazjins-blobs/;
}
'';
};
services.nginx.virtualHosts."git.tazj.in" = {
enableACME = true;
forceSSL = true;
extraConfig = "return 301 https://code.tvl.fyi$request_uri;";
};
};
}

View file

@ -63,5 +63,6 @@ in rec {
whitbySystem = (nixosFor depot.ops.machines.whitby).system;
sandunySystem = (nixosFor depot.ops.machines.sanduny).system;
nixeryDev01System = (nixosFor depot.ops.machines.nixery-01).system;
volgaSprintCacheSystem = (nixosFor depot.ops.machines.volgasprint-cache).system;
meta.ci.targets = [ "sandunySystem" "whitbySystem" "nixeryDev01System" ];
}

View file

@ -88,10 +88,12 @@ steps:
continue_on_failure: true
# Exit with success or failure depending on whether any other steps
# failed.
# failed (but not retried).
#
# This information is checked by querying the Buildkite GraphQL API
# and fetching the count of failed steps.
# and fetching all failed steps, then filtering out the ones that were
# retried (retried jobs create new jobs, which would also show up in the
# query).
#
# This step must be :duck: (yes, really!) because the post-command
# hook will inspect this name.
@ -109,8 +111,8 @@ steps:
readonly FAILED_JOBS=$(curl 'https://graphql.buildkite.com/v1' \
--silent \
-H "Authorization: Bearer $(cat ${BUILDKITE_TOKEN_PATH})" \
-d "{\"query\": \"query BuildStatusQuery { build(uuid: \\\"$BUILDKITE_BUILD_ID\\\") { jobs(passed: false) { count } } }\"}" | \
jq -r '.data.build.jobs.count')
-d "{\"query\": \"query BuildStatusQuery { build(uuid: \\\"$BUILDKITE_BUILD_ID\\\") { jobs(passed: false, first: 500 ) { edges { node { ... on JobTypeCommand { retried } } } } } }\"}" | \
jq -r '.data.build.jobs.edges | map(select(.node.retried == false)) | length')
echo "$$FAILED_JOBS build jobs failed."

Binary file not shown.

View file

@ -21,6 +21,11 @@
email = "root@gws.fyi";
password = "{ARGON2}$argon2id$v=19$m=65536,t=2,p=1$5NEYPJ19nDITK5sGr4bzhQ$Xzpzth6y4w+HGvioHiYgzqFiwMDx0B7HAh+PVbkRuuk";
}
{
username = "azahi";
email = "azat@bahawi.net";
password = "{ARGON2}$argon2id$v=19$m=19456,t=2,p=1$BVRzgfs8YIorOTq62B00CQ$5UXHyG/Ivn5TqB7UNgfjYJMxTjun3NDvAStWFom4oas";
}
{
username = "chickadee";
email = "matthewktromp@gmail.com";
@ -36,11 +41,21 @@
email = "me@cynthia.re";
password = "{ARGON2}$argon2id$v=19$m=65536,t=4,p=1$TxjbMGenhEmkyYLrg5uGhbr60THB86YeRZg5bPdiTJo$k9gbRlAPjmxwdUwzbavvsAVkckgQZ0jS2oTtvZBPysk";
}
{
username = "domenkozar";
email = "domen@cachix.org";
password = "{ARGON2}$argon2id$v=19$m=19456,t=2,p=1$c9WgMrTqPJZenOr5+wlnnQ$XOpRZRTkduzP2+NJBxkg2jhffurg7PDla4/RoAyclwI";
}
{
username = "edef";
email = "edef@edef.eu";
password = "{ARGON2}$argon2id$v=19$m=65536,t=2,p=1$OORx4ERbkgvTmuYCJA8cIw$i5qaBzHkRVw7Tl+wZsTFTDqJwF0vuZqhW3VpknMYMc0";
}
{
username = "elle";
email = "lnajt4@gmail.com";
password = "{ARGON2}$argon2id$v=19$m=19456,t=2,p=1$b5Bfq6u+fEKbtpixOl+yPw$nCyTLbSDYsw30ZiSxhJ6N99IIPQAnS2XRNlpEx9os+0";
}
{
username = "ericvolp12";
email = "ericvolp12@gmail.com";
@ -111,6 +126,11 @@
email = "lukegb@tvl.fyi";
password = "{SSHA}7a85VNhpFElFw+N5xcjgGmt4HnBsaGp4";
}
{
username = "mrflos";
email = "mrflos@yeswiki.pro";
password = "{ARGON2}$argon2id$v=19$m=19456,t=2,p=1$/D1y+6n3+0GigG9mCMqK8A$9PseWm3+QATxN/M3Wu4JM+CnIppLD/LbQaVEKLItv9o";
}
{
username = "noteed";
email = "noteed@gmail.com";
@ -153,6 +173,11 @@
email = "tazjin@tvl.su";
password = "{ARGON2}$argon2id$v=19$m=65536,t=2,p=1$wOPEl9D3kSke//oLtbvqrg$j0npwwXgaXQ/emefKUwL59tH8hdmtzbgH2rQzWSmE2Y";
}
{
username = "yl3dy";
email = "aleksandr.kiselyov@gmail.com";
password = "{ARGON2}$argon2id$v=19$m=19456,t=2,p=1$vPvOa0/7RzDLuD/icQuIzQ$IVMSI7hh/frihuL11sNRj6Jz8TTn1wZZHjZZGszz3pI";
}
{
username = "implr";
email = "implr@hackerspace.pl";
@ -259,4 +284,24 @@
email = "tvix@sinavir.fr";
password = "{ARGON2}$argon2id$v=19$m=19456,t=2,p=1$5GXvoN/enVljV97yE/Zasg$OrgY9/ge2LoxNm9OOqxh/kKLxoAvU54MbQa9WWiT0jY";
}
{
username = "emery";
email = "emery@dmz.rs";
password = "{ARGON2}$argon2id$v=19$m=19456,t=2,p=1$b2k5UpTJafqM7yjHfVRjBg$zFGy/ZeI9Hb71TUfJwFp7qDKyUl8tdyFDUK1uNBYfUI";
}
{
username = "aziz";
email = "abd.aziz89@gmail.com";
password = "{ARGON2}$argon2id$v=19$m=19456,t=2,p=1$xTvdtTF+gavMfF8556CiiQ$IshnauhlEr80skpv5s6ueJLkQxlynzBt6oCp3cQrNCY";
}
{
username = "nikiv";
email = "nikita@nikiv.dev";
password = "{ARGON2}$argon2id$v=19$m=19456,t=2,p=1$79mMAD2XYa5dg7D9ueWMpw$Edf5WODrFpkNDyWaMdLKcgcErFLx4khmPIk8wzmYGUE";
}
{
username = "ein-shved";
email = "mestofel13@gmail.com";
password = "{ARGON2}$argon2id$v=19$m=19456,t=2,p=1$D4wzfJoyFye48QNdrC66VA$aBJ/ZaL+rTgXoQa/nFdpHap3G/Oju8WlHaWTii95X8E";
}
]

47
third_party/chicago95/default.nix vendored Normal file
View file

@ -0,0 +1,47 @@
# A rendition of everyone's favourite computer theme.
{ pkgs, ... }:
let
# Chicago95 has no GTK-4 theme (because GTK-4 removed important features that
# it needs), but there is a project with an approximation.
#
# This is a bit of a hack, but I inject that project's GTK-4 theme as if it
# was a part of Chicago95.
#
# This other project is GPL-3.0, under which Chicago95 is also distributed.
gtk4ProjectSrc = pkgs.fetchFromGitHub {
owner = "B00merang-Project";
repo = "Windows-95";
rev = "055abd7a3608afdcb2ef021732e07020f2b416b2";
hash = "sha256:1li6wzyn3y09d188xki1h96pmn4xcx2lklfc4rkiq2y2r22wx7kz";
};
in
pkgs.stdenvNoCC.mkDerivation {
pname = "Chicago95";
version = "master";
src = pkgs.fetchFromGitHub {
owner = "grassmunk";
repo = "Chicago95";
rev = "bdf5cf36a16102aaac297f3de887c601c2b1146f";
hash = "sha256:11fsy3bam1rhp1292zflvzmf1432z1p0ncwy3601wl2f8rnvfdfm";
};
# The project has a Makefile, but it's broken in all sorts of ways, so we just
# copy the important stuff manually.
dontBuild = true;
installPhase = ''
mkdir -p $out/share/{icons,fonts,themes,sounds,qt5ct/colors}
cp -r Theme/Chicago95 $out/share/themes
cp -r Icons/* $out/share/icons
cp -r Cursors/* $out/share/icons
cp -r Fonts/* $out/share/fonts
cp Extras/Chicago95_qt.conf $out/share/qt5ct/colors
cp -r ${gtk4ProjectSrc}/gtk-4.0 $out/share/themes/Chicago95
'';
meta.license = pkgs.lib.licenses.gpl3;
}

View file

@ -1,15 +1,7 @@
{ pkgs, ... }:
{ depot, lib, ... }:
let
gitignoreNix = import
(pkgs.fetchFromGitHub {
owner = "hercules-ci";
repo = "gitignore";
rev = "f9e996052b5af4032fe6150bba4a6fe4f7b9d698";
sha256 = "0jrh5ghisaqdd0vldbywags20m2cxpkbbk5jjjmwaw0gr8nhsafv";
})
{ inherit (pkgs) lib; };
gitignoreNix = import depot.third_party.sources."gitignore.nix" { inherit lib; };
in
{
__functor = _: gitignoreNix.gitignoreSource;

View file

@ -58,6 +58,9 @@ let
# the big lis package change breaks everything in //3p/lisp, undo it for now.
lispPackages = stableNixpkgs.lispPackages;
# mypaint is broken on stable (2024-09-05)
mypaint = stableNixpkgs.mypaint;
};
# Overlay to expose the nixpkgs commits we are using to other Nix code.

View file

@ -1,140 +0,0 @@
commit 1397e10225d8c6fd079a86fccd58fb5d0f4200bc
Author: Florian Klink <flokli@flokli.de>
Date: Fri Mar 29 10:06:34 2024 +0100
feat(bigtable/emulator): allow listening on Unix Domain Sockets
cbtemulator listening on unix domain sockets is much easier than trying
to allocate free TCP ports, especially if many cbtemulators are run at
the same time in integration tests.
This adds an additional flag, address, which has priority if it's set,
rather than host:port.
`NewServer` already takes a `laddr string`, so we simply check for it to
contain slashes, and if so, listen on unix, rather than TCP.
diff --git a/bigtable/bttest/inmem.go b/bigtable/bttest/inmem.go
index 556abc2a85..33e4bf2667 100644
--- a/bttest/inmem.go
+++ b/bttest/inmem.go
@@ -40,6 +40,7 @@ import (
"math"
"math/rand"
"net"
+ "os"
"regexp"
"sort"
"strings"
@@ -106,7 +107,15 @@ type server struct {
// The Server will be listening for gRPC connections, without TLS,
// on the provided address. The resolved address is named by the Addr field.
func NewServer(laddr string, opt ...grpc.ServerOption) (*Server, error) {
- l, err := net.Listen("tcp", laddr)
+ var l net.Listener
+ var err error
+
+ // If the address contains slashes, listen on a unix domain socket instead.
+ if strings.Contains(laddr, "/") {
+ l, err = net.Listen("unix", laddr)
+ } else {
+ l, err = net.Listen("tcp", laddr)
+ }
if err != nil {
return nil, err
}
diff --git a/bigtable/cmd/emulator/cbtemulator.go b/bigtable/cmd/emulator/cbtemulator.go
index 144c09ffb1..deaf69b717 100644
--- a/cmd/emulator/cbtemulator.go
+++ b/cmd/emulator/cbtemulator.go
@@ -27,8 +27,9 @@ import (
)
var (
- host = flag.String("host", "localhost", "the address to bind to on the local machine")
- port = flag.Int("port", 9000, "the port number to bind to on the local machine")
+ host = flag.String("host", "localhost", "the address to bind to on the local machine")
+ port = flag.Int("port", 9000, "the port number to bind to on the local machine")
+ address = flag.String("address", "", "address:port number or unix socket path to listen on. Has priority over host/port")
)
const (
@@ -42,7 +43,15 @@ func main() {
grpc.MaxRecvMsgSize(maxMsgSize),
grpc.MaxSendMsgSize(maxMsgSize),
}
- srv, err := bttest.NewServer(fmt.Sprintf("%s:%d", *host, *port), opts...)
+
+ var laddr string
+ if *address != "" {
+ laddr = *address
+ } else {
+ laddr = fmt.Sprintf("%s:%d", *host, *port)
+ }
+
+ srv, err := bttest.NewServer(laddr, opts...)
if err != nil {
log.Fatalf("failed to start emulator: %v", err)
}
commit ce16f843d6c93159d86b3807c6d9ff66e43aac67
Author: Florian Klink <flokli@flokli.de>
Date: Fri Mar 29 11:53:15 2024 +0100
feat(bigtable): clean up unix socket on close
Call srv.Close when receiving an interrupt, and delete the unix domain
socket in that function.
diff --git a/bigtable/bttest/inmem.go b/bigtable/bttest/inmem.go
index 33e4bf2667..0dc96024b1 100644
--- a/bttest/inmem.go
+++ b/bttest/inmem.go
@@ -148,6 +148,11 @@ func (s *Server) Close() {
s.srv.Stop()
s.l.Close()
+
+ // clean up unix socket
+ if strings.Contains(s.Addr, "/") {
+ _ = os.Remove(s.Addr)
+ }
}
func (s *server) CreateTable(ctx context.Context, req *btapb.CreateTableRequest) (*btapb.Table, error) {
diff --git a/bigtable/cmd/emulator/cbtemulator.go b/bigtable/cmd/emulator/cbtemulator.go
index deaf69b717..5a9e8f7a8c 100644
--- a/cmd/emulator/cbtemulator.go
+++ b/cmd/emulator/cbtemulator.go
@@ -18,9 +18,12 @@ cbtemulator launches the in-memory Cloud Bigtable server on the given address.
package main
import (
+ "context"
"flag"
"fmt"
"log"
+ "os"
+ "os/signal"
"cloud.google.com/go/bigtable/bttest"
"google.golang.org/grpc"
@@ -51,11 +54,18 @@ func main() {
laddr = fmt.Sprintf("%s:%d", *host, *port)
}
+ ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
+ defer stop()
+
srv, err := bttest.NewServer(laddr, opts...)
if err != nil {
log.Fatalf("failed to start emulator: %v", err)
}
fmt.Printf("Cloud Bigtable emulator running on %s\n", srv.Addr)
- select {}
+ select {
+ case <-ctx.Done():
+ srv.Close()
+ stop()
+ }
}

View file

@ -0,0 +1,109 @@
From 96f66ec32e003c6c215aa2a644281289a71dae7d Mon Sep 17 00:00:00 2001
From: Ilan Joselevich <personal@ilanjoselevich.com>
Date: Sun, 4 Aug 2024 02:35:27 +0300
Subject: [PATCH] Fix: Use mkDerivation with src instead of runCommand for test
derivation
The problem with using runCommand and recreating the src directory with
lndir is that it changes the file types of individual files, they will
now be a symlink instead of a regular file. If you have a crate that tests
that a file is of regular type then it will fail inside the crate2nix derivation.
---
templates/nix/crate2nix/default.nix | 81 ++++++++-----------
1 file changed, 35 insertions(+), 46 deletions(-)
diff --git a/templates/nix/crate2nix/default.nix b/templates/nix/crate2nix/default.nix
index c53925e..90e10c6 100644
--- a/templates/nix/crate2nix/default.nix
+++ b/templates/nix/crate2nix/default.nix
@@ -120,52 +120,41 @@ rec {
testPostRun
]);
in
- pkgs.runCommand "run-tests-${testCrate.name}"
- {
- inherit testCrateFlags;
- buildInputs = testInputs;
- } ''
- set -e
-
- export RUST_BACKTRACE=1
-
- # recreate a file hierarchy as when running tests with cargo
-
- # the source for test data
- # It's necessary to locate the source in $NIX_BUILD_TOP/source/
- # instead of $NIX_BUILD_TOP/
- # because we compiled those test binaries in the former and not the latter.
- # So all paths will expect source tree to be there and not in the build top directly.
- # For example: $NIX_BUILD_TOP := /build in general, if you ask yourself.
- # NOTE: There could be edge cases if `crate.sourceRoot` does exist but
- # it's very hard to reason about them.
- # Open a bug if you run into this!
- mkdir -p source/
- cd source/
-
- ${pkgs.buildPackages.xorg.lndir}/bin/lndir ${crate.src}
-
- # build outputs
- testRoot=target/debug
- mkdir -p $testRoot
-
- # executables of the crate
- # we copy to prevent std::env::current_exe() to resolve to a store location
- for i in ${crate}/bin/*; do
- cp "$i" "$testRoot"
- done
- chmod +w -R .
-
- # test harness executables are suffixed with a hash, like cargo does
- # this allows to prevent name collision with the main
- # executables of the crate
- hash=$(basename $out)
- for file in ${drv}/tests/*; do
- f=$testRoot/$(basename $file)-$hash
- cp $file $f
- ${testCommand}
- done
- '';
+ pkgs.stdenvNoCC.mkDerivation {
+ name = "run-tests-${testCrate.name}";
+
+ inherit (crate) src;
+
+ inherit testCrateFlags;
+
+ buildInputs = testInputs;
+
+ buildPhase = ''
+ set -e
+ export RUST_BACKTRACE=1
+
+ # build outputs
+ testRoot=target/debug
+ mkdir -p $testRoot
+
+ # executables of the crate
+ # we copy to prevent std::env::current_exe() to resolve to a store location
+ for i in ${crate}/bin/*; do
+ cp "$i" "$testRoot"
+ done
+ chmod +w -R .
+
+ # test harness executables are suffixed with a hash, like cargo does
+ # this allows to prevent name collision with the main
+ # executables of the crate
+ hash=$(basename $out)
+ for file in ${drv}/tests/*; do
+ f=$testRoot/$(basename $file)-$hash
+ cp $file $f
+ ${testCommand}
+ done
+ '';
+ };
in
pkgs.runCommand "${crate.name}-linked"
{
--
2.44.0

View file

@ -90,15 +90,10 @@ depot.nix.readTree.drvTargets {
};
}));
# https://github.com/googleapis/google-cloud-go/pull/9665
cbtemulator = super.cbtemulator.overrideAttrs (old: {
patches = old.patches or [ ] ++ [
./patches/cbtemulator-uds.patch
];
});
crate2nix = super.crate2nix.overrideAttrs (old: {
patches = old.patches or [ ] ++ [
# TODO(Kranzes): Remove in next release.
./patches/crate2nix-0001-Fix-Use-mkDerivation-with-src-instead-of-runCommand.patch
# https://github.com/nix-community/crate2nix/pull/301
./patches/crate2nix-tests-debug.patch
];
@ -112,6 +107,25 @@ depot.nix.readTree.drvTargets {
];
});
# https://github.com/NixOS/nixpkgs/pull/329415/files
grpc-health-check = super.rustPlatform.buildRustPackage {
pname = "grpc-health-check";
version = "unstable-2022-08-19";
src = super.fetchFromGitHub {
owner = "paypizza";
repo = "grpc-health-check";
rev = "f61bb5e10beadc5ed53144cc540d66e19fc510bd";
hash = "sha256-nKut9c1HHIacdRcmvlXe0GrtkgCWN6sxJ4ImO0CIDdo=";
};
cargoHash = "sha256-lz+815iE+oXBQ3PfqBO0QBpZY6x1SNR7OU7BjkRszzI=";
nativeBuildInputs = [ super.protobuf ];
# tests fail
doCheck = false;
};
# Imports a patch that fixes usage of this package on versions
# >=1.9. The patch has been proposed upstream, but so far with no
# reactions from the maintainer:
@ -121,6 +135,11 @@ depot.nix.readTree.drvTargets {
patches = (old.patches or [ ]) ++ [ ./patches/tpm2-pkcs11-190-dbupgrade.patch ];
});
# Dependency isn't supported by Python 3.12
html5validator = super.html5validator.override {
python3 = self.python311;
};
# macFUSE bump containing fix for https://github.com/osxfuse/osxfuse/issues/974
# https://github.com/NixOS/nixpkgs/pull/320197
fuse =
@ -133,9 +152,4 @@ depot.nix.readTree.drvTargets {
hash = "sha256-ucTzO2qdN4QkowMVvC3+4pjEVjbwMsB0xFk+bvQxwtQ=";
};
}) else super.fuse;
treefmt = super.treefmt.overrideAttrs (old: {
# https://github.com/numtide/treefmt/pull/328
patches = old.patches or [ ] ++ [ ./patches/treefmt-fix-no-cache.patch ];
});
}

View file

@ -0,0 +1,78 @@
From cc4718cbea1bd70de21a2be515a944802246ffc7 Mon Sep 17 00:00:00 2001
From: Vincent Ambo <mail@tazj.in>
Date: Sun, 15 Sep 2024 03:08:28 +0300
Subject: [PATCH] remove dependency on plausible
We don't need spyware, thanks.
---
package-lock.json | 9 ---------
package.json | 1 -
src/App.svelte | 8 --------
3 files changed, 18 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index d52de6c0..d96e342f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -29,7 +29,6 @@
"marked-katex-extension": "^5.1.1",
"marked-linkify-it": "^3.1.11",
"md5": "^2.3.0",
- "plausible-tracker": "^0.3.9",
"svelte": "^4.2.19",
"twemoji": "^14.0.2",
"zod": "^3.23.8"
@@ -3697,14 +3696,6 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
- "node_modules/plausible-tracker": {
- "version": "0.3.9",
- "resolved": "https://registry.npmjs.org/plausible-tracker/-/plausible-tracker-0.3.9.tgz",
- "integrity": "sha512-hMhneYm3GCPyQon88SZrVJx+LlqhM1kZFQbuAgXPoh/Az2YvO1B6bitT9qlhpiTdJlsT5lsr3gPmzoVjb5CDXA==",
- "engines": {
- "node": ">=10"
- }
- },
"node_modules/playwright": {
"version": "1.46.1",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.46.1.tgz",
diff --git a/package.json b/package.json
index 6d569ad9..61e8d892 100644
--- a/package.json
+++ b/package.json
@@ -73,7 +73,6 @@
"marked-katex-extension": "^5.1.1",
"marked-linkify-it": "^3.1.11",
"md5": "^2.3.0",
- "plausible-tracker": "^0.3.9",
"svelte": "^4.2.19",
"twemoji": "^14.0.2",
"zod": "^3.23.8"
diff --git a/src/App.svelte b/src/App.svelte
index 8161c390..4281ba61 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -1,6 +1,4 @@
<script lang="ts">
- import Plausible from "plausible-tracker";
-
import * as router from "@app/lib/router";
import { unreachable } from "@app/lib/utils";
@@ -28,12 +26,6 @@
void router.loadFromLocation();
- if (import.meta.env.PROD) {
- const plausible = Plausible({ domain: "app.radicle.xyz" });
-
- plausible.enableAutoPageviews();
- }
-
$: document.documentElement.setAttribute("data-codefont", $codeFont);
$: document.documentElement.setAttribute("data-theme", $theme);
</script>
--
2.46.0

View file

@ -0,0 +1,66 @@
# radicle-explorer is the web UI for Radicle.
#
# They have an upstream Nix derivation, but it only works with experimental
# features Nix and is quite messy, so this is a copy of the relevant parts.
{ lib, pkgs, ... }:
let
twemoji-assets = pkgs.fetchFromGitHub {
owner = "twitter";
repo = "twemoji";
rev = "v14.0.2";
hash = "sha256-YoOnZ5uVukzi/6bLi22Y8U5TpplPzB7ji42l+/ys5xI=";
};
httpdSrc = pkgs.radicle-httpd.src;
in
lib.fix (self: pkgs.buildNpmPackage rec {
pname = "radicle-explorer";
version = (builtins.fromJSON (builtins.readFile "${src}/package.json")).version;
# source should be synced with the httpd, which is already in nixpkgs
src = pkgs.fetchgit {
inherit (httpdSrc) url rev;
hash = "sha256:09m13238h6j7g02r6332ihgyyzbjx90pgz14rz29pgv7936h6il8";
};
# This might change during nixpkgs bumps and will need updating. Need to fix
# upstream so that there is a normal, callable derivation.
npmDepsHash = "sha256:1hbrzfjkfc0q8qk03yi6qb9zqm57h7hnkn7fl0yxkrzbrljaljaz";
patches = [
./0001-remove-dependency-on-plausible.patch
];
postPatch = ''
patchShebangs --build ./scripts
mkdir -p "public/twemoji"
cp -t public/twemoji -r -- ${twemoji-assets}/assets/svg/*
: >scripts/install-twemoji-assets
'';
dontConfigure = true;
doCheck = false;
installPhase = ''
runHook preInstall
mkdir -p "$out"
cp -r -t "$out" build/*
runHook postInstall
'';
# Override the build-time configuration with other preferred seeds which are
# displayed on the landing page.
passthru.withPreferredSeeds = seeds:
let
originalConfig = builtins.fromJSON (builtins.readFile "${src}/config/default.json");
config = originalConfig // {
preferredSeeds = seeds;
};
newConfig = pkgs.writeText "local.json" (builtins.toJSON config);
in
self.overrideAttrs (_: {
preBuild = ''
cp ${newConfig} config/local.json
'';
});
})

View file

@ -292,130 +292,4 @@ depot.nix.readTree.drvTargets rec{
sha256 = "1kd047p8jv6mhmfzddjvfa2nwkfrb3l1wml6lfm51n1cr06cc9lz";
};
libz-sys = buildRustCrate {
pname = "libz-sys";
version = "1.1.2";
sha256 = "1y7v6bkwr4b6yaf951p1ns7mx47b29ziwdd5wziaic14gs1gwq30";
buildDependencies = [
cc
pkg-config
];
};
libgit2-sys = buildRustCrate {
pname = "libgit2-sys";
version = "0.16.2+1.7.2";
sha256 = "0bs446idbmg8s13jvb0ck6qmrskcdn2mp3d4mn9ggxbmiw4ryd3g";
dependencies = [
libc
libz-sys
];
libPath = "lib.rs";
libName = "libgit2_sys";
# TODO: this should be available via `pkgs.defaultCrateOverrides`,
# I thought that was included by default?
nativeBuildInputs = [ pkg-config ];
buildInputs = [ pkgs.zlib pkgs.libgit2 ];
buildDependencies = [
cc
pkg-config
];
env.LIBGIT2_NO_VENDOR = "1";
};
matches = buildRustCrate {
pname = "matches";
version = "0.1.8";
sha256 = "03hl636fg6xggy0a26200xs74amk3k9n0908rga2szn68agyz3cv";
libPath = "lib.rs";
};
percent-encoding = buildRustCrate {
pname = "percent-encoding";
version = "2.1.0";
sha256 = "0i838f2nr81585ckmfymf8l1x1vdmx6n8xqvli0lgcy60yl2axy3";
libPath = "lib.rs";
};
form_urlencoded = buildRustCrate {
pname = "form_urlencoded";
version = "1.0.1";
sha256 = "0rhv2hfrzk2smdh27walkm66zlvccnnwrbd47fmf8jh6m420dhj8";
dependencies = [
matches
percent-encoding
];
};
tinyvec_macros = buildRustCrate {
pname = "tinyvec_macros";
version = "0.1.0";
sha256 = "0aim73hyq5g8b2hs9gjq2sv0xm4xzfbwp5fdyg1frljqzkapq682";
};
tinyvec = buildRustCrate {
pname = "tinyvec";
version = "1.2.0";
sha256 = "1c95nma20kiyrjwfsk7hzd5ir6yy4bm63fmfbfb4dm9ahnlvdp3y";
features = [ "alloc" ];
dependencies = [
tinyvec_macros
];
};
unicode-normalization = buildRustCrate {
pname = "unicode-normalization";
version = "0.1.17";
sha256 = "0w4s0avzlf7pzcclhhih93aap613398sshm6jrxcwq0f9lhis11c";
dependencies = [
tinyvec
];
};
unicode-bidi = buildRustCrate {
pname = "unicode-bidi";
version = "0.3.5";
sha256 = "193jzlxj1dfcms2381lyd45zh4ywlicj9lzcfpid1zbkmfarymkz";
dependencies = [
matches
];
};
idna = buildRustCrate {
pname = "idna";
version = "0.2.3";
sha256 = "0hwypd0fpym9lmd4bbqpwyr5lhrlvmvzhi1vy9asc5wxwkzrh299";
dependencies = [
matches
unicode-normalization
unicode-bidi
];
};
url = buildRustCrate {
pname = "url";
version = "2.2.1";
sha256 = "1ci1djafh83qhpzbmxnr9w5gcrjs3ghf8rrxdy4vklqyji6fvn5v";
dependencies = [
form_urlencoded
idna
matches
percent-encoding
];
};
git2 = buildRustCrate {
pname = "git2";
edition = "2018";
version = "0.18.1";
sha256 = "1d1wm8cn37svyxgvzfapwilkkc9d2x7fcrgciwn8b2pv9aqz102k";
dependencies = [
bitflags
libc
libgit2-sys
log
url
];
};
}

View file

@ -5,10 +5,22 @@
"homepage": "https://matrix.to/#/#agenix:nixos.org",
"owner": "ryantm",
"repo": "agenix",
"rev": "c2fc0762bbe8feb06a2e59a364fa81b3a57671c9",
"sha256": "1lpkwinlax40b7xgzspbkm9rsi4a1x48hxhixnni4irxxwnav0ah",
"rev": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41",
"sha256": "1x8nd8hvsq6mvzig122vprwigsr3z2skanig65haqswn7z7amsvg",
"type": "tarball",
"url": "https://github.com/ryantm/agenix/archive/c2fc0762bbe8feb06a2e59a364fa81b3a57671c9.tar.gz",
"url": "https://github.com/ryantm/agenix/archive/f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"gitignore.nix": {
"branch": "master",
"description": "Nix functions for filtering local git sources",
"homepage": "",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"sha256": "02wxkdpbhlm3yk5mhkhsp3kwakc16xpmsf2baw57nz1dg459qv8w",
"type": "tarball",
"url": "https://github.com/hercules-ci/gitignore.nix/archive/637db329424fd7e46cf4185293b9cc8c88c95394.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"home-manager": {
@ -17,10 +29,10 @@
"homepage": "https://nix-community.github.io/home-manager/",
"owner": "nix-community",
"repo": "home-manager",
"rev": "a7117efb3725e6197dd95424136f79147aa35e5b",
"sha256": "02q3ck1hjs8xzdhfikqxrnsfs9vh4p7rmdha3vbp6nkkdbdvhgg7",
"rev": "a9c9cc6e50f7cbd2d58ccb1cd46a1e06e9e445ff",
"sha256": "1cxp9rgczr4rhhx1klwcr7a61khizq8hv63gvmy9gfsx7fp4h60a",
"type": "tarball",
"url": "https://github.com/nix-community/home-manager/archive/a7117efb3725e6197dd95424136f79147aa35e5b.tar.gz",
"url": "https://github.com/nix-community/home-manager/archive/a9c9cc6e50f7cbd2d58ccb1cd46a1e06e9e445ff.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"impermanence": {
@ -29,10 +41,10 @@
"homepage": "",
"owner": "nix-community",
"repo": "impermanence",
"rev": "a33ef102a02ce77d3e39c25197664b7a636f9c30",
"sha256": "1mig6ns8l5iynsm6pfbnx2b9hmr592s1kqbw6gq1n25czdlcniam",
"rev": "63f4d0443e32b0dd7189001ee1894066765d18a5",
"sha256": "0xnshgwfg834dm9l14p2w3wmhjysjpqpgfk37im0vrk1qgva19g2",
"type": "tarball",
"url": "https://github.com/nix-community/impermanence/archive/a33ef102a02ce77d3e39c25197664b7a636f9c30.tar.gz",
"url": "https://github.com/nix-community/impermanence/archive/63f4d0443e32b0dd7189001ee1894066765d18a5.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"naersk": {
@ -41,10 +53,10 @@
"homepage": "",
"owner": "nmattia",
"repo": "naersk",
"rev": "fa19d8c135e776dc97f4dcca08656a0eeb28d5c0",
"sha256": "1mif058gcbw5d5yixsmzalqlr0h9m9mmbsgv8v4r2mmsbw83k2x0",
"rev": "3fb418eaf352498f6b6c30592e3beb63df42ef11",
"sha256": "0v6ncaqm8q2mdv1jhkjjwi1sx4firlhjxpw4wachkwkriyjnkz5g",
"type": "tarball",
"url": "https://github.com/nmattia/naersk/archive/fa19d8c135e776dc97f4dcca08656a0eeb28d5c0.tar.gz",
"url": "https://github.com/nmattia/naersk/archive/3fb418eaf352498f6b6c30592e3beb63df42ef11.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"napalm": {
@ -53,10 +65,10 @@
"homepage": "",
"owner": "nix-community",
"repo": "napalm",
"rev": "edcb26c266ca37c9521f6a97f33234633cbec186",
"sha256": "0ai1ax380nnpz0mbgbc5vdzafyjilcmdj7kgv087x2vagpprb4yy",
"rev": "e1babff744cd278b56abe8478008b4a9e23036cf",
"sha256": "04h62p4hxw7fhclki7hcn739hhig3rh9q4njp24j7bm0dk2kj8h6",
"type": "tarball",
"url": "https://github.com/nix-community/napalm/archive/edcb26c266ca37c9521f6a97f33234633cbec186.tar.gz",
"url": "https://github.com/nix-community/napalm/archive/e1babff744cd278b56abe8478008b4a9e23036cf.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
@ -65,10 +77,10 @@
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7f993cdf26ccef564eabf31fdb40d140821e12bc",
"sha256": "0dypbvibfdmv14rqlamf451625fw2fyk11prw9bbywi0q2i313d5",
"rev": "99dc8785f6a0adac95f5e2ab05cc2e1bf666d172",
"sha256": "11vz7dshwxszab91da1x98qdlmpxi0v7daz24jj3crpll68n93w0",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/7f993cdf26ccef564eabf31fdb40d140821e12bc.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/99dc8785f6a0adac95f5e2ab05cc2e1bf666d172.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs-stable": {
@ -77,10 +89,10 @@
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a2e1d0414259a144ebdc048408a807e69e0565af",
"sha256": "1jv90bz3s7j294fhpb29k735fg3xfs9z848szicqarpbz7wfg03g",
"rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5",
"sha256": "1f5d2g1p6nfwycpmrnnmc2xmcszp804adp16knjvdkj8nz36y1fg",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/a2e1d0414259a144ebdc048408a807e69e0565af.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/205fd4226592cc83fd4c0885a3e4c9c400efabb5.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"rust-overlay": {
@ -89,10 +101,10 @@
"homepage": "",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "6dc3e45fe4aee36efeed24d64fc68b1f989d5465",
"sha256": "0vqgkzbfdj920lbm1dy8kylrv2gk4ard38lb3i20xvp2mp1d39n2",
"rev": "20c8461785d8f5af32d8d4d5c128589e23d7f033",
"sha256": "1zy2jcy2ika83dwcpxxvmimk317zimwn7hv8h3v43apqwssl0nxv",
"type": "tarball",
"url": "https://github.com/oxalica/rust-overlay/archive/6dc3e45fe4aee36efeed24d64fc68b1f989d5465.tar.gz",
"url": "https://github.com/oxalica/rust-overlay/archive/20c8461785d8f5af32d8d4d5c128589e23d7f033.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"rustsec-advisory-db": {
@ -101,10 +113,10 @@
"homepage": "https://rustsec.org",
"owner": "RustSec",
"repo": "advisory-db",
"rev": "af76d4423761499f954411bb3071dcc72e6b0450",
"sha256": "167qxr66j638km3z7zk2drjdr4bgqz77hr35vkwdp0lbafmd6y1c",
"rev": "3cae2352cf82b5815b98aa309e0f4df6aa737cec",
"sha256": "0bba56sk4dlrf8rm3dmy9bxf95bq4rm1g3ppk4n2vfw0wzf7v7ap",
"type": "tarball",
"url": "https://github.com/RustSec/advisory-db/archive/af76d4423761499f954411bb3071dcc72e6b0450.tar.gz",
"url": "https://github.com/RustSec/advisory-db/archive/3cae2352cf82b5815b98aa309e0f4df6aa737cec.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

602
tools/cheddar/Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,7 @@ depot.nix.lazy-deps {
depotfmt.attr = "tools.depotfmt";
fetch-depot-inbox.attr = "tools.fetch-depot-inbox";
git-r.attr = "tools.git-r";
git-review.attr = "third_party.nixpkgs.git-review";
gerrit-update.attr = "tools.gerrit-update";
gerrit.attr = "tools.gerrit-cli";
hash-password.attr = "tools.hash-password";

View file

@ -1,24 +1,14 @@
# Builds treefmt for depot, with a hardcoded configuration that
# includes the right paths to formatters.
{ depot, pkgs, ... }:
{ pkgs, ... }:
let
# terraform fmt can't handle multiple paths at once, but treefmt
# expects this
terraformat = pkgs.writeShellScript "terraformat" ''
echo "$@" | xargs -n1 ${pkgs.terraform}/bin/terraform fmt
'';
config = pkgs.writeText "depot-treefmt-config" ''
[formatter.go]
command = "${depot.nix.buildGo.go}/bin/gofmt"
command = "${pkgs.go}/bin/gofmt"
options = [ "-w" ]
includes = ["*.go"]
[formatter.tf]
command = "${terraformat}"
includes = [ "*.tf" ]
[formatter.nix]
command = "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt"
includes = [ "*.nix" ]
@ -28,8 +18,10 @@ let
[formatter.rust]
command = "${pkgs.rustfmt}/bin/rustfmt"
options = ["--edition", "2021"]
includes = [ "*.rs" ]
excludes = [
"users/emery/*",
"users/tazjin/*",
]
'';
@ -53,10 +45,12 @@ let
'';
in
depotfmt.overrideAttrs (_: {
passthru.config = config;
passthru.meta.ci.extraSteps.check = {
passthru = {
inherit config check;
meta.ci.extraSteps.check = {
label = "depot formatting check";
command = check;
alwaysRun = true;
};
};
})

View file

@ -0,0 +1,23 @@
{ depot, pkgs, ... }:
let
em = depot.tools.eaglemode;
in
em.mkCommand {
name = "9 B";
hotkey = "Ctrl+E";
icon = "${./plan9.tga}";
description = ''
Plumb target to Sam or Acme
'';
code = ''
ErrorIfNotSingleTarget();
my @tgt=GetTgt();
my $dir=$tgt[0];
ExecOrError('${pkgs.plan9port}/bin/9', 'B', $dir);
'';
}

View file

@ -0,0 +1,26 @@
{ depot, pkgs, ... }:
let
em = depot.tools.eaglemode;
icon = em.mkTGA "emacs" "${pkgs.emacs}/share/icons/hicolor/128x128/apps/emacs.png";
in
em.mkCommand {
name = "Emacsclient";
hotkey = "Ctrl+E";
icon = "${icon}";
description = ''
Open target in Emacsclient.
Emacs server must be running already for this to have any effect.
'';
code = ''
ErrorIfNotSingleTarget();
my @tgt=GetTgt();
my $dir=$tgt[0];
ExecOrError('${pkgs.emacs}/bin/emacsclient', '-n', $dir);
'';
}

Binary file not shown.

146
tools/eaglemode/default.nix Normal file
View file

@ -0,0 +1,146 @@
# Helper functions for extending Eagle Mode with useful stuff.
#
# Eagle Mode's customisation usually expects people to copy the entire
# configuration into their user folder, which we can automate fairly easily
# using Nix, letting users choose whether to keep upstream config or not.
{ depot, lib, pkgs, ... }:
let
mkDesc = d: lib.concatMapStringsSep "\n"
(x: "# Descr =${x}")
(builtins.filter (s: s != "") (lib.splitString "\n" d));
configWrapper = pkgs.runCommand "eaglemode-config-wrapper" { } ''
cp ${./wrapper.go} wrapper.go
export HOME=$PWD
${pkgs.go}/bin/go build wrapper.go
install -Dm755 wrapper $out/bin/wrapper
'';
in
rec {
# mkCommand creates an Eagle Mode command for the file browser.
#
# Commands are basically little Perl scripts with a command standard library
# available. They receive the user's selected target from Eagle Mode.
mkCommand = lib.makeOverridable (
{
# Name of the command.
name
, # User-facing description, displayed in Eagle Mode UI. Can be multi-line.
description
, # Verbatim Perl code of the command. Command library is already available.
code
, # Caption for the UI button (defaults to name).
caption ? name
, icon ? "terminal.tga"
, # TODO: what's a good default?
hotkey ? ""
, order ? 1.0
}: pkgs.writeTextDir "emFileMan/Commands/${name}.pl" (''
#!${pkgs.perl}/bin/perl
#[[BEGIN PROPERTIES]]
# Type = Command
# Interpreter = perl
# DefaultFor = directory
# Caption = ${caption}
# Order = ${toString order}
# Icon = ${icon}
''
+ (lib.optionalString (description != "") "${mkDesc description}\n")
+ (lib.optionalString (hotkey != "") "# Hotkey = ${hotkey}\n")
+ ''
#[[END PROPERTIES]]
use strict;
use warnings;
BEGIN { require "$ENV{'EM_DIR'}/res/emFileMan/scripts/cmd-util.pl"; }
${if builtins.isString code
then code
else (if builtins.isPath code
then builtins.readFile code
else throw "code must be a string (literal code) or path to file")}
'')
);
# mkTGA converts the given image to a TGA image.
mkTGA = name: path: pkgs.runCommand "${name}.tga" { } ''
${pkgs.imagemagick}/bin/convert ${path} $out
'';
buildPlugin = lib.makeOverridable (
{ name
, src
, version
, eaglemode ? pkgs.eaglemode
, target ? name
, extraNativeBuildInputs ? [ ]
, extraBuildInputs ? [ ]
}:
pkgs.stdenv.mkDerivation {
pname = "eaglemode-plugin-${name}";
inherit src version;
# inherit (eaglemode.drvAttrs) dontPatchELF;
nativeBuildInputs = eaglemode.drvAttrs.nativeBuildInputs ++ extraNativeBuildInputs;
buildInputs = eaglemode.drvAttrs.buildInputs ++ extraBuildInputs ++ [ eaglemode ];
buildPhase = ''
runHook preBuild
# merge eaglemode & plugin folders
cp -r ${pkgs.srcOnly eaglemode} merged-src && chmod -R u+rw merged-src
cp -r $src/* merged-src && chmod -R u+rw merged-src
cd merged-src
export NIX_LDFLAGS="$NIX_LDFLAGS -lXxf86vm -lXext -lXinerama"
perl make.pl build projects=${target} continue=no
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/lib
cp -r lib/lib${target}.so $out/lib
if [ -d "$src/etc" ]; then
cp -r $src/etc/* $out
fi
runHook postInstall
'';
}
);
# etcDir creates a directory layout suitable for use in the EM_USER_CONFIG_DIR
# environment variable.
#
# Note that Eagle Mode requires the value of that variable to be mutable at
# runtime (it is the same place where it persists all of its user-controlled
# state), so the results of this function can not be used directly.
etcDir =
{ eaglemode ? pkgs.eaglemode
, extraPaths ? [ ]
}: pkgs.runCommand "eaglemode-config" { } ''
mkdir $out
${
lib.concatMapStringsSep "\n" (s: "cp -rT ${s} $out/\nchmod -R u+rw $out/\n") ([ "${eaglemode}/etc"] ++ extraPaths)
}
'';
# withConfig creates an Eagle Mode wrapper that runs it with the given
# configuration.
withConfig = { eaglemode ? pkgs.eaglemode, config }: pkgs.writeShellScriptBin "eaglemode" ''
${configWrapper}/bin/wrapper --em-config "${config}"
if [ -d "${config}/lib" ]; then
export LD_LIBRARY_PATH="${config}/lib:$LD_LIBRARY_PATH"
exec ${eaglemode}/bin/eaglemode "$@"
fi
exec ${eaglemode}/bin/eaglemode "$@"
'';
}

View file

@ -0,0 +1,10 @@
{ depot, pkgs, ... }:
depot.tools.eaglemode.buildPlugin {
name = "avif";
version = "canon";
src = ./.;
target = "PlAvif";
extraBuildInputs = [ pkgs.libavif ];
extraNativeBuildInputs = [ pkgs.pkg-config ];
}

View file

@ -0,0 +1,6 @@
#%rec:emFpPlugin%#
FileTypes = { ".avif" }
Priority = 1.0
Library = "PlAvif"
Function = "PlAvifFpPluginFunc"

View file

@ -0,0 +1,64 @@
package PlAvif;
use strict;
use warnings;
sub GetDependencies
{
return ('emCore');
}
sub IsEssential
{
return 0;
}
sub GetFileHandlingrules
{
return ();
}
sub GetExtraBuildOptions
{
return ();
}
sub Build
{
shift;
my %options=@_;
my @libAvifFlags=();
if ($options{'avif-inc-dir'} eq '' && $options{'avif-lib-dir'} eq '') {
@libAvifFlags=split("\n",readpipe(
"perl \"".$options{'utils'}."/PkgConfig.pl\" libavif"
));
}
if (!@libAvifFlags) {
if ($options{'avif-inc-dir'} ne '') {
push(@libAvifFlags, "--inc-search-dir", $options{'avif-inc-dir'});
}
if ($options{'avif-lib-dir'} ne '') {
push(@libAvifFlags, "--lib-search-dir", $options{'avif-lib-dir'});
}
push(@libAvifFlags, "--link", "avif");
}
system(
@{$options{'unicc_call'}},
"--math",
"--rtti",
"--exceptions",
"--bin-dir" , "bin",
"--lib-dir" , "lib",
"--obj-dir" , "obj",
"--inc-search-dir", "include",
@libAvifFlags,
"--link" , "emCore",
"--type" , "dynlib",
"--name" , "PlAvif",
"src/PlAvif.cpp"
)==0 or return 0;
return 1;
}

View file

@ -0,0 +1,190 @@
#include <emCore/emFpPlugin.h>
#include <emCore/emImageFile.h>
#include "avif/avif.h"
class PlAvifImageFileModel : public emImageFileModel
{
public:
static emRef<PlAvifImageFileModel> Acquire(
emContext & context, const emString & name, bool common=true
);
protected:
PlAvifImageFileModel(emContext & context, const emString & name);
virtual ~PlAvifImageFileModel();
virtual void TryStartLoading();
virtual bool TryContinueLoading();
virtual void QuitLoading();
virtual void TryStartSaving();
virtual bool TryContinueSaving();
virtual void QuitSaving();
virtual emUInt64 CalcMemoryNeed();
virtual double CalcFileProgress();
private:
struct LoadingState;
LoadingState * L = NULL;
};
struct PlAvifImageFileModel::LoadingState {
avifRGBImage rgb;
avifDecoder * decoder;
};
emRef<PlAvifImageFileModel> PlAvifImageFileModel::Acquire(
emContext & context, const emString & name, bool common
)
{
EM_IMPL_ACQUIRE(PlAvifImageFileModel, context, name, common)
}
PlAvifImageFileModel::PlAvifImageFileModel(
emContext & context, const emString & name
)
: emImageFileModel(context, name)
{
}
PlAvifImageFileModel::~PlAvifImageFileModel()
{
PlAvifImageFileModel::QuitLoading();
PlAvifImageFileModel::QuitSaving();
}
void PlAvifImageFileModel::TryStartLoading()
{
avifResult result;
L = new LoadingState;
memset(L, 0, sizeof(LoadingState));
L->decoder = avifDecoderCreate();
if (L->decoder == NULL) {
throw emException("failed to create AVIF decoder");
}
result = avifDecoderSetIOFile(L->decoder, GetFilePath());
if (result != AVIF_RESULT_OK) {
throw emException("%s", avifResultToString(result));
}
result = avifDecoderParse(L->decoder);
if (result != AVIF_RESULT_OK) {
throw emException("%s", avifResultToString(result));
}
FileFormatInfo = emString::Format(
"AVIF %s %ubpc",
avifPixelFormatToString(L->decoder->image->yuvFormat),
L->decoder->image->depth
);
Signal(ChangeSignal);
}
bool PlAvifImageFileModel::TryContinueLoading()
{
avifResult result;
if (!Image.GetHeight()) {
Image.Setup(
L->decoder->image->width,
L->decoder->image->height,
L->decoder->alphaPresent ? 4 : 3
);
}
result = avifDecoderNextImage(L->decoder);
if (result != AVIF_RESULT_OK) {
throw emException("%s", avifResultToString(result));
}
avifRGBImageSetDefaults(&L->rgb, L->decoder->image);
L->rgb.format = L->decoder->alphaPresent ?
AVIF_RGB_FORMAT_RGBA : AVIF_RGB_FORMAT_RGB;
L->rgb.pixels = Image.GetWritableMap();
L->rgb.width = Image.GetWidth();
L->rgb.height = Image.GetHeight();
L->rgb.depth = 8;
L->rgb.rowBytes = Image.GetWidth() * Image.GetChannelCount();
result = avifImageYUVToRGB(L->decoder->image, &L->rgb);
if (result != AVIF_RESULT_OK) {
throw emException("%s", avifResultToString(result));
}
Signal(ChangeSignal);
return true;
}
void PlAvifImageFileModel::QuitLoading()
{
if (L) {
if (L->decoder) avifDecoderDestroy(L->decoder);
delete L;
L = NULL;
}
}
void PlAvifImageFileModel::TryStartSaving()
{
throw emException("PlAvifImageFileModel: Saving not implemented.");
}
bool PlAvifImageFileModel::TryContinueSaving()
{
return false;
}
void PlAvifImageFileModel::QuitSaving()
{
}
emUInt64 PlAvifImageFileModel::CalcMemoryNeed()
{
return
(emUInt64)
L->decoder->image->width *
L->decoder->image->height *
(L->decoder->alphaPresent ? 4 : 3);
}
double PlAvifImageFileModel::CalcFileProgress()
{
return 0.0;
}
extern "C" {
emPanel * PlAvifFpPluginFunc(
emPanel::ParentArg parent, const emString & name,
const emString & path, emFpPlugin * plugin,
emString * errorBuf
)
{
if (plugin->Properties.GetCount()) {
*errorBuf="PlAvifFpPlugin: No properties allowed.";
return NULL;
}
return new emImageFilePanel(
parent, name,
PlAvifImageFileModel::Acquire(
parent.GetRootContext(), path
)
);
}
}

View file

@ -0,0 +1,17 @@
{ depot, pkgs, ... }:
let
em = depot.tools.eaglemode;
emSrc = with pkgs; srcOnly eaglemode;
in
em.buildPlugin {
name = "example";
version = "canon";
src = pkgs.runCommand "em-plugin-example-src" { } ''
set -ux
cp -r ${emSrc}/doc/examples/CppApiExamples/PluginExample $out
'';
target = "PlEx";
}

View file

@ -0,0 +1,12 @@
{ depot, pkgs, ... }:
let
em = depot.tools.eaglemode;
emSrc = pkgs.srcOnly pkgs.em;
in
em.buildPlugin {
name = "qoi";
version = "canon";
src = ./.;
target = "PlQoi";
}

View file

@ -0,0 +1,6 @@
#%rec:emFpPlugin%#
FileTypes = { ".qoi" }
Priority = 1.0
Library = "PlQoi"
Function = "PlQoiFpPluginFunc"

View file

@ -0,0 +1,47 @@
package PlQoi;
use strict;
use warnings;
sub GetDependencies
{
return ('emCore');
}
sub IsEssential
{
return 0;
}
sub GetFileHandlingrules
{
return ();
}
sub GetExtraBuildOptions
{
return ();
}
sub Build
{
shift;
my %options=@_;
system(
@{$options{'unicc_call'}},
"--math",
"--rtti",
"--exceptions",
"--bin-dir" , "bin",
"--lib-dir" , "lib",
"--obj-dir" , "obj",
"--inc-search-dir", "include",
"--link" , "emCore",
"--type" , "dynlib",
"--name" , "PlQoi",
"src/PlQoi.cpp"
)==0 or return 0;
return 1;
}

View file

@ -0,0 +1,273 @@
#include <emCore/emFpPlugin.h>
#include <emCore/emImageFile.h>
/*
QOI Utilities
Copyright (c) 2021, Dominic Szablewski - https://phoboslab.org
SPDX-License-Identifier: MIT
*/
#define QOI_OP_INDEX 0x00 /* 00xxxxxx */
#define QOI_OP_DIFF 0x40 /* 01xxxxxx */
#define QOI_OP_LUMA 0x80 /* 10xxxxxx */
#define QOI_OP_RUN 0xc0 /* 11xxxxxx */
#define QOI_OP_RGB 0xfe /* 11111110 */
#define QOI_OP_RGBA 0xff /* 11111111 */
#define QOI_MASK_2 0xc0 /* 11000000 */
#define QOI_COLOR_HASH(C) (C.GetRed()*3 + C.GetGreen()*5 + C.GetBlue()*7 + C.GetAlpha()*11)
#define QOI_MAGIC \
(((unsigned int)'q') << 24 | ((unsigned int)'o') << 16 | \
((unsigned int)'i') << 8 | ((unsigned int)'f'))
#define QOI_HEADER_SIZE 14
static unsigned int qoi_read_32(const unsigned char *bytes, int *p) {
unsigned int a = bytes[(*p)++];
unsigned int b = bytes[(*p)++];
unsigned int c = bytes[(*p)++];
unsigned int d = bytes[(*p)++];
return a << 24 | b << 16 | c << 8 | d;
}
class PlQoiImageFileModel : public emImageFileModel
{
public:
static emRef<PlQoiImageFileModel> Acquire(
emContext & context, const emString & name, bool common=true
);
protected:
PlQoiImageFileModel(emContext & context, const emString & name);
virtual ~PlQoiImageFileModel();
virtual void TryStartLoading();
virtual bool TryContinueLoading();
virtual void QuitLoading();
virtual void TryStartSaving();
virtual bool TryContinueSaving();
virtual void QuitSaving();
virtual emUInt64 CalcMemoryNeed();
virtual double CalcFileProgress();
private:
struct LoadingState;
LoadingState * L = NULL;
};
struct PlQoiImageFileModel::LoadingState {
FILE * file;
unsigned int width, height, channels;
size_t file_len;
};
emRef<PlQoiImageFileModel> PlQoiImageFileModel::Acquire(
emContext & context, const emString & name, bool common
)
{
EM_IMPL_ACQUIRE(PlQoiImageFileModel, context, name, common)
}
PlQoiImageFileModel::PlQoiImageFileModel(
emContext & context, const emString & name
)
: emImageFileModel(context, name)
{
}
PlQoiImageFileModel::~PlQoiImageFileModel()
{
PlQoiImageFileModel::QuitLoading();
PlQoiImageFileModel::QuitSaving();
}
void PlQoiImageFileModel::TryStartLoading()
{
unsigned char header[QOI_HEADER_SIZE];
unsigned int header_magic, colorspace;
int pos = 0;
L = new LoadingState;
memset(L, 0, sizeof(LoadingState));
L->file = fopen(GetFilePath(),"rb");
if (!L->file) throw emException("%s",emGetErrorText(errno).Get());
if (fread(header, 1, sizeof(header), L->file) != sizeof(header)) {
if (ferror(L->file)) {
throw emException("%s",emGetErrorText(errno).Get());
}
else {
throw emException("QOI header not found");
}
}
header_magic = qoi_read_32(header, &pos);
L->width = qoi_read_32(header, &pos);
L->height = qoi_read_32(header, &pos);
L->channels = header[pos++];
colorspace = header[pos++];
if (
L->width == 0 || L->height == 0 ||
L->channels < 3 || L->channels > 4 ||
colorspace > 1 ||
header_magic != QOI_MAGIC
) {
throw emException("QOI header not valid");
}
fseek(L->file, 0, SEEK_END);
L->file_len = ftell(L->file);
if (L->file_len <= QOI_HEADER_SIZE || fseek(L->file, 0, SEEK_SET) != 0) {
throw emException("QOI data incomplete");
}
FileFormatInfo = "QOI ";
FileFormatInfo += (
colorspace ? "all channels linear" : "sRGB with linear alpha"
);
Signal(ChangeSignal);
}
bool PlQoiImageFileModel::TryContinueLoading()
{
emArray<unsigned char> data;
emColor index[64];
emColor px { 0, 0, 0, 255 };
int pos = QOI_HEADER_SIZE;
int run = 0;
if (!Image.GetHeight()) {
Image.Setup(L->width, L->height, L->channels);
}
data.SetCount(L->file_len);
if (fread(data.GetWritable(), 1, L->file_len, L->file) < L->file_len) {
if (ferror(L->file)) {
throw emException("%s",emGetErrorText(errno).Get());
}
else {
throw emException("QOI data incomplete");
}
}
memset(index, 0, sizeof(index));
for (int px_y = 0; px_y < L->height; px_y++) {
for (int px_x = 0; px_x < L->width; px_x++) {
if (run > 0) {
run--;
} else if (pos < data.GetCount()) {
int b1 = data.Get(pos++);
if (b1 == QOI_OP_RGB) {
px.SetRed( data.Get(pos++));
px.SetGreen( data.Get(pos++));
px.SetBlue( data.Get(pos++));
} else if (b1 == QOI_OP_RGBA) {
px.SetRed( data.Get(pos++));
px.SetGreen( data.Get(pos++));
px.SetBlue( data.Get(pos++));
px.SetAlpha( data.Get(pos++));
} else if ((b1 & QOI_MASK_2) == QOI_OP_INDEX) {
px = index[b1];
} else if ((b1 & QOI_MASK_2) == QOI_OP_DIFF) {
px.SetRed(
px.GetRed() + ((b1 >> 4) & 0x03) - 2);
px.SetGreen(
px.GetGreen() + ((b1 >> 2) & 0x03) - 2);
px.SetBlue(
px.GetBlue() + ( b1 & 0x03) - 2);
} else if ((b1 & QOI_MASK_2) == QOI_OP_LUMA) {
int b2 = data.Get(pos++);
int vg = (b1 & 0x3f) - 32;
px.SetRed(
px.GetRed() + vg - 8 + ((b2 >> 4) & 0x0f));
px.SetGreen(
px.GetGreen() + vg);
px.SetBlue(
px.GetBlue() + vg - 8 + (b2 & 0x0f));
} else if ((b1 & QOI_MASK_2) == QOI_OP_RUN) {
run = (b1 & 0x3f);
}
index[QOI_COLOR_HASH(px) % 64] = px;
}
Image.SetPixel(px_x, px_y, px);
}
}
Signal(ChangeSignal);
return true;
}
void PlQoiImageFileModel::QuitLoading()
{
if (L) {
if (L->file) fclose(L->file);
delete L;
L = NULL;
}
}
void PlQoiImageFileModel::TryStartSaving()
{
throw emException("PlQoiImageFileModel: Saving not implemented.");
}
bool PlQoiImageFileModel::TryContinueSaving()
{
return false;
}
void PlQoiImageFileModel::QuitSaving()
{
}
emUInt64 PlQoiImageFileModel::CalcMemoryNeed()
{
return
(emUInt64)L->width * L->height * L->channels + L->file_len;
}
double PlQoiImageFileModel::CalcFileProgress()
{
return 0.0;
}
extern "C" {
emPanel * PlQoiFpPluginFunc(
emPanel::ParentArg parent, const emString & name,
const emString & path, emFpPlugin * plugin,
emString * errorBuf
)
{
if (plugin->Properties.GetCount()) {
*errorBuf="PlQoiFpPlugin: No properties allowed.";
return NULL;
}
return new emImageFilePanel(
parent, name,
PlQoiImageFileModel::Acquire(
parent.GetRootContext(), path
)
);
}
}

View file

@ -0,0 +1,18 @@
{ depot, pkgs, ... }:
let
em = depot.tools.eaglemode;
emSrc = with pkgs; srcOnly eaglemode;
in
(em.buildPlugin {
name = "yatracker";
version = "canon";
src = ./.;
target = "PlYaTracker";
}).overrideAttrs (_: {
postInstall = ''
mkdir -p $out/icons
${pkgs.imagemagick}/bin/convert $src/logo.webp $out/icons/yandex-tracker.tga
'';
})

View file

@ -0,0 +1,6 @@
#%rec:emFpPlugin%#
FileTypes = { ".YaTracker" }
Priority = 1.0
Library = "PlYaTracker"
Function = "PlYaTrackerPluginFunc"

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -0,0 +1,47 @@
package PlYaTracker;
use strict;
use warnings;
sub GetDependencies
{
return ('emCore');
}
sub IsEssential
{
return 0;
}
sub GetFileHandlingRules
{
return ();
}
sub GetExtraBuildOptions
{
return ();
}
sub Build
{
shift;
my %options=@_;
system(
@{$options{'unicc_call'}},
"--math",
"--rtti",
"--exceptions",
"--bin-dir" , "bin",
"--lib-dir" , "lib",
"--obj-dir" , "obj",
"--inc-search-dir", "include",
"--link" , "emCore",
"--type" , "dynlib",
"--name" , "PlYaTracker",
"src/PlYaTracker/PlYaTracker.cpp"
)==0 or return 0;
return 1;
}

View file

@ -0,0 +1,58 @@
#include <emCore/emFilePanel.h>
#include <emCore/emFpPlugin.h>
#include <emCore/emRecFileModel.h>
#include <emCore/emToolkit.h>
class PlYaTrackerConfig final : public emRecFileModel, public emStructRec {
public:
static emRef<PlYaTrackerConfig> Acquire(emContext& context,
const emString& name,
bool common = true);
virtual const char* GetFormatName() const;
emStringRec URL;
emStringRec Token;
protected:
PlYaTrackerConfig(emContext& context, const emString& name);
};
emRef<PlYaTrackerConfig> PlYaTrackerConfig::Acquire(emContext& context,
const emString& name,
bool common) {
EM_IMPL_ACQUIRE(PlYaTrackerConfig, context, name, common)
}
const char* PlYaTrackerConfig::GetFormatName() const { return "PlYaTracker"; }
PlYaTrackerConfig::PlYaTrackerConfig(emContext& context, const emString& name)
: emRecFileModel(context, name),
emStructRec(),
URL(this, "URL"),
Token(this, "Token") {
PostConstruct(*this);
}
class PlYaTrackerFilePanel : public emFilePanel {
public:
PlYaTrackerFilePanel(ParentArg parent, const emString& name,
emRef<PlYaTrackerConfig> config);
private:
emRef<PlYaTrackerConfig> Config;
};
PlYaTrackerFilePanel::PlYaTrackerFilePanel(ParentArg parent,
const emString& name,
emRef<PlYaTrackerConfig> config)
: emFilePanel(parent, name, config), Config(config) {}
extern "C" {
emPanel* PlYaTrackerPluginFunc(emPanel::ParentArg parent, const emString& name,
const emString& path, emFpPlugin* plugin,
emString* errorBuf) {
return new PlYaTrackerFilePanel(
parent, name, PlYaTrackerConfig::Acquire(parent.GetRootContext(), path));
}
}

156
tools/eaglemode/wrapper.go Normal file
View file

@ -0,0 +1,156 @@
// Eagle Mode configuration wrapper that recreates the required directory
// structure for Eagle Mode based on the output of depot.tools.eaglemode.etcDir
//
// This will replace *all* symlinks in the Eagle Mode configuration directory,
// but it will not touch actual files. Missing folders will be created.
package main
import (
"flag"
"fmt"
"io/fs"
"log"
"os"
"os/user"
"path"
"path/filepath"
"strings"
)
func configDir() (string, error) {
v := os.Getenv("EM_USER_CONFIG_DIR")
if v != "" {
return v, nil
}
usr, err := user.Current()
if err != nil {
return "", fmt.Errorf("failed to get current user: %w", err)
}
return path.Join(usr.HomeDir, ".eaglemode"), nil
}
// cleanupConfig removes *all* existing symlinks in the configuration which do
// not point into the right Nix store path.
func cleanupConfig(conf string, dir string) (map[string]bool, error) {
// In case of first launch, we might have to create the directory.
_ = os.MkdirAll(dir, 0755)
c := 0
currentFiles := map[string]bool{}
walker := func(p string, d fs.DirEntry, e error) error {
if e != nil {
return fmt.Errorf("could not walk %s in config directory: %w", p, e)
}
if d.Type()&fs.ModeSymlink != 0 {
target, err := os.Readlink(p)
if err != nil {
return fmt.Errorf("could not read link for %s: %w", p, err)
}
if !strings.HasPrefix(target, conf) {
err = os.Remove(p)
c++
if err != nil {
return fmt.Errorf("could not remove stale link %q: %w", p, err)
}
log.Printf("removed stale symlink %q", p)
} else {
currentFiles[p] = false
}
}
if d.Type().IsRegular() {
currentFiles[p] = true
}
return nil
}
err := filepath.WalkDir(dir, walker)
if err != nil {
return nil, err
}
if c > 0 {
log.Printf("removed %v stale symlinks", c)
}
return currentFiles, nil
}
// linkConfig traverses the given Eagle Mode configuration and links everything
// to the expected location in the user's configuration directory.
//
// If the user placed actual files in the configuration directory at paths that
// would be overwritten, they will not be touched.
func linkConfig(conf string, dir string, existing map[string]bool) error {
walker := func(p string, d fs.DirEntry, e error) error {
if e != nil {
return fmt.Errorf("could not walk %s in config directory: %w", p, e)
}
target := path.Join(dir, strings.TrimPrefix(p, conf))
if d.Type().IsDir() {
err := os.MkdirAll(target, 0755)
if err != nil {
return fmt.Errorf("could not create directory %q: %w", target, err)
}
return nil
}
if shadow, exists := existing[target]; exists {
if shadow {
log.Printf("WARN: file %q already exists and shadows a file from configuration", target)
}
return nil
}
err := os.Symlink(p, target)
if err != nil {
return fmt.Errorf("failed to link %q: %w", target, err)
}
return nil
}
return filepath.WalkDir(conf, walker)
}
func main() {
emConfig := flag.String("em-config", "", "path to em-config dir")
flag.Parse()
log.Println("verifying current Eagle Mode configuration")
if *emConfig == "" {
log.Fatalf("Eagle Mode configuration must be given")
}
if !strings.HasPrefix(*emConfig, "/nix/store/") {
log.Fatalf("Eagle Mode configuration must be in Nix store")
}
dir, err := configDir()
if err != nil {
log.Fatalf("could not determine Eagle Mode config dir: %v", err)
}
currentFiles, err := cleanupConfig(*emConfig, dir)
if err != nil {
log.Fatalf("failed to remove stale symlinks: %v", err)
}
err = linkConfig(*emConfig, dir, currentFiles)
if err != nil {
log.Fatalf("failed to link new configuration: %v", err)
}
log.Println("Eagle Mode configuration updated")
}

1409
tvix/Cargo.lock generated

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -27,6 +27,8 @@ members = [
"glue",
"nar-bridge",
"nix-compat",
"nix-compat-derive",
"nix-compat-derive-tests",
"serde",
"store",
"tracing",
@ -37,6 +39,128 @@ members = [
# https://github.com/rust-lang/rust-clippy/issues/12281
blocks_in_conditions = "allow"
[workspace.dependencies]
anyhow = "1.0.86"
async-compression = "0.4.12"
async-process = "2.2.4"
async-stream = "0.3.5"
async-tempfile = "0.4.0"
axum = "0.7.5"
# https://github.com/liufuyang/bigtable_rs/pull/86
bigtable_rs = { git = "https://github.com/liufuyang/bigtable_rs", rev = "1818355a5373a5bc2c84287e3a4e3807154ac8ef" }
bitflags = "2.6.0"
blake3 = "1.5.4"
bstr = "1.10.0"
bytes = "1.7.1"
clap = "4.5.16"
codemap = "0.1.3"
codemap-diagnostic = "0.1.2"
count-write = "0.1.0"
criterion = "0.5"
data-encoding = "2.6.0"
digest = "0.10.7"
dirs = "4.0.0"
ed25519 = "2.2.3"
ed25519-dalek = "2.1.1"
enum-primitive-derive = "0.3.0"
erased-serde = "0.4.5"
expect-test = "1.5.0"
fastcdc = "3.1.0"
fuse-backend-rs = "0.11.0"
futures = "0.3.30"
genawaiter = { version = "0.99.1", default-features = false }
glob = "0.3.1"
hex-literal = "0.4.1"
http = "1.1.0"
hyper-util = "0.1.7"
indicatif = "0.17.8"
itertools = "0.12.1"
lazy_static = "1.5.0"
lexical-core = "0.8.5"
libc = "0.2.158"
lru = "0.12.4"
magic = "0.16.2"
md-5 = "0.10.6"
mimalloc = "0.1.43"
nix = "0.27.1"
nohash-hasher = "0.2.0"
nom = "7.1.3"
num-traits = "0.2.19"
object_store = "0.10.2"
opentelemetry = "0.24.0"
opentelemetry-http = "0.13.0"
opentelemetry-otlp = "0.17.0"
opentelemetry_sdk = "0.24.1"
os_str_bytes = "6.6"
parking_lot = "0.12.3"
path-clean = "0.1"
petgraph = "0.6.5"
pin-project = "1.1"
pin-project-lite = "0.2.14"
pretty_assertions = "1.4.0"
proc-macro2 = "1.0.86"
proptest = { version = "1.5.0", default-features = false }
prost = "0.13.1"
prost-build = "0.13.1"
quote = "1.0.37"
redb = "2.1.2"
regex = "1.10.6"
reqwest = { version = "0.12.7", default-features = false }
reqwest-middleware = "0.3.3"
reqwest-tracing = { version = "0.5.3", default-features = false }
rnix = "0.11.0"
rowan = "*"
rstest = "0.19.0"
rstest_reuse = "0.6.0"
rustc-hash = "2.0.0"
rustyline = "10.1.1"
serde = "1.0.209"
serde_json = "1.0"
serde_qs = "0.12.0"
serde_tagged = "0.3.0"
serde_with = "3.9.0"
sha1 = "0.10.6"
sha2 = "0.10.8"
sled = "0.34.7"
smol_str = "0.2.2"
tabwriter = "1.4"
tempfile = "3.12.0"
test-strategy = "0.2.1"
thiserror = "1.0.63"
threadpool = "1.8.1"
tokio = "1.39.3"
tokio-listener = "0.4.3"
tokio-retry = "0.3.0"
tokio-stream = "0.1.15"
tokio-tar = "0.3.1"
tokio-test = "0.4.4"
tokio-util = "0.7.11"
tonic = "0.12.2"
tonic-build = "0.12.2"
tonic-health = { version = "0.12.2", default-features = false }
tonic-reflection = "0.12.2"
tower = "0.4.13"
tower-http = "0.5.2"
tracing = "0.1.40"
tracing-indicatif = "0.3.6"
tracing-opentelemetry = "0.25.0"
tracing-subscriber = "0.3.18"
tracing-tracy = "0.11.2"
trybuild = "1.0.99"
url = "2.5.2"
vhost = "0.6"
vhost-user-backend = "0.8"
virtio-bindings = "0.2.2"
virtio-queue = "0.7"
vm-memory = "0.10"
vmm-sys-util = "0.11"
vu128 = "1.1.0"
walkdir = "2.5.0"
# https://github.com/jneem/wu-manber/pull/1
wu-manber = { git = "https://github.com/tvlfyi/wu-manber.git" }
xattr = "1.3.1"
zstd = "0.13.2"
# Add a profile to all targets that enables release optimisations, but
# retains debug symbols. This is great for use with
# benchmarking/profiling tools.

View file

@ -61,7 +61,7 @@ This folder contains the following components:
* `//tvix/castore` - subtree storage/transfer in a content-addressed fashion
* `//tvix/cli` - preliminary REPL & CLI implementation for Tvix
* `//tvix/eval` - an implementation of the Nix programming language
* `//tvix/nar-bridge-go` - a HTTP webserver providing a Nix HTTP Binary Cache interface in front of a tvix-store
* `//tvix/nar-bridge` - a HTTP webserver providing a Nix HTTP Binary Cache interface in front of a tvix-store
* `//tvix/nix-compat` - a Rust library for compatibility with C++ Nix, features like encodings and hashing schemes and formats
* `//tvix/serde` - a Rust library for using the Nix language for app configuration
* `//tvix/store` - a "filesystem" linking Nix store paths and metadata with the content-addressed layer

View file

@ -31,23 +31,37 @@ the `tvix` directory:
export PATH=$PATH:$PWD/target/release-with-debug
```
Secondly, configure tvix to use the local backend:
Now, spin up tvix-daemon, connecting to some (local) backends:
```
export BLOB_SERVICE_ADDR=sled://$PWD/blobs.sled
tvix-store --otlp=false daemon \
--blob-service-addr=objectstore+file://$PWD/blobs \
--directory-service-addr=sled://$PWD/directories.sled \
--path-info-service-addr=sled://$PWD/pathinfo.sled &
```
Copy some data into tvix-store (we use `nar-bridge` for this for now):
```
mg run //tvix:nar-bridge -- --otlp=false &
rm -Rf ~/.cache/nix; nix copy --to http://localhost:9000\?compression\=none $(mg build //third_party/nixpkgs:hello)
pkill nar-bridge
```
By default, the `tvix-store virtiofs` command used in the `runVM` script
connects to a running `tvix-store daemon` via gRPC - in which case you want to
keep `tvix-store daemon` running.
In case you want to have `tvix-store virtiofs` open the stores directly, kill
`tvix-store daemon` too, and export the addresses from above:
```
pkill tvix-store
export BLOB_SERVICE_ADDR=objectstore+file://$PWD/blobs
export DIRECTORY_SERVICE_ADDR=sled://$PWD/directories.sled
export PATH_INFO_SERVICE_ADDR=sled://$PWD/pathinfo.sled
```
Potentially copy some data into tvix-store (via nar-bridge):
```
mg run //tvix:store -- daemon &
$(mg build //tvix:nar-bridge-go)/bin/nar-bridge-http &
rm -Rf ~/.cache/nix; nix copy --to http://localhost:9000\?compression\=none $(mg build //third_party/nixpkgs:hello)
pkill nar-bridge-http; pkill tvix-store
```
#### Interactive shell
Run the VM like this:
@ -100,9 +114,12 @@ Hello, world!
[ 0.299422] reboot: Power down
```
#### Execute a NixOS system closure
It's also possible to invoke a system closure. To do this, tvix-init honors the
init= cmdline option, and will switch_root to it.
#### Boot a NixOS system closure
It's also possible to boot a system closure. To do this, tvix-init honors the
init= cmdline option, and will `switch_root` to it.
Make sure to first copy that system closure into tvix-store,
using a similar `nix copy` comamnd as above.
```

View file

@ -1,13 +1,16 @@
{ depot, pkgs, ... }:
{ lib, pkgs, ... }:
rec {
# A binary that sets up /nix/store from virtiofs, lists all store paths, and
# powers off the machine.
tvix-init = depot.nix.buildGo.program {
tvix-init = pkgs.buildGoModule rec {
name = "tvix-init";
srcs = [
./tvix-init.go
];
src = lib.fileset.toSource {
root = ./.;
fileset = ./tvix-init.go;
};
vendorHash = null;
postPatch = "go mod init ${name}";
};
# A kernel with virtiofs support baked in

View file

@ -65,8 +65,8 @@ let
--otlp=false \
daemon -l $PWD/tvix-store.sock &
# Wait for the socket to be created.
while [ ! -e $PWD/tvix-store.sock ]; do sleep 1; done
# Wait for the service to report healthy.
timeout 22 sh -c "until ${pkgs.ip2unix}/bin/ip2unix -r out,path=$PWD/tvix-store.sock ${pkgs.grpc-health-check}/bin/grpc-health-check --address 127.0.0.1 --port 8080; do sleep 1; done"
# Export env vars so that subsequent tvix-store commands will talk to
# our tvix-store daemon over the unix socket.
@ -89,8 +89,8 @@ let
--otlp=false \
-l $PWD/nar-bridge.sock &
# Wait for the socket to be created.
while [ ! -e $PWD/nar-bridge.sock ]; do sleep 1; done
# Wait for nar-bridge to report healthy.
timeout 22 sh -c "until ${pkgs.curl}/bin/curl -s --unix-socket $PWD/nar-bridge.sock http:///nix-binary-cache; do sleep 1; done"
# Upload. We can't use nix copy --to http://…, as it wants access to the nix db.
# However, we can use mkBinaryCache to assemble .narinfo and .nar.xz to upload,
@ -119,14 +119,20 @@ let
grep "${assertVMOutput}" output.txt
'';
requiredSystemFeatures = [ "kvm" ];
# HACK: The boot tests are sometimes flaky, and we don't want them to
# periodically fail other build. Have Buildkite auto-retry them 2 times
# on failure.
# Logs for individual failures are still available, so it won't hinder
# flakiness debuggability.
meta.ci.buildkiteExtraStepArgs = {
retry.automatic = true;
};
} // lib.optionalAttrs (isClosure && !useNarBridge) {
__structuredAttrs = true;
exportReferencesGraph.closure = [ path ];
});
systemFor = sys: (depot.ops.nixos.nixosFor sys).system;
testSystem = systemFor ({ modulesPath, pkgs, ... }: {
testSystem = (pkgs.nixos {
# Set some options necessary to evaluate.
boot.loader.systemd-boot.enable = true;
# TODO: figure out how to disable this without causing eval to fail
@ -146,7 +152,10 @@ let
# Don't warn about stateVersion.
system.stateVersion = "24.05";
});
# Speed-up evaluation and building.
documentation.enable = lib.mkForce false;
}).config.system.build.toplevel;
in
depot.nix.readTree.drvTargets
@ -157,8 +166,8 @@ depot.nix.readTree.drvTargets
});
docs-persistent = (mkBootTest {
blobServiceAddr = "objectstore+file:///build/blobs";
directoryServiceAddr = "sled:///build/directories.sled";
pathInfoServiceAddr = "sled:///build/pathinfo.sled";
directoryServiceAddr = "redb:///build/directories.redb";
pathInfoServiceAddr = "redb:///build/pathinfo.redb";
path = ../../docs;
importPathName = "docs";
});
@ -171,6 +180,8 @@ depot.nix.readTree.drvTargets
closure-nixos = (mkBootTest {
blobServiceAddr = "objectstore+file:///build/blobs";
pathInfoServiceAddr = "redb:///build/pathinfo.redb";
directoryServiceAddr = "redb:///build/directories.redb";
path = testSystem;
isClosure = true;
vmCmdline = "init=${testSystem}/init panic=-1"; # reboot immediately on panic

View file

@ -3,7 +3,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc-gen-go v1.34.2
// protoc (unknown)
// source: tvix/build/protos/build.proto
@ -66,8 +66,8 @@ type BuildRequest struct {
// The list of all root nodes that should be visible in `inputs_dir` at the
// time of the build.
// As root nodes are content-addressed, no additional signatures are needed
// to substitute / make these available in the build environment.
// As all references are content-addressed, no additional signatures are
// needed to substitute / make these available in the build environment.
// Inputs MUST be sorted by their names.
Inputs []*castore_go.Node `protobuf:"bytes,1,rep,name=inputs,proto3" json:"inputs,omitempty"`
// The command (and its args) executed as the build script.
@ -560,7 +560,7 @@ func file_tvix_build_protos_build_proto_rawDescGZIP() []byte {
}
var file_tvix_build_protos_build_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_tvix_build_protos_build_proto_goTypes = []interface{}{
var file_tvix_build_protos_build_proto_goTypes = []any{
(*BuildRequest)(nil), // 0: tvix.build.v1.BuildRequest
(*Build)(nil), // 1: tvix.build.v1.Build
(*BuildRequest_EnvVar)(nil), // 2: tvix.build.v1.BuildRequest.EnvVar
@ -588,7 +588,7 @@ func file_tvix_build_protos_build_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_tvix_build_protos_build_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_tvix_build_protos_build_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*BuildRequest); i {
case 0:
return &v.state
@ -600,7 +600,7 @@ func file_tvix_build_protos_build_proto_init() {
return nil
}
}
file_tvix_build_protos_build_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_tvix_build_protos_build_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*Build); i {
case 0:
return &v.state
@ -612,7 +612,7 @@ func file_tvix_build_protos_build_proto_init() {
return nil
}
}
file_tvix_build_protos_build_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
file_tvix_build_protos_build_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*BuildRequest_EnvVar); i {
case 0:
return &v.state
@ -624,7 +624,7 @@ func file_tvix_build_protos_build_proto_init() {
return nil
}
}
file_tvix_build_protos_build_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
file_tvix_build_protos_build_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*BuildRequest_BuildConstraints); i {
case 0:
return &v.state
@ -636,7 +636,7 @@ func file_tvix_build_protos_build_proto_init() {
return nil
}
}
file_tvix_build_protos_build_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
file_tvix_build_protos_build_proto_msgTypes[4].Exporter = func(v any, i int) any {
switch v := v.(*BuildRequest_AdditionalFile); i {
case 0:
return &v.state

View file

@ -3,7 +3,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc-gen-go v1.34.2
// protoc (unknown)
// source: tvix/build/protos/rpc_build.proto
@ -40,7 +40,7 @@ var file_tvix_build_protos_rpc_build_proto_rawDesc = []byte{
0x69, 0x6c, 0x64, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var file_tvix_build_protos_rpc_build_proto_goTypes = []interface{}{
var file_tvix_build_protos_rpc_build_proto_goTypes = []any{
(*BuildRequest)(nil), // 0: tvix.build.v1.BuildRequest
(*Build)(nil), // 1: tvix.build.v1.Build
}

View file

@ -4,33 +4,31 @@ version = "0.1.0"
edition = "2021"
[dependencies]
bytes = "1.4.0"
clap = { version = "4.0", features = ["derive", "env"] }
itertools = "0.12.0"
prost = "0.13.1"
thiserror = "1.0.56"
tokio = { version = "1.32.0" }
tokio-listener = { version = "0.4.1", features = [ "tonic012" ] }
tonic = { version = "0.12.0", features = ["tls", "tls-roots"] }
bytes = { workspace = true }
clap = { workspace = true, features = ["derive", "env"] }
itertools = { workspace = true }
prost = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tokio-listener = { workspace = true, features = ["tonic012"] }
tonic = { workspace = true, features = ["tls", "tls-roots"] }
tvix-castore = { path = "../castore" }
tvix-tracing = { path = "../tracing" }
tracing = "0.1.40"
url = "2.4.0"
[dependencies.tonic-reflection]
optional = true
version = "0.12.0"
tracing = { workspace = true }
url = { workspace = true }
mimalloc = { workspace = true }
tonic-reflection = { workspace = true, optional = true }
[build-dependencies]
prost-build = "0.13.1"
tonic-build = "0.12.0"
prost-build = { workspace = true }
tonic-build = { workspace = true }
[features]
default = []
tonic-reflection = ["dep:tonic-reflection", "tvix-castore/tonic-reflection"]
[dev-dependencies]
rstest = "0.19.0"
rstest = { workspace = true }
[lints]
workspace = true

View file

@ -20,15 +20,15 @@ fn main() -> Result<()> {
.extern_path(".tvix.castore.v1", "::tvix_castore::proto")
.compile(
&[
"tvix/build/protos/build.proto",
"tvix/build/protos/rpc_build.proto",
"build/protos/build.proto",
"build/protos/rpc_build.proto",
],
// If we are in running `cargo build` manually, using `../..` works fine,
// but in case we run inside a nix build, we need to instead point PROTO_ROOT
// to a sparseTree containing that structure.
// to a custom tree containing that structure.
&[match std::env::var_os("PROTO_ROOT") {
Some(proto_root) => proto_root.to_str().unwrap().to_owned(),
None => "../..".to_string(),
None => "..".to_string(),
}],
)
}

View file

@ -4,8 +4,8 @@
runTests = true;
}).overrideAttrs (old: rec {
meta.ci.targets = lib.filter (x: lib.hasPrefix "with-features" x || x == "no-features") (lib.attrNames passthru);
passthru = depot.tvix.utils.mkFeaturePowerset {
passthru = old.passthru // (depot.tvix.utils.mkFeaturePowerset {
inherit (old) crateName;
features = [ "tonic-reflection" ];
};
});
})

View file

@ -5,7 +5,7 @@ syntax = "proto3";
package tvix.build.v1;
import "tvix/castore/protos/castore.proto";
import "castore/protos/castore.proto";
option go_package = "code.tvl.fyi/tvix/build-go;buildv1";
@ -47,8 +47,8 @@ option go_package = "code.tvl.fyi/tvix/build-go;buildv1";
message BuildRequest {
// The list of all root nodes that should be visible in `inputs_dir` at the
// time of the build.
// As root nodes are content-addressed, no additional signatures are needed
// to substitute / make these available in the build environment.
// As all references are content-addressed, no additional signatures are
// needed to substitute / make these available in the build environment.
// Inputs MUST be sorted by their names.
repeated tvix.castore.v1.Node inputs = 1;

View file

@ -1,17 +1,12 @@
{ depot, pkgs, ... }:
{ depot, pkgs, lib, ... }:
let
protos = depot.nix.sparseTree {
name = "build-protos";
root = depot.path.origSrc;
paths = [
protos = lib.sourceByRegex depot.path.origSrc [
"buf.yaml"
"buf.gen.yaml"
# We need to include castore.proto (only), as it's referred.
../../castore/protos/castore.proto
./build.proto
./rpc_build.proto
../../../buf.yaml
../../../buf.gen.yaml
"^tvix(/castore(/protos(/castore\.proto)?)?)?$"
"^tvix(/build(/protos(/.*\.proto)?)?)?$"
];
};
in
depot.nix.readTree.drvTargets {
inherit protos;

View file

@ -4,7 +4,7 @@ syntax = "proto3";
package tvix.build.v1;
import "tvix/build/protos/build.proto";
import "build/protos/build.proto";
option go_package = "code.tvl.fyi/tvix/build-go;buildv1";

View file

@ -17,6 +17,11 @@ use tvix_build::proto::FILE_DESCRIPTOR_SET;
#[cfg(feature = "tonic-reflection")]
use tvix_castore::proto::FILE_DESCRIPTOR_SET as CASTORE_FILE_DESCRIPTOR_SET;
use mimalloc::MiMalloc;
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
struct Cli {
@ -85,11 +90,18 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
#[cfg(feature = "tonic-reflection")]
{
let reflection_svc = tonic_reflection::server::Builder::configure()
router = router.add_service(
tonic_reflection::server::Builder::configure()
.register_encoded_file_descriptor_set(CASTORE_FILE_DESCRIPTOR_SET)
.register_encoded_file_descriptor_set(FILE_DESCRIPTOR_SET)
.build()?;
router = router.add_service(reflection_svc);
.build_v1alpha()?,
);
router = router.add_service(
tonic_reflection::server::Builder::configure()
.register_encoded_file_descriptor_set(CASTORE_FILE_DESCRIPTOR_SET)
.register_encoded_file_descriptor_set(FILE_DESCRIPTOR_SET)
.build_v1()?,
);
}
info!(listen_address=%listen_address, "listening");

View file

@ -1,7 +1,7 @@
use std::path::{Path, PathBuf};
use itertools::Itertools;
use tvix_castore::proto::{NamedNode, ValidateNodeError};
use tvix_castore::DirectoryError;
mod grpc_buildservice_wrapper;
@ -19,7 +19,7 @@ pub const FILE_DESCRIPTOR_SET: &[u8] = tonic::include_file_descriptor_set!("tvix
#[derive(Debug, thiserror::Error)]
pub enum ValidateBuildRequestError {
#[error("invalid input node at position {0}: {1}")]
InvalidInputNode(usize, ValidateNodeError),
InvalidInputNode(usize, DirectoryError),
#[error("input nodes are not sorted by name")]
InputNodesNotSorted,
@ -123,20 +123,21 @@ impl BuildRequest {
/// and all restrictions around paths themselves (relative, clean, …) need
// to be fulfilled.
pub fn validate(&self) -> Result<(), ValidateBuildRequestError> {
// validate all input nodes
for (i, n) in self.inputs.iter().enumerate() {
// ensure the input node itself is valid
n.validate()
.map_err(|e| ValidateBuildRequestError::InvalidInputNode(i, e))?;
}
// validate names. Make sure they're sorted
// now we can look at the names, and make sure they're sorted.
if !is_sorted(
self.inputs
.iter()
.map(|e| e.node.as_ref().unwrap().get_name()),
) {
Err(ValidateBuildRequestError::InputNodesNotSorted)?
let mut last_name: bytes::Bytes = "".into();
for (i, node) in self.inputs.iter().enumerate() {
// TODO(flokli): store result somewhere
let (name, _node) = node
.clone()
.into_name_and_node()
.map_err(|e| ValidateBuildRequestError::InvalidInputNode(i, e))?;
if name.as_ref() <= last_name.as_ref() {
return Err(ValidateBuildRequestError::InputNodesNotSorted);
} else {
last_name = name.into()
}
}
// validate working_dir

View file

@ -3,7 +3,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc-gen-go v1.34.2
// protoc (unknown)
// source: tvix/castore/protos/castore.proto
@ -466,7 +466,7 @@ func file_tvix_castore_protos_castore_proto_rawDescGZIP() []byte {
}
var file_tvix_castore_protos_castore_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_tvix_castore_protos_castore_proto_goTypes = []interface{}{
var file_tvix_castore_protos_castore_proto_goTypes = []any{
(*Directory)(nil), // 0: tvix.castore.v1.Directory
(*DirectoryNode)(nil), // 1: tvix.castore.v1.DirectoryNode
(*FileNode)(nil), // 2: tvix.castore.v1.FileNode
@ -493,7 +493,7 @@ func file_tvix_castore_protos_castore_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_tvix_castore_protos_castore_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_tvix_castore_protos_castore_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*Directory); i {
case 0:
return &v.state
@ -505,7 +505,7 @@ func file_tvix_castore_protos_castore_proto_init() {
return nil
}
}
file_tvix_castore_protos_castore_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_tvix_castore_protos_castore_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*DirectoryNode); i {
case 0:
return &v.state
@ -517,7 +517,7 @@ func file_tvix_castore_protos_castore_proto_init() {
return nil
}
}
file_tvix_castore_protos_castore_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
file_tvix_castore_protos_castore_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*FileNode); i {
case 0:
return &v.state
@ -529,7 +529,7 @@ func file_tvix_castore_protos_castore_proto_init() {
return nil
}
}
file_tvix_castore_protos_castore_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
file_tvix_castore_protos_castore_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*SymlinkNode); i {
case 0:
return &v.state
@ -541,7 +541,7 @@ func file_tvix_castore_protos_castore_proto_init() {
return nil
}
}
file_tvix_castore_protos_castore_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
file_tvix_castore_protos_castore_proto_msgTypes[4].Exporter = func(v any, i int) any {
switch v := v.(*Node); i {
case 0:
return &v.state
@ -554,7 +554,7 @@ func file_tvix_castore_protos_castore_proto_init() {
}
}
}
file_tvix_castore_protos_castore_proto_msgTypes[4].OneofWrappers = []interface{}{
file_tvix_castore_protos_castore_proto_msgTypes[4].OneofWrappers = []any{
(*Node_Directory)(nil),
(*Node_File)(nil),
(*Node_Symlink)(nil),

View file

@ -3,7 +3,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc-gen-go v1.34.2
// protoc (unknown)
// source: tvix/castore/protos/rpc_blobstore.proto
@ -415,7 +415,7 @@ func file_tvix_castore_protos_rpc_blobstore_proto_rawDescGZIP() []byte {
}
var file_tvix_castore_protos_rpc_blobstore_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_tvix_castore_protos_rpc_blobstore_proto_goTypes = []interface{}{
var file_tvix_castore_protos_rpc_blobstore_proto_goTypes = []any{
(*StatBlobRequest)(nil), // 0: tvix.castore.v1.StatBlobRequest
(*StatBlobResponse)(nil), // 1: tvix.castore.v1.StatBlobResponse
(*ReadBlobRequest)(nil), // 2: tvix.castore.v1.ReadBlobRequest
@ -444,7 +444,7 @@ func file_tvix_castore_protos_rpc_blobstore_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_tvix_castore_protos_rpc_blobstore_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_tvix_castore_protos_rpc_blobstore_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*StatBlobRequest); i {
case 0:
return &v.state
@ -456,7 +456,7 @@ func file_tvix_castore_protos_rpc_blobstore_proto_init() {
return nil
}
}
file_tvix_castore_protos_rpc_blobstore_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_tvix_castore_protos_rpc_blobstore_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*StatBlobResponse); i {
case 0:
return &v.state
@ -468,7 +468,7 @@ func file_tvix_castore_protos_rpc_blobstore_proto_init() {
return nil
}
}
file_tvix_castore_protos_rpc_blobstore_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
file_tvix_castore_protos_rpc_blobstore_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*ReadBlobRequest); i {
case 0:
return &v.state
@ -480,7 +480,7 @@ func file_tvix_castore_protos_rpc_blobstore_proto_init() {
return nil
}
}
file_tvix_castore_protos_rpc_blobstore_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
file_tvix_castore_protos_rpc_blobstore_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*BlobChunk); i {
case 0:
return &v.state
@ -492,7 +492,7 @@ func file_tvix_castore_protos_rpc_blobstore_proto_init() {
return nil
}
}
file_tvix_castore_protos_rpc_blobstore_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
file_tvix_castore_protos_rpc_blobstore_proto_msgTypes[4].Exporter = func(v any, i int) any {
switch v := v.(*PutBlobResponse); i {
case 0:
return &v.state
@ -504,7 +504,7 @@ func file_tvix_castore_protos_rpc_blobstore_proto_init() {
return nil
}
}
file_tvix_castore_protos_rpc_blobstore_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
file_tvix_castore_protos_rpc_blobstore_proto_msgTypes[5].Exporter = func(v any, i int) any {
switch v := v.(*StatBlobResponse_ChunkMeta); i {
case 0:
return &v.state

View file

@ -3,7 +3,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc-gen-go v1.34.2
// protoc (unknown)
// source: tvix/castore/protos/rpc_directory.proto
@ -199,7 +199,7 @@ func file_tvix_castore_protos_rpc_directory_proto_rawDescGZIP() []byte {
}
var file_tvix_castore_protos_rpc_directory_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_tvix_castore_protos_rpc_directory_proto_goTypes = []interface{}{
var file_tvix_castore_protos_rpc_directory_proto_goTypes = []any{
(*GetDirectoryRequest)(nil), // 0: tvix.castore.v1.GetDirectoryRequest
(*PutDirectoryResponse)(nil), // 1: tvix.castore.v1.PutDirectoryResponse
(*Directory)(nil), // 2: tvix.castore.v1.Directory
@ -223,7 +223,7 @@ func file_tvix_castore_protos_rpc_directory_proto_init() {
}
file_tvix_castore_protos_castore_proto_init()
if !protoimpl.UnsafeEnabled {
file_tvix_castore_protos_rpc_directory_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_tvix_castore_protos_rpc_directory_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*GetDirectoryRequest); i {
case 0:
return &v.state
@ -235,7 +235,7 @@ func file_tvix_castore_protos_rpc_directory_proto_init() {
return nil
}
}
file_tvix_castore_protos_rpc_directory_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_tvix_castore_protos_rpc_directory_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*PutDirectoryResponse); i {
case 0:
return &v.state
@ -248,7 +248,7 @@ func file_tvix_castore_protos_rpc_directory_proto_init() {
}
}
}
file_tvix_castore_protos_rpc_directory_proto_msgTypes[0].OneofWrappers = []interface{}{
file_tvix_castore_protos_rpc_directory_proto_msgTypes[0].OneofWrappers = []any{
(*GetDirectoryRequest_Digest)(nil),
}
type x struct{}

View file

@ -4,100 +4,68 @@ version = "0.1.0"
edition = "2021"
[dependencies]
async-compression = { version = "0.4.9", features = ["tokio", "zstd"]}
async-stream = "0.3.5"
async-tempfile = "0.4.0"
blake3 = { version = "1.3.1", features = ["rayon", "std", "traits-preview"] }
bstr = "1.6.0"
bytes = "1.4.0"
data-encoding = "2.6.0"
digest = "0.10.7"
fastcdc = { version = "3.1.0", features = ["tokio"] }
futures = "0.3.30"
lazy_static = "1.4.0"
object_store = { version = "0.10.1", features = ["http"] }
parking_lot = "0.12.1"
pin-project-lite = "0.2.13"
prost = "0.13.1"
sled = { version = "0.34.7" }
thiserror = "1.0.38"
tokio-stream = { version = "0.1.14", features = ["fs", "net"] }
tokio-util = { version = "0.7.9", features = ["io", "io-util", "codec"] }
tokio-tar = "0.3.1"
tokio = { version = "1.32.0", features = ["fs", "macros", "net", "rt", "rt-multi-thread", "signal"] }
tonic = "0.12.0"
tower = "0.4.13"
tracing = "0.1.37"
tracing-indicatif = "0.3.6"
async-compression = { workspace = true, features = ["tokio", "zstd"] }
async-stream = { workspace = true }
async-tempfile = { workspace = true }
blake3 = { workspace = true, features = ["rayon", "std", "traits-preview"] }
bstr = { workspace = true }
bytes = { workspace = true }
data-encoding = { workspace = true }
digest = { workspace = true }
fastcdc = { workspace = true, features = ["tokio"] }
futures = { workspace = true }
lazy_static = { workspace = true }
object_store = { workspace = true, features = ["http"] }
parking_lot = { workspace = true }
pin-project-lite = { workspace = true }
prost = { workspace = true }
sled = { workspace = true }
thiserror = { workspace = true }
tokio-stream = { workspace = true, features = ["fs", "net"] }
tokio-util = { workspace = true, features = ["io", "io-util", "codec"] }
tokio-tar = { workspace = true }
tokio = { workspace = true, features = ["fs", "macros", "net", "rt", "rt-multi-thread", "signal"] }
tonic = { workspace = true }
tower = { workspace = true }
tracing = { workspace = true }
tracing-indicatif = { workspace = true }
tvix-tracing = { path = "../tracing", features = ["tonic"] }
url = "2.4.0"
walkdir = "2.4.0"
zstd = "0.13.0"
serde = { version = "1.0.197", features = [ "derive" ] }
serde_with = "3.7.0"
serde_qs = "0.12.0"
petgraph = "0.6.4"
erased-serde = "0.4.5"
serde_tagged = "0.3.0"
hyper-util = "0.1.6"
[dependencies.bigtable_rs]
optional = true
version = "0.2.10"
[dependencies.fuse-backend-rs]
optional = true
version = "0.11.0"
[dependencies.libc]
optional = true
version = "0.2.144"
[dependencies.threadpool]
version = "1.8.1"
optional = true
[dependencies.tonic-reflection]
optional = true
version = "0.12.0"
[dependencies.vhost]
optional = true
version = "0.6"
[dependencies.vhost-user-backend]
optional = true
version = "0.8"
[dependencies.virtio-queue]
optional = true
version = "0.7"
[dependencies.vm-memory]
optional = true
version = "0.10"
[dependencies.vmm-sys-util]
optional = true
version = "0.11"
[dependencies.virtio-bindings]
optional = true
version = "0.2.1"
url = { workspace = true }
walkdir = { workspace = true }
zstd = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_with = { workspace = true }
serde_qs = { workspace = true }
petgraph = { workspace = true }
erased-serde = { workspace = true }
serde_tagged = { workspace = true }
hyper-util = { workspace = true }
redb = { workspace = true }
bigtable_rs = { workspace = true, optional = true }
fuse-backend-rs = { workspace = true, optional = true }
libc = { workspace = true, optional = true }
threadpool = { workspace = true, optional = true }
tonic-reflection = { workspace = true, optional = true }
vhost = { workspace = true, optional = true }
vhost-user-backend = { workspace = true, optional = true }
virtio-queue = { workspace = true, optional = true }
vm-memory = { workspace = true, optional = true }
vmm-sys-util = { workspace = true, optional = true }
virtio-bindings = { workspace = true, optional = true }
[build-dependencies]
prost-build = "0.13.1"
tonic-build = "0.12.0"
prost-build = { workspace = true }
tonic-build = { workspace = true }
[dev-dependencies]
async-process = "2.1.0"
rstest = "0.19.0"
tempfile = "3.3.0"
tokio-retry = "0.3.0"
hex-literal = "0.4.1"
rstest_reuse = "0.6.0"
xattr = "1.3.1"
serde_json = "*"
async-process = { workspace = true }
rstest = { workspace = true }
tempfile = { workspace = true }
tokio-retry = { workspace = true }
hex-literal = { workspace = true }
rstest_reuse = { workspace = true }
xattr = { workspace = true }
serde_json = { workspace = true }
[features]
default = ["cloud"]
@ -125,6 +93,3 @@ tonic-reflection = ["dep:tonic-reflection"]
# Requires the following packages in $PATH:
# cbtemulator, google-cloud-bigtable-tool
integration = []
[lints]
workspace = true

View file

@ -20,16 +20,16 @@ fn main() -> Result<()> {
.type_attribute(".", "#[derive(Eq, Hash)]")
.compile(
&[
"tvix/castore/protos/castore.proto",
"tvix/castore/protos/rpc_blobstore.proto",
"tvix/castore/protos/rpc_directory.proto",
"castore/protos/castore.proto",
"castore/protos/rpc_blobstore.proto",
"castore/protos/rpc_directory.proto",
],
// If we are in running `cargo build` manually, using `../..` works fine,
// but in case we run inside a nix build, we need to instead point PROTO_ROOT
// to a sparseTree containing that structure.
// to a custom tree containing that structure.
&[match std::env::var_os("PROTO_ROOT") {
Some(proto_root) => proto_root.to_str().unwrap().to_owned(),
None => "../..".to_string(),
None => "..".to_string(),
}],
)
}

View file

@ -1,16 +1,10 @@
{ depot, pkgs, ... }:
{ depot, pkgs, lib, ... }:
let
protos = depot.nix.sparseTree {
name = "castore-protos";
root = depot.path.origSrc;
paths = [
./castore.proto
./rpc_blobstore.proto
./rpc_directory.proto
../../../buf.yaml
../../../buf.gen.yaml
protos = lib.sourceByRegex depot.path.origSrc [
"buf.yaml"
"buf.gen.yaml"
"^tvix(/castore(/protos(/.*\.proto)?)?)?$"
];
};
in
depot.nix.readTree.drvTargets {
inherit protos;

View file

@ -4,7 +4,7 @@ syntax = "proto3";
package tvix.castore.v1;
import "tvix/castore/protos/castore.proto";
import "castore/protos/castore.proto";
option go_package = "code.tvl.fyi/tvix/castore-go;castorev1";

View file

@ -1,14 +1,12 @@
use std::sync::Arc;
use futures::{StreamExt, TryStreamExt};
use tokio_util::io::{ReaderStream, StreamReader};
use tonic::async_trait;
use tracing::{instrument, warn};
use tracing::instrument;
use crate::composition::{CompositionContext, ServiceBuilder};
use crate::{B3Digest, Error};
use super::{naive_seeker::NaiveSeeker, BlobReader, BlobService, BlobWriter};
use super::{BlobReader, BlobService, BlobWriter, ChunkedReader};
/// Combinator for a BlobService, using a "local" and "remote" blobservice.
/// Requests are tried in (and returned from) the local store first, only if
@ -71,19 +69,16 @@ where
// otherwise, a chunked reader, which will always try the
// local backend first.
// map Vec<ChunkMeta> to Vec<(B3Digest, u64)>
let chunks: Vec<(B3Digest, u64)> = remote_chunks
.into_iter()
.map(|chunk_meta| {
let chunked_reader = ChunkedReader::from_chunks(
remote_chunks.into_iter().map(|chunk| {
(
B3Digest::try_from(chunk_meta.digest)
.expect("invalid chunk digest"),
chunk_meta.size,
chunk.digest.try_into().expect("invalid b3 digest"),
chunk.size,
)
})
.collect();
Ok(Some(make_chunked_reader(self.clone(), chunks)))
}),
Arc::new(self.clone()) as Arc<dyn BlobService>,
);
Ok(Some(Box::new(chunked_reader)))
}
}
}
@ -131,41 +126,3 @@ impl ServiceBuilder for CombinedBlobServiceConfig {
}))
}
}
fn make_chunked_reader<BS>(
// This must consume, as we can't retain references to blob_service,
// as it'd add a lifetime to BlobReader in general, which will get
// problematic in TvixStoreFs, which is using async move closures and cloning.
blob_service: BS,
// A list of b3 digests for individual chunks, and their sizes.
chunks: Vec<(B3Digest, u64)>,
) -> Box<dyn BlobReader>
where
BS: BlobService + Clone + 'static,
{
// TODO: offset, verified streaming
// construct readers for each chunk
let blob_service = blob_service.clone();
let readers_stream = tokio_stream::iter(chunks).map(move |(digest, _)| {
let d = digest.to_owned();
let blob_service = blob_service.clone();
async move {
blob_service.open_read(&d.to_owned()).await?.ok_or_else(|| {
warn!(chunk.digest = %digest, "chunk not found");
std::io::Error::new(std::io::ErrorKind::NotFound, "chunk not found")
})
}
});
// convert the stream of readers to a stream of streams of byte chunks
let bytes_streams = readers_stream.then(|elem| async { elem.await.map(ReaderStream::new) });
// flatten into one stream of byte chunks
let bytes_stream = bytes_streams.try_flatten();
// convert into AsyncRead
let blob_reader = StreamReader::new(bytes_stream);
Box::new(NaiveSeeker::new(Box::pin(blob_reader)))
}

View file

@ -11,7 +11,6 @@ mod combinator;
mod from_addr;
mod grpc;
mod memory;
mod naive_seeker;
mod object_store;
#[cfg(test)]

View file

@ -1,265 +0,0 @@
use super::BlobReader;
use futures::ready;
use pin_project_lite::pin_project;
use std::io;
use std::task::Poll;
use tokio::io::AsyncRead;
use tracing::{debug, instrument, trace, warn};
pin_project! {
/// This implements [tokio::io::AsyncSeek] for and [tokio::io::AsyncRead] by
/// simply skipping over some bytes, keeping track of the position.
/// It fails whenever you try to seek backwards.
///
/// ## Pinning concerns:
///
/// [NaiveSeeker] is itself pinned by callers, and we do not need to concern
/// ourselves regarding that.
///
/// Though, its fields as per
/// <https://doc.rust-lang.org/std/pin/#pinning-is-not-structural-for-field>
/// can be pinned or unpinned.
///
/// So we need to go over each field and choose our policy carefully.
///
/// The obvious cases are the bookkeeping integers we keep in the structure,
/// those are private and not shared to anyone, we never build a
/// `Pin<&mut X>` out of them at any point, therefore, we can safely never
/// mark them as pinned. Of course, it is expected that no developer here
/// attempt to `pin!(self.pos)` to pin them because it makes no sense. If
/// they have to become pinned, they should be marked `#[pin]` and we need
/// to discuss it.
///
/// So the bookkeeping integers are in the right state with respect to their
/// pinning status. The projection should offer direct access.
///
/// On the `r` field, i.e. a `BufReader<R>`, given that
/// <https://docs.rs/tokio/latest/tokio/io/struct.BufReader.html#impl-Unpin-for-BufReader%3CR%3E>
/// is available, even a `Pin<&mut BufReader<R>>` can be safely moved.
///
/// The only care we should have regards the internal reader itself, i.e.
/// the `R` instance, see that Tokio decided to `#[pin]` it too:
/// <https://docs.rs/tokio/latest/src/tokio/io/util/buf_reader.rs.html#29>
///
/// In general, there's no `Unpin` instance for `R: tokio::io::AsyncRead`
/// (see <https://docs.rs/tokio/latest/tokio/io/trait.AsyncRead.html>).
///
/// Therefore, we could keep it unpinned and pin it in every call site
/// whenever we need to call `poll_*` which can be confusing to the non-
/// expert developer and we have a fair share amount of situations where the
/// [BufReader] instance is naked, i.e. in its `&mut BufReader<R>`
/// form, this is annoying because it could lead to expose the naked `R`
/// internal instance somehow and would produce a risk of making it move
/// unexpectedly.
///
/// We choose the path of the least resistance as we have no reason to have
/// access to the raw `BufReader<R>` instance, we just `#[pin]` it too and
/// enjoy its `poll_*` safe APIs and push the unpinning concerns to the
/// internal implementations themselves, which studied the question longer
/// than us.
pub struct NaiveSeeker<R: tokio::io::AsyncRead> {
#[pin]
r: tokio::io::BufReader<R>,
pos: u64,
bytes_to_skip: u64,
}
}
/// The buffer size used to discard data.
const DISCARD_BUF_SIZE: usize = 4096;
impl<R: tokio::io::AsyncRead> NaiveSeeker<R> {
pub fn new(r: R) -> Self {
NaiveSeeker {
r: tokio::io::BufReader::new(r),
pos: 0,
bytes_to_skip: 0,
}
}
}
impl<R: tokio::io::AsyncRead> tokio::io::AsyncRead for NaiveSeeker<R> {
#[instrument(level = "trace", skip_all)]
fn poll_read(
self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
buf: &mut tokio::io::ReadBuf<'_>,
) -> Poll<std::io::Result<()>> {
// The amount of data read can be determined by the increase
// in the length of the slice returned by `ReadBuf::filled`.
let filled_before = buf.filled().len();
let this = self.project();
ready!(this.r.poll_read(cx, buf))?;
let bytes_read = buf.filled().len() - filled_before;
*this.pos += bytes_read as u64;
trace!(bytes_read = bytes_read, new_pos = this.pos, "poll_read");
Ok(()).into()
}
}
impl<R: tokio::io::AsyncRead> tokio::io::AsyncBufRead for NaiveSeeker<R> {
fn poll_fill_buf(
self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> Poll<io::Result<&[u8]>> {
self.project().r.poll_fill_buf(cx)
}
#[instrument(level = "trace", skip(self))]
fn consume(self: std::pin::Pin<&mut Self>, amt: usize) {
let this = self.project();
this.r.consume(amt);
*this.pos += amt as u64;
trace!(new_pos = this.pos, "consume");
}
}
impl<R: tokio::io::AsyncRead> tokio::io::AsyncSeek for NaiveSeeker<R> {
#[instrument(level="trace", skip(self), fields(inner_pos=%self.pos), err(Debug))]
fn start_seek(
self: std::pin::Pin<&mut Self>,
position: std::io::SeekFrom,
) -> std::io::Result<()> {
let absolute_offset: u64 = match position {
io::SeekFrom::Start(start_offset) => {
if start_offset < self.pos {
return Err(io::Error::new(
io::ErrorKind::Unsupported,
format!("can't seek backwards ({} -> {})", self.pos, start_offset),
));
} else {
start_offset
}
}
// we don't know the total size, can't support this.
io::SeekFrom::End(_end_offset) => {
return Err(io::Error::new(
io::ErrorKind::Unsupported,
"can't seek from end",
));
}
io::SeekFrom::Current(relative_offset) => {
if relative_offset < 0 {
return Err(io::Error::new(
io::ErrorKind::Unsupported,
"can't seek backwards relative to current position",
));
} else {
self.pos + relative_offset as u64
}
}
};
// we already know absolute_offset is >= self.pos
debug_assert!(
absolute_offset >= self.pos,
"absolute_offset {} must be >= self.pos {}",
absolute_offset,
self.pos
);
// calculate bytes to skip
let this = self.project();
*this.bytes_to_skip = absolute_offset - *this.pos;
debug!(bytes_to_skip = *this.bytes_to_skip, "seek");
Ok(())
}
#[instrument(skip_all)]
fn poll_complete(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> Poll<std::io::Result<u64>> {
if self.bytes_to_skip == 0 {
// return the new position (from the start of the stream)
return Poll::Ready(Ok(self.pos));
}
// discard some bytes, until pos is where we want it to be.
// We create a buffer that we'll discard later on.
let mut discard_buf = [0; DISCARD_BUF_SIZE];
// Loop until we've reached the desired seek position. This is done by issuing repeated
// `poll_read` calls.
// If the data is not available yet, we will yield back to the executor
// and wait to be polled again.
loop {
if self.bytes_to_skip == 0 {
return Poll::Ready(Ok(self.pos));
}
// calculate the length we want to skip at most, which is either a max
// buffer size, or the number of remaining bytes to read, whatever is
// smaller.
let bytes_to_skip_now = std::cmp::min(self.bytes_to_skip as usize, discard_buf.len());
let mut discard_buf = tokio::io::ReadBuf::new(&mut discard_buf[..bytes_to_skip_now]);
ready!(self.as_mut().poll_read(cx, &mut discard_buf))?;
let bytes_skipped = discard_buf.filled().len();
if bytes_skipped == 0 {
return Poll::Ready(Err(io::Error::new(
io::ErrorKind::UnexpectedEof,
"got EOF while trying to skip bytes",
)));
}
// decrement bytes to skip. The poll_read call already updated self.pos.
*self.as_mut().project().bytes_to_skip -= bytes_skipped as u64;
}
}
}
impl<R: tokio::io::AsyncRead + Send + Unpin + 'static> BlobReader for NaiveSeeker<R> {}
#[cfg(test)]
mod tests {
use super::{NaiveSeeker, DISCARD_BUF_SIZE};
use std::io::{Cursor, SeekFrom};
use tokio::io::{AsyncReadExt, AsyncSeekExt};
/// This seek requires multiple `poll_read` as we use a multiples of
/// DISCARD_BUF_SIZE when doing the seek.
/// This ensures we don't hang indefinitely.
#[tokio::test]
async fn seek() {
let buf = vec![0u8; DISCARD_BUF_SIZE * 4];
let reader = Cursor::new(&buf);
let mut seeker = NaiveSeeker::new(reader);
seeker.seek(SeekFrom::Start(4000)).await.unwrap();
}
#[tokio::test]
async fn seek_read() {
let mut buf = vec![0u8; DISCARD_BUF_SIZE * 2];
buf.extend_from_slice(&[1u8; DISCARD_BUF_SIZE * 2]);
buf.extend_from_slice(&[2u8; DISCARD_BUF_SIZE * 2]);
let reader = Cursor::new(&buf);
let mut seeker = NaiveSeeker::new(reader);
let mut read_buf = vec![0u8; DISCARD_BUF_SIZE];
seeker.read_exact(&mut read_buf).await.expect("must read");
assert_eq!(read_buf.as_slice(), &[0u8; DISCARD_BUF_SIZE]);
seeker
.seek(SeekFrom::Current(DISCARD_BUF_SIZE as i64))
.await
.expect("must seek");
seeker.read_exact(&mut read_buf).await.expect("must read");
assert_eq!(read_buf.as_slice(), &[1u8; DISCARD_BUF_SIZE]);
seeker
.seek(SeekFrom::Start(2 * 2 * DISCARD_BUF_SIZE as u64))
.await
.expect("must seek");
seeker.read_exact(&mut read_buf).await.expect("must read");
assert_eq!(read_buf.as_slice(), &[2u8; DISCARD_BUF_SIZE]);
}
}

View file

@ -149,7 +149,7 @@ impl<'r, 'de: 'r, T: 'static> SeedFactory<'de, TagString<'de>> for RegistryWithF
.0
.iter()
.find(|(k, _)| *k == &(TypeId::of::<T>(), tag.as_ref()))
.ok_or_else(|| serde::de::Error::custom("Unknown tag"))?
.ok_or_else(|| serde::de::Error::custom(format!("Unknown type: {}", tag)))?
.1;
let entry: &RegistryEntry<T> = <dyn Any>::downcast_ref(&**seed).unwrap();
@ -215,7 +215,7 @@ impl<'de, T: 'static> serde::Deserialize<'de> for DeserializeWithRegistry<T> {
#[derive(Debug, thiserror::Error)]
enum TryFromUrlError {
#[error("Unknown tag: {0}")]
#[error("Unknown type: {0}")]
UnknownTag(String),
}
@ -274,6 +274,9 @@ pub fn add_default_services(reg: &mut Registry) {
}
pub struct CompositionContext<'a> {
// The stack used to detect recursive instantiations and prevent deadlocks
// The TypeId of the trait object is included to distinguish e.g. the
// BlobService "default" and the DirectoryService "default".
stack: Vec<(TypeId, String)>,
composition: Option<&'a Composition>,
}
@ -431,10 +434,13 @@ impl Composition {
new_context
.stack
.push((TypeId::of::<T>(), entrypoint.clone()));
let res = config
.build(&entrypoint, &new_context)
.await
.map_err(|e| CompositionError::Failed(entrypoint, e.into()));
let res =
config.build(&entrypoint, &new_context).await.map_err(|e| {
match e.downcast() {
Ok(e) => *e,
Err(e) => CompositionError::Failed(entrypoint, e.into()),
}
});
tx.send(Some(res.clone())).unwrap();
res
})
@ -470,3 +476,66 @@ impl Composition {
}
}
}
#[cfg(test)]
mod test {
use super::*;
use crate::blobservice::BlobService;
use std::sync::Arc;
/// Test that we return a reference to the same instance of MemoryBlobService (via ptr_eq)
/// when instantiating the same entrypoint twice. By instantiating concurrently, we also
/// test the channels notifying the second consumer when the store has been instantiated.
#[tokio::test]
async fn concurrent() {
let blob_services_configs_json = serde_json::json!({
"default": {
"type": "memory",
}
});
let blob_services_configs =
with_registry(&REG, || serde_json::from_value(blob_services_configs_json)).unwrap();
let mut blob_service_composition = Composition::default();
blob_service_composition.extend_with_configs::<dyn BlobService>(blob_services_configs);
let (blob_service1, blob_service2) = tokio::join!(
blob_service_composition.build::<dyn BlobService>("default"),
blob_service_composition.build::<dyn BlobService>("default")
);
assert!(Arc::ptr_eq(
&blob_service1.unwrap(),
&blob_service2.unwrap()
));
}
/// Test that we throw the correct error when an instantiation would recurse (deadlock)
#[tokio::test]
async fn reject_recursion() {
let blob_services_configs_json = serde_json::json!({
"default": {
"type": "combined",
"local": "other",
"remote": "other"
},
"other": {
"type": "combined",
"local": "default",
"remote": "default"
}
});
let blob_services_configs =
with_registry(&REG, || serde_json::from_value(blob_services_configs_json)).unwrap();
let mut blob_service_composition = Composition::default();
blob_service_composition.extend_with_configs::<dyn BlobService>(blob_services_configs);
match blob_service_composition
.build::<dyn BlobService>("default")
.await
{
Err(CompositionError::Recursion(stack)) => {
assert_eq!(stack, vec!["default".to_string(), "other".to_string()])
}
other => panic!("should have returned an error, returned: {:?}", other.err()),
}
}
}

View file

@ -6,7 +6,7 @@ use thiserror::Error;
pub struct B3Digest(Bytes);
// TODO: allow converting these errors to crate::Error
#[derive(Error, Debug)]
#[derive(Error, Debug, PartialEq)]
pub enum Error {
#[error("invalid digest length: {0}")]
InvalidDigestLen(usize),
@ -26,6 +26,11 @@ impl From<B3Digest> for bytes::Bytes {
}
}
impl From<blake3::Hash> for B3Digest {
fn from(value: blake3::Hash) -> Self {
Self(Bytes::copy_from_slice(value.as_bytes()))
}
}
impl From<digest::Output<blake3::Hasher>> for B3Digest {
fn from(value: digest::Output<blake3::Hasher>) -> Self {
let v = Into::<[u8; B3_LEN]>::into(value);
@ -67,6 +72,12 @@ impl From<&[u8; B3_LEN]> for B3Digest {
}
}
impl From<B3Digest> for [u8; B3_LEN] {
fn from(value: B3Digest) -> Self {
value.0.to_vec().try_into().unwrap()
}
}
impl Clone for B3Digest {
fn clone(&self) -> Self {
Self(self.0.to_owned())

View file

@ -9,7 +9,9 @@ use std::sync::Arc;
use tonic::async_trait;
use tracing::{instrument, trace, warn};
use super::{utils::traverse_directory, DirectoryPutter, DirectoryService, SimplePutter};
use super::{
utils::traverse_directory, Directory, DirectoryPutter, DirectoryService, SimplePutter,
};
use crate::composition::{CompositionContext, ServiceBuilder};
use crate::{proto, B3Digest, Error};
@ -149,7 +151,7 @@ fn derive_directory_key(digest: &B3Digest) -> String {
#[async_trait]
impl DirectoryService for BigtableDirectoryService {
#[instrument(skip(self, digest), err, fields(directory.digest = %digest))]
async fn get(&self, digest: &B3Digest) -> Result<Option<proto::Directory>, Error> {
async fn get(&self, digest: &B3Digest) -> Result<Option<Directory>, Error> {
let mut client = self.client.clone();
let directory_key = derive_directory_key(digest);
@ -241,28 +243,20 @@ impl DirectoryService for BigtableDirectoryService {
// Try to parse the value into a Directory message.
let directory = proto::Directory::decode(Bytes::from(row_cell.value))
.map_err(|e| Error::StorageError(format!("unable to decode directory proto: {}", e)))?;
// validate the Directory.
directory
.validate()
.map_err(|e| Error::StorageError(format!("unable to decode directory proto: {}", e)))?
.try_into()
.map_err(|e| Error::StorageError(format!("invalid Directory message: {}", e)))?;
Ok(Some(directory))
}
#[instrument(skip(self, directory), err, fields(directory.digest = %directory.digest()))]
async fn put(&self, directory: proto::Directory) -> Result<B3Digest, Error> {
async fn put(&self, directory: Directory) -> Result<B3Digest, Error> {
let directory_digest = directory.digest();
let mut client = self.client.clone();
let directory_key = derive_directory_key(&directory_digest);
// Ensure the directory we're trying to upload passes validation
directory
.validate()
.map_err(|e| Error::InvalidRequest(format!("directory is invalid: {}", e)))?;
let data = directory.encode_to_vec();
let data = proto::Directory::from(directory).encode_to_vec();
if data.len() as u64 > CELL_SIZE_LIMIT {
return Err(Error::StorageError(
"Directory exceeds cell limit on Bigtable".into(),
@ -310,7 +304,7 @@ impl DirectoryService for BigtableDirectoryService {
fn get_recursive(
&self,
root_directory_digest: &B3Digest,
) -> BoxStream<'static, Result<proto::Directory, Error>> {
) -> BoxStream<'static, Result<Directory, Error>> {
traverse_directory(self.clone(), root_directory_digest)
}

View file

@ -7,10 +7,9 @@ use futures::TryStreamExt;
use tonic::async_trait;
use tracing::{instrument, trace};
use super::{DirectoryGraph, DirectoryService, RootToLeavesValidator, SimplePutter};
use super::{Directory, DirectoryGraph, DirectoryService, RootToLeavesValidator, SimplePutter};
use crate::composition::{CompositionContext, ServiceBuilder};
use crate::directoryservice::DirectoryPutter;
use crate::proto;
use crate::B3Digest;
use crate::Error;
@ -40,7 +39,7 @@ where
DS2: DirectoryService + Clone + 'static,
{
#[instrument(skip(self, digest), fields(directory.digest = %digest))]
async fn get(&self, digest: &B3Digest) -> Result<Option<proto::Directory>, Error> {
async fn get(&self, digest: &B3Digest) -> Result<Option<Directory>, Error> {
match self.near.get(digest).await? {
Some(directory) => {
trace!("serving from cache");
@ -82,7 +81,7 @@ where
}
#[instrument(skip_all)]
async fn put(&self, _directory: proto::Directory) -> Result<B3Digest, Error> {
async fn put(&self, _directory: Directory) -> Result<B3Digest, Error> {
Err(Error::StorageError("unimplemented".to_string()))
}
@ -90,7 +89,7 @@ where
fn get_recursive(
&self,
root_directory_digest: &B3Digest,
) -> BoxStream<'static, Result<proto::Directory, Error>> {
) -> BoxStream<'static, Result<Directory, Error>> {
let near = self.near.clone();
let far = self.far.clone();
let digest = root_directory_digest.clone();
@ -179,3 +178,75 @@ impl ServiceBuilder for CacheConfig {
}))
}
}
#[derive(Clone)]
pub struct Router<DS1, DS2> {
writes: DS1,
reads: DS2,
}
#[async_trait]
impl<DS1, DS2> DirectoryService for Router<DS1, DS2>
where
DS1: DirectoryService + Clone + 'static,
DS2: DirectoryService + Clone + 'static,
{
#[instrument(skip(self, digest), fields(directory.digest = %digest))]
async fn get(&self, digest: &B3Digest) -> Result<Option<Directory>, Error> {
self.reads.get(digest).await
}
#[instrument(skip_all)]
async fn put(&self, directory: Directory) -> Result<B3Digest, Error> {
self.writes.put(directory).await
}
#[instrument(skip_all, fields(directory.digest = %root_directory_digest))]
fn get_recursive(
&self,
root_directory_digest: &B3Digest,
) -> BoxStream<'static, Result<Directory, Error>> {
self.reads.get_recursive(root_directory_digest)
}
#[instrument(skip_all)]
fn put_multiple_start(&self) -> Box<(dyn DirectoryPutter + 'static)> {
self.writes.put_multiple_start()
}
}
#[derive(serde::Deserialize, Debug)]
#[serde(deny_unknown_fields)]
pub struct RouterConfig {
writes: String,
reads: String,
}
impl TryFrom<url::Url> for RouterConfig {
type Error = Box<dyn std::error::Error + Send + Sync>;
fn try_from(_url: url::Url) -> Result<Self, Self::Error> {
Err(Error::StorageError(
"Instantiating a CombinedDirectoryService from a url is not supported".into(),
)
.into())
}
}
#[async_trait]
impl ServiceBuilder for RouterConfig {
type Output = dyn DirectoryService;
async fn build<'a>(
&'a self,
_instance_name: &str,
context: &CompositionContext,
) -> Result<Arc<dyn DirectoryService>, Box<dyn std::error::Error + Send + Sync + 'static>> {
let (writes, reads) = futures::join!(
context.resolve(self.writes.clone()),
context.resolve(self.reads.clone())
);
Ok(Arc::new(Router {
writes: writes?,
reads: reads?,
}))
}
}

View file

@ -1,7 +1,5 @@
use std::collections::HashMap;
use bstr::ByteSlice;
use petgraph::{
graph::{DiGraph, NodeIndex},
visit::{Bfs, DfsPostOrder, EdgeRef, IntoNodeIdentifiers, Walker},
@ -10,10 +8,7 @@ use petgraph::{
use tracing::instrument;
use super::order_validator::{LeavesToRootValidator, OrderValidator, RootToLeavesValidator};
use crate::{
proto::{self, Directory, DirectoryNode},
B3Digest,
};
use crate::{path::PathComponent, B3Digest, Directory, Node};
#[derive(thiserror::Error, Debug)]
pub enum Error {
@ -21,6 +16,11 @@ pub enum Error {
ValidationError(String),
}
struct EdgeWeight {
name: PathComponent,
size: u64,
}
/// This can be used to validate and/or re-order a Directory closure (DAG of
/// connected Directories), and their insertion order.
///
@ -58,7 +58,7 @@ pub struct DirectoryGraph<O> {
//
// The option in the edge weight tracks the pending validation state of the respective edge, for example if
// the child has not been added yet.
graph: DiGraph<Option<Directory>, Option<DirectoryNode>>,
graph: DiGraph<Option<Directory>, Option<EdgeWeight>>,
// A lookup table from directory digest to node index.
digest_to_node_ix: HashMap<B3Digest, NodeIndex>,
@ -67,18 +67,18 @@ pub struct DirectoryGraph<O> {
}
pub struct ValidatedDirectoryGraph {
graph: DiGraph<Option<Directory>, Option<DirectoryNode>>,
graph: DiGraph<Option<Directory>, Option<EdgeWeight>>,
root: Option<NodeIndex>,
}
fn check_edge(dir: &DirectoryNode, child: &Directory) -> Result<(), Error> {
fn check_edge(edge: &EdgeWeight, child: &Directory) -> Result<(), Error> {
// Ensure the size specified in the child node matches our records.
if dir.size != child.size() {
if edge.size != child.size() {
return Err(Error::ValidationError(format!(
"'{}' has wrong size, specified {}, recorded {}",
dir.name.as_bstr(),
dir.size,
edge.name,
edge.size,
child.size(),
)));
}
@ -88,7 +88,7 @@ fn check_edge(dir: &DirectoryNode, child: &Directory) -> Result<(), Error> {
impl DirectoryGraph<LeavesToRootValidator> {
/// Insert a new Directory into the closure
#[instrument(level = "trace", skip_all, fields(directory.digest=%directory.digest(), directory.size=%directory.size()), err)]
pub fn add(&mut self, directory: proto::Directory) -> Result<(), Error> {
pub fn add(&mut self, directory: Directory) -> Result<(), Error> {
if !self.order_validator.add_directory(&directory) {
return Err(Error::ValidationError(
"unknown directory was referenced".into(),
@ -108,7 +108,7 @@ impl DirectoryGraph<RootToLeavesValidator> {
/// Insert a new Directory into the closure
#[instrument(level = "trace", skip_all, fields(directory.digest=%directory.digest(), directory.size=%directory.size()), err)]
pub fn add(&mut self, directory: proto::Directory) -> Result<(), Error> {
pub fn add(&mut self, directory: Directory) -> Result<(), Error> {
let digest = directory.digest();
if !self.order_validator.digest_allowed(&digest) {
return Err(Error::ValidationError("unexpected digest".into()));
@ -129,12 +129,7 @@ impl<O: OrderValidator> DirectoryGraph<O> {
}
/// Adds a directory which has already been confirmed to be in-order to the graph
pub fn add_order_unchecked(&mut self, directory: proto::Directory) -> Result<(), Error> {
// Do some basic validation
directory
.validate()
.map_err(|e| Error::ValidationError(e.to_string()))?;
pub fn add_order_unchecked(&mut self, directory: Directory) -> Result<(), Error> {
let digest = directory.digest();
// Teach the graph about the existence of a node with this digest
@ -149,24 +144,33 @@ impl<O: OrderValidator> DirectoryGraph<O> {
}
// set up edges to all child directories
for subdir in &directory.directories {
let subdir_digest: B3Digest = subdir.digest.clone().try_into().unwrap();
for (name, node) in directory.nodes() {
if let Node::Directory { digest, size } = node {
let child_ix = *self
.digest_to_node_ix
.entry(subdir_digest)
.entry(digest.clone())
.or_insert_with(|| self.graph.add_node(None));
let pending_edge_check = match &self.graph[child_ix] {
Some(child) => {
// child is already available, validate the edge now
check_edge(subdir, child)?;
check_edge(
&EdgeWeight {
name: name.clone(),
size: *size,
},
child,
)?;
None
}
None => Some(subdir.clone()), // pending validation
None => Some(EdgeWeight {
name: name.clone(),
size: *size,
}), // pending validation
};
self.graph.add_edge(ix, child_ix, pending_edge_check);
}
}
// validate the edges from parents to this node
// this collects edge ids in a Vec because there is no edges_directed_mut :'c
@ -183,6 +187,7 @@ impl<O: OrderValidator> DirectoryGraph<O> {
.expect("edge not found")
.take()
.expect("edge is already validated");
check_edge(&edge_weight, &directory)?;
}
@ -266,37 +271,37 @@ impl ValidatedDirectoryGraph {
.filter_map(move |i| nodes[i.index()].weight.take())
}
}
#[cfg(test)]
mod tests {
use crate::{
fixtures::{DIRECTORY_A, DIRECTORY_B, DIRECTORY_C},
proto::{self, Directory},
};
use lazy_static::lazy_static;
use rstest::rstest;
lazy_static! {
/*
pub static ref BROKEN_DIRECTORY : Directory = Directory {
symlinks: vec![proto::SymlinkNode {
symlinks: vec![SymlinkNode {
name: "".into(), // invalid name!
target: "doesntmatter".into(),
}],
..Default::default()
};
pub static ref BROKEN_PARENT_DIRECTORY: Directory = Directory {
directories: vec![proto::DirectoryNode {
name: "foo".into(),
digest: DIRECTORY_A.digest().into(),
size: DIRECTORY_A.size() + 42, // wrong!
}],
..Default::default()
};
}
*/
#[cfg(test)]
mod tests {
use crate::fixtures::{DIRECTORY_A, DIRECTORY_B, DIRECTORY_C};
use crate::{Directory, Node};
use lazy_static::lazy_static;
use rstest::rstest;
use super::{DirectoryGraph, LeavesToRootValidator, RootToLeavesValidator};
lazy_static! {
pub static ref BROKEN_PARENT_DIRECTORY: Directory =
Directory::try_from_iter([
(
"foo".try_into().unwrap(),
Node::Directory{
digest: DIRECTORY_A.digest(),
size: DIRECTORY_A.size() + 42, // wrong!
}
)
]).unwrap();
}
#[rstest]
/// Uploading an empty directory should succeed.
#[case::empty_directory(&[&*DIRECTORY_A], false, Some(vec![&*DIRECTORY_A]))]
@ -312,8 +317,6 @@ mod tests {
#[case::unconnected_node(&[&*DIRECTORY_A, &*DIRECTORY_C, &*DIRECTORY_B], false, None)]
/// Uploading B (referring to A) should fail immediately, because A was never uploaded.
#[case::dangling_pointer(&[&*DIRECTORY_B], true, None)]
/// Uploading a directory failing validation should fail immediately.
#[case::failing_validation(&[&*BROKEN_DIRECTORY], true, None)]
/// Uploading a directory which refers to another Directory with a wrong size should fail.
#[case::wrong_size_in_parent(&[&*DIRECTORY_A, &*BROKEN_PARENT_DIRECTORY], true, None)]
fn test_uploads(
@ -366,8 +369,6 @@ mod tests {
#[case::unconnected_node(&*DIRECTORY_C, &[&*DIRECTORY_C, &*DIRECTORY_B], true, None)]
/// Downloading B (specified as the root) but receiving A instead should fail immediately, because A has no connection to B (the root).
#[case::dangling_pointer(&*DIRECTORY_B, &[&*DIRECTORY_A], true, None)]
/// Downloading a directory failing validation should fail immediately.
#[case::failing_validation(&*BROKEN_DIRECTORY, &[&*BROKEN_DIRECTORY], true, None)]
/// Downloading a directory which refers to another Directory with a wrong size should fail.
#[case::wrong_size_in_parent(&*BROKEN_PARENT_DIRECTORY, &[&*BROKEN_PARENT_DIRECTORY, &*DIRECTORY_A], true, None)]
fn test_downloads(

View file

@ -18,6 +18,11 @@ use super::DirectoryService;
/// - `sled:///absolute/path/to/somewhere`
/// Uses sled, using a path on the disk for persistency. Can be only opened
/// from one process at the same time.
/// - `redb:`
/// Uses a in-memory redb implementation.
/// - `redb:///absolute/path/to/somewhere`
/// Uses redb, using a path on the disk for persistency. Can be only opened
/// from one process at the same time.
/// - `grpc+unix:///absolute/path/to/somewhere`
/// Connects to a local tvix-store gRPC service via Unix socket.
/// - `grpc+http://host:port`, `grpc+https://host:port`
@ -52,6 +57,8 @@ mod tests {
lazy_static! {
static ref TMPDIR_SLED_1: TempDir = TempDir::new().unwrap();
static ref TMPDIR_SLED_2: TempDir = TempDir::new().unwrap();
static ref TMPDIR_REDB_1: TempDir = TempDir::new().unwrap();
static ref TMPDIR_REDB_2: TempDir = TempDir::new().unwrap();
}
#[rstest]
@ -75,6 +82,16 @@ mod tests {
#[case::memory_invalid_root_path("memory:///", false)]
/// This sets a memory url path to "/foo", which is invalid.
#[case::memory_invalid_root_path_foo("memory:///foo", false)]
/// This configures redb in temporary mode.
#[case::redb_valid_temporary("redb://", true)]
/// This configures redb with /, which should fail.
#[case::redb_invalid_root("redb:///", false)]
/// This configures redb with a host, not path, which should fail.
#[case::redb_invalid_host("redb://foo.example", false)]
/// This configures redb with a valid path, which should succeed.
#[case::redb_valid_path(&format!("redb://{}", &TMPDIR_REDB_1.path().join("foo").to_str().unwrap()), true)]
/// This configures redb with a host, and a valid path path, which should fail.
#[case::redb_invalid_host_with_valid_path(&format!("redb://foo.example{}", &TMPDIR_REDB_2.path().join("bar").to_str().unwrap()), false)]
/// Correct scheme to connect to a unix socket.
#[case::grpc_valid_unix_socket("grpc+unix:///path/to/somewhere", true)]
/// Correct scheme for unix socket, but setting a host too, which is invalid.

View file

@ -1,9 +1,9 @@
use std::collections::HashSet;
use super::{DirectoryPutter, DirectoryService};
use super::{Directory, DirectoryPutter, DirectoryService};
use crate::composition::{CompositionContext, ServiceBuilder};
use crate::proto::{self, get_directory_request::ByWhat};
use crate::{B3Digest, Error};
use crate::{B3Digest, DirectoryError, Error};
use async_stream::try_stream;
use futures::stream::BoxStream;
use std::sync::Arc;
@ -41,10 +41,7 @@ where
T::Future: Send,
{
#[instrument(level = "trace", skip_all, fields(directory.digest = %digest))]
async fn get(
&self,
digest: &B3Digest,
) -> Result<Option<crate::proto::Directory>, crate::Error> {
async fn get(&self, digest: &B3Digest) -> Result<Option<Directory>, crate::Error> {
// Get a new handle to the gRPC client, and copy the digest.
let mut grpc_client = self.grpc_client.clone();
let digest_cpy = digest.clone();
@ -72,15 +69,10 @@ where
"requested directory with digest {}, but got {}",
digest, actual_digest
)))
} else if let Err(e) = directory.validate() {
// Validate the Directory itself is valid.
warn!("directory failed validation: {}", e.to_string());
Err(crate::Error::StorageError(format!(
"directory {} failed validation: {}",
digest, e,
)))
} else {
Ok(Some(directory))
Ok(Some(directory.try_into().map_err(|_| {
Error::StorageError("invalid root digest length in response".to_string())
})?))
}
}
Ok(None) => Ok(None),
@ -90,11 +82,11 @@ where
}
#[instrument(level = "trace", skip_all, fields(directory.digest = %directory.digest()))]
async fn put(&self, directory: crate::proto::Directory) -> Result<B3Digest, crate::Error> {
async fn put(&self, directory: Directory) -> Result<B3Digest, crate::Error> {
let resp = self
.grpc_client
.clone()
.put(tokio_stream::once(directory))
.put(tokio_stream::once(proto::Directory::from(directory)))
.await;
match resp {
@ -113,7 +105,7 @@ where
fn get_recursive(
&self,
root_directory_digest: &B3Digest,
) -> BoxStream<'static, Result<proto::Directory, Error>> {
) -> BoxStream<'static, Result<Directory, Error>> {
let mut grpc_client = self.grpc_client.clone();
let root_directory_digest = root_directory_digest.clone();
@ -130,19 +122,11 @@ where
// The Directory digests we received so far
let mut received_directory_digests: HashSet<B3Digest> = HashSet::new();
// The Directory digests we're still expecting to get sent.
let mut expected_directory_digests: HashSet<B3Digest> = HashSet::from([root_directory_digest]);
let mut expected_directory_digests: HashSet<B3Digest> = HashSet::from([root_directory_digest.clone()]);
loop {
match stream.message().await {
Ok(Some(directory)) => {
// validate the directory itself.
if let Err(e) = directory.validate() {
Err(crate::Error::StorageError(format!(
"directory {} failed validation: {}",
directory.digest(),
e,
)))?;
}
// validate we actually expected that directory, and move it from expected to received.
let directory_digest = directory.digest();
let was_expected = expected_directory_digests.remove(&directory_digest);
@ -168,14 +152,28 @@ where
.insert(child_directory_digest);
}
let directory = directory.try_into()
.map_err(|e: DirectoryError| Error::StorageError(e.to_string()))?;
yield directory;
},
Ok(None) if expected_directory_digests.len() == 1 && expected_directory_digests.contains(&root_directory_digest) => {
// The root directory of the requested closure was not found, return an
// empty stream
return
}
Ok(None) => {
// If we were still expecting something, that's an error.
if !expected_directory_digests.is_empty() {
// The stream has ended
let diff_len = expected_directory_digests
// Account for directories which have been referenced more than once,
// but only received once since they were deduplicated
.difference(&received_directory_digests)
.count();
// If this is not empty, then the closure is incomplete
if diff_len != 0 {
Err(crate::Error::StorageError(format!(
"still expected {} directories, but got premature end of stream",
expected_directory_digests.len(),
diff_len
)))?
} else {
return
@ -268,11 +266,11 @@ pub struct GRPCPutter {
#[async_trait]
impl DirectoryPutter for GRPCPutter {
#[instrument(level = "trace", skip_all, fields(directory.digest=%directory.digest()), err)]
async fn put(&mut self, directory: proto::Directory) -> Result<(), crate::Error> {
async fn put(&mut self, directory: Directory) -> Result<(), crate::Error> {
match self.rq {
// If we're not already closed, send the directory to directory_sender.
Some((_, ref directory_sender)) => {
if directory_sender.send(directory).is_err() {
if directory_sender.send(directory.into()).is_err() {
// If the channel has been prematurely closed, invoke close (so we can peek at the error code)
// That error code is much more helpful, because it
// contains the error message from the server.

View file

@ -1,4 +1,4 @@
use crate::{proto, B3Digest, Error};
use crate::{B3Digest, Error};
use futures::stream::BoxStream;
use std::collections::HashMap;
use std::sync::Arc;
@ -7,8 +7,9 @@ use tonic::async_trait;
use tracing::{instrument, warn};
use super::utils::traverse_directory;
use super::{DirectoryPutter, DirectoryService, SimplePutter};
use super::{Directory, DirectoryPutter, DirectoryService, SimplePutter};
use crate::composition::{CompositionContext, ServiceBuilder};
use crate::proto;
#[derive(Clone, Default)]
pub struct MemoryDirectoryService {
@ -18,7 +19,7 @@ pub struct MemoryDirectoryService {
#[async_trait]
impl DirectoryService for MemoryDirectoryService {
#[instrument(skip(self, digest), fields(directory.digest = %digest))]
async fn get(&self, digest: &B3Digest) -> Result<Option<proto::Directory>, Error> {
async fn get(&self, digest: &B3Digest) -> Result<Option<Directory>, Error> {
let db = self.db.read().await;
match db.get(digest) {
@ -37,35 +38,20 @@ impl DirectoryService for MemoryDirectoryService {
)));
}
// Validate the Directory itself is valid.
if let Err(e) = directory.validate() {
warn!("directory failed validation: {}", e.to_string());
return Err(Error::StorageError(format!(
"directory {} failed validation: {}",
actual_digest, e,
)));
}
Ok(Some(directory.clone()))
Ok(Some(directory.clone().try_into().map_err(|e| {
crate::Error::StorageError(format!("corrupted directory: {}", e))
})?))
}
}
}
#[instrument(skip(self, directory), fields(directory.digest = %directory.digest()))]
async fn put(&self, directory: proto::Directory) -> Result<B3Digest, Error> {
async fn put(&self, directory: Directory) -> Result<B3Digest, Error> {
let digest = directory.digest();
// validate the directory itself.
if let Err(e) = directory.validate() {
return Err(Error::InvalidRequest(format!(
"directory {} failed validation: {}",
digest, e,
)));
}
// store it
let mut db = self.db.write().await;
db.insert(digest.clone(), directory);
db.insert(digest.clone(), directory.into());
Ok(digest)
}
@ -74,7 +60,7 @@ impl DirectoryService for MemoryDirectoryService {
fn get_recursive(
&self,
root_directory_digest: &B3Digest,
) -> BoxStream<'static, Result<proto::Directory, Error>> {
) -> BoxStream<'static, Result<Directory, Error>> {
traverse_directory(self.clone(), root_directory_digest)
}

View file

@ -1,5 +1,5 @@
use crate::composition::{Registry, ServiceBuilder};
use crate::{proto, B3Digest, Error};
use crate::{B3Digest, Directory, Error};
use futures::stream::BoxStream;
use tonic::async_trait;
@ -10,6 +10,7 @@ mod grpc;
mod memory;
mod object_store;
mod order_validator;
mod redb;
mod simple_putter;
mod sled;
#[cfg(test)]
@ -17,13 +18,14 @@ pub mod tests;
mod traverse;
mod utils;
pub use self::combinators::{Cache, CacheConfig};
pub use self::directory_graph::DirectoryGraph;
pub use self::combinators::{Cache, CacheConfig, Router, RouterConfig};
pub use self::directory_graph::{DirectoryGraph, ValidatedDirectoryGraph};
pub use self::from_addr::from_addr;
pub use self::grpc::{GRPCDirectoryService, GRPCDirectoryServiceConfig};
pub use self::memory::{MemoryDirectoryService, MemoryDirectoryServiceConfig};
pub use self::object_store::{ObjectStoreDirectoryService, ObjectStoreDirectoryServiceConfig};
pub use self::order_validator::{LeavesToRootValidator, OrderValidator, RootToLeavesValidator};
pub use self::redb::{RedbDirectoryService, RedbDirectoryServiceConfig};
pub use self::simple_putter::SimplePutter;
pub use self::sled::{SledDirectoryService, SledDirectoryServiceConfig};
pub use self::traverse::descend_to;
@ -36,7 +38,7 @@ mod bigtable;
pub use self::bigtable::{BigtableDirectoryService, BigtableParameters};
/// The base trait all Directory services need to implement.
/// This is a simple get and put of [crate::proto::Directory], returning their
/// This is a simple get and put of [Directory], returning their
/// digest.
#[async_trait]
pub trait DirectoryService: Send + Sync {
@ -48,14 +50,14 @@ pub trait DirectoryService: Send + Sync {
/// Directory digests that are at the "root", aka the last element that's
/// sent to a DirectoryPutter. This makes sense for implementations bundling
/// closures of directories together in batches.
async fn get(&self, digest: &B3Digest) -> Result<Option<proto::Directory>, Error>;
async fn get(&self, digest: &B3Digest) -> Result<Option<Directory>, Error>;
/// Uploads a single Directory message, and returns the calculated
/// digest, or an error. An error *must* also be returned if the message is
/// not valid.
async fn put(&self, directory: proto::Directory) -> Result<B3Digest, Error>;
async fn put(&self, directory: Directory) -> Result<B3Digest, Error>;
/// Looks up a closure of [proto::Directory].
/// Ideally this would be a `impl Stream<Item = Result<proto::Directory, Error>>`,
/// Looks up a closure of [Directory].
/// Ideally this would be a `impl Stream<Item = Result<Directory, Error>>`,
/// and we'd be able to add a default implementation for it here, but
/// we can't have that yet.
///
@ -68,12 +70,14 @@ pub trait DirectoryService: Send + Sync {
/// Directories are sent in an order from the root to the leaves, so that
/// the receiving side can validate each message to be a connected to the root
/// that has initially been requested.
///
/// In case the directory can not be found, this should return an empty stream.
fn get_recursive(
&self,
root_directory_digest: &B3Digest,
) -> BoxStream<'static, Result<proto::Directory, Error>>;
) -> BoxStream<'static, Result<Directory, Error>>;
/// Allows persisting a closure of [proto::Directory], which is a graph of
/// Allows persisting a closure of [Directory], which is a graph of
/// connected Directory messages.
fn put_multiple_start(&self) -> Box<dyn DirectoryPutter>;
}
@ -83,18 +87,18 @@ impl<A> DirectoryService for A
where
A: AsRef<dyn DirectoryService> + Send + Sync,
{
async fn get(&self, digest: &B3Digest) -> Result<Option<proto::Directory>, Error> {
async fn get(&self, digest: &B3Digest) -> Result<Option<Directory>, Error> {
self.as_ref().get(digest).await
}
async fn put(&self, directory: proto::Directory) -> Result<B3Digest, Error> {
async fn put(&self, directory: Directory) -> Result<B3Digest, Error> {
self.as_ref().put(directory).await
}
fn get_recursive(
&self,
root_directory_digest: &B3Digest,
) -> BoxStream<'static, Result<proto::Directory, Error>> {
) -> BoxStream<'static, Result<Directory, Error>> {
self.as_ref().get_recursive(root_directory_digest)
}
@ -103,7 +107,7 @@ where
}
}
/// Provides a handle to put a closure of connected [proto::Directory] elements.
/// Provides a handle to put a closure of connected [Directory] elements.
///
/// The consumer can periodically call [DirectoryPutter::put], starting from the
/// leaves. Once the root is reached, [DirectoryPutter::close] can be called to
@ -115,12 +119,12 @@ where
/// but a single file or symlink.
#[async_trait]
pub trait DirectoryPutter: Send {
/// Put a individual [proto::Directory] into the store.
/// Put a individual [Directory] into the store.
/// Error semantics and behaviour is up to the specific implementation of
/// this trait.
/// Due to bursting, the returned error might refer to an object previously
/// sent via `put`.
async fn put(&mut self, directory: proto::Directory) -> Result<(), Error>;
async fn put(&mut self, directory: Directory) -> Result<(), Error>;
/// Close the stream, and wait for any errors.
/// If there's been any invalid Directory message uploaded, and error *must*
@ -133,8 +137,10 @@ pub(crate) fn register_directory_services(reg: &mut Registry) {
reg.register::<Box<dyn ServiceBuilder<Output = dyn DirectoryService>>, super::directoryservice::ObjectStoreDirectoryServiceConfig>("objectstore");
reg.register::<Box<dyn ServiceBuilder<Output = dyn DirectoryService>>, super::directoryservice::MemoryDirectoryServiceConfig>("memory");
reg.register::<Box<dyn ServiceBuilder<Output = dyn DirectoryService>>, super::directoryservice::CacheConfig>("cache");
reg.register::<Box<dyn ServiceBuilder<Output = dyn DirectoryService>>, super::directoryservice::RouterConfig>("router");
reg.register::<Box<dyn ServiceBuilder<Output = dyn DirectoryService>>, super::directoryservice::GRPCDirectoryServiceConfig>("grpc");
reg.register::<Box<dyn ServiceBuilder<Output = dyn DirectoryService>>, super::directoryservice::SledDirectoryServiceConfig>("sled");
reg.register::<Box<dyn ServiceBuilder<Output = dyn DirectoryService>>, super::directoryservice::RedbDirectoryServiceConfig>("redb");
#[cfg(feature = "cloud")]
{
reg.register::<Box<dyn ServiceBuilder<Output = dyn DirectoryService>>, super::directoryservice::BigtableParameters>("bigtable");

Some files were not shown because too many files have changed in this diff Show more