Commit graph

13235 commits

Author SHA1 Message Date
sterni
0e9c770972 refactor(sterni/nix/utf8): let wellFormedByte check first byte
Previously we would check the first byte only when trying to figure out
the predicate for the second byte. If the first byte was invalid, we'd
then throw with a helpful error message. However this made
wellFormedByte a very weird function.

At the expense of doing the same check twice, we now check the first
byte, when it is first passed, and always return a boolean.

Change-Id: I32ab6051c844711849e5b4a115e2511b53682baa
2021-11-25 12:15:35 +01:00
sterni
87a0aaa77d feat(sterni/nix/utf8): implement UTF-8 encoding
This implementation is still a bit rough as it doesn't check if the
produced string is valid UTF-8 which may happen if an invalid Unicode
codepoint is passed.

Change-Id: Ibaa91dafa8937142ef704a175efe967b62e3ee7b
2021-11-25 12:15:35 +01:00
sterni
9370ea5e33 chore(sterni/nix/utf8): remove decodeSafe
This is not really used anywhere and kind of useless. A better
decodeSafe would never return null and instead make use of replacement
characters to represent invalid bytes in the input.

Change-Id: Ib4111529bf0e472dbfa720a5d0b939c2d2511de5
2021-11-25 12:15:35 +01:00
Vincent Ambo
a935570a22 feat(tazjin/tverskoy): Install some more frequently used tools
... rather than nix-shelling them every time.

Change-Id: I9ab6ad67efbd6c16c7fd8cc9938d86d35f8418bc
2021-11-24 10:58:06 +03:00
Vincent Ambo
4f1249e46f refactor(readTree): Move 'drvTargets' into readTree
This function is also generally useful for readTree consumers that
have the concept of subtargets.

Change-Id: Ic7fc03380dec6953fb288763a28e50ab3624d233
2021-11-23 14:42:08 +00:00
Vincent Ambo
5cad3f7b81 refactor(readTree): Move 'gather' into readTree itself
Discovering CI targets is relevant to all readTree consumers and this
logic is not TVL-specific.

Change-Id: I81ed3d3f76a6c36119f04bee28ca995a013f0e35
2021-11-23 14:42:08 +00:00
sterni
ab92c42f59 feat(sterni/nix/utf8): allow decoding the empty string
Change-Id: I8de9cd28c822ac5befbcd16e118440cd13cd86e9
2021-11-23 14:23:41 +01:00
sterni
8615322bc8 refactor(sterni/nix/utf8): use genericClosure for decoding iteration
builtins.genericClosure is a quite powerful (and undocumented) Nix
primop: It repeatedly applies a function to values it produces and
collects them into a list. Additionally individual results can be
identified via a key attribute.

Since genericClosure only ever creates a single list value internally,
we can eliminate a huge performance bottleneck when building a list in a
recursive algorithm: list concatenation. Because Nix needs to copy the
entire chunk of memory used internally to represent the list, building
big lists one element at a time grinds Nix to a halt.

After rewriting decode using genericClosure decoding the LaTeX source
of my 20 page term paper now takes 2s instead of 14min.

Change-Id: I33847e4e7dd95d7f4d78ac83eb0d74a9867bfe80
2021-11-23 14:22:24 +01:00
Vincent Ambo
a2be05faa4 refactor(readTree): Move copy of 'fix' into readTree
This is often used when bootstrapping a repository with readTree,
before lib is available. Having this definition in readTree is more
convenient than copy&pasting it around to callsites.

Change-Id: I6d5d27ed142bea704843fe289ad2674be8c4d360
2021-11-23 12:02:53 +00:00
Vincent Ambo
18c248547d fix(3p/overlays): Downgrade Nix to stable version for nix-serve
Where I'm using stable in the non-versioning sense of the word.

https: //github.com/edolstra/nix-serve/issues/28
Change-Id: I87869a62bc0f3b289950a79aabd4d2041390bb09
2021-11-23 12:02:44 +00:00
Vincent Ambo
bc51bd99d9 refactor(readTree): Move 'restrictFolder' function into readTree
This is generally useful for readTree users and should be part of
readTree itself.

This is a move towards exposing several readTree-related features from
the library itself, in the future also including logic like 'gather'.

Note that this has a small functional change: In error messages of the
function, the notation for accessing Nix attributes is now used rather
than the Perforce-style `//` notation common in TVL.

For example, an error at `//web/tvl/logo` will produce `web.tvl.logo`
in the error message (which corresponds to the readTree attribute
itself).

This makes more sense for non-TVL consumers of readTree, as the
Perforce-style notation is custom to us specifically.

Change-Id: I8e199e473843c40db40b404c20d2c71f48a0f658
2021-11-23 14:39:54 +03:00
Griffin Smith
95ee86225b refactor(gs/xanthous): Break out inventory into a common module
Creatures are going to have an inventory too now in addition to
characters, so all the data types and lenses and stuff that define
inventory need to be broken out into a separate module so the Creature
entity can use them.

Change-Id: I83f1c70d316afaaf2e75901f9dc28f79fd2cd31f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3901
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2021-11-22 19:12:56 +00:00
Griffin Smith
3a01398672 refactor(gs/xanthous): Define local field lens aliases in AI
This slightly improves how the module reads imo

Change-Id: Ib1efcbbd5392ece6b46461e8075162f03846d421
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3886
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2021-11-22 19:12:56 +00:00
Vincent Ambo
ccb918ae97 fix(3p/overlays): Rollback Nix to 2.3 depot-wide
There is too much breakage with the newer version than I have time to
deal with right now (and I think the same goes for the others).

Change-Id: I54045d1ef16d0215e516986477d734c54e48f1f8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3904
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: lukegb <lukegb@tvl.fyi>
2021-11-22 08:02:37 +00:00
Vincent Ambo
15cb37f877 fix(ops/restic): Move whitby's backup to GleSYS object storage
Since GCP nuked us, the backups are now moving to GleSYS'
S3-compatible object storage.

This refactors the restic module to support S3-compatible storage
instead of GCP, and switches to the appropriate new secret paths.

The secrets were placed on whitby manually and I verified that the
backups work.

This fixes b/157

Change-Id: I6a9d2b0581967605ce736605a3befb44cdeae7e1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3883
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2021-11-21 12:01:26 +00:00
Griffin Smith
21c218542c fix(gs/xanthous): Check for reaching destination in AI
Because floating points, it's possible that a creature has reached their
destination even if the *progress* to that destination is at 0 - if that
happens, they should pick a new destination regardless. This fixes the
issue where creatures would occasionally get "stuck" and never move
after wandering around for a bit.

Change-Id: I01a11ce4bd448c25a818c886825e4fad56dffe03
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3885
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
2021-11-20 21:49:30 +00:00
Griffin Smith
ed0447ea0d chore(gs/emacs): Update org<->jira state mapping
Change-Id: If941c0237f5291bebe201e22cc74484f17b148ae
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3884
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
2021-11-20 21:41:10 +00:00
Griffin Smith
023d6d6a0d feat(tvl.el): Add magit-gerrit-checkout command
Add a new magit-gerrit-checkout command, which prompts for a CL number
then fetches and checks out the latest patchset of that CL with a
detached HEAD.

Change-Id: I88b8209d40017479d97ed40ecbd5fd1ccd7cf650
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3880
Reviewed-by: grfn <grfn@gws.fyi>
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2021-11-20 21:41:00 +00:00
sterni
3e256b4947 chore(3p): bump NixOS channels to 2021-11-16
Change-Id: I95572427b041f7a406bee214f5819a698d681661
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3882
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-11-19 10:54:52 +00:00
sterni
0eee1eaf51 chore(3p/overlays/tvl): drop override for sbcl
nixpkgs has upgraded to SBCL 2.1.9 in the meantime, so dropping the
override will ensure that we keep pace with upstream going forward,
instead of ending up with an out-of-date SBCL.

Change-Id: I5e04532d5ef653de4ec083deee9c9a72522daaf1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3881
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-11-16 10:37:43 +00:00
sterni
12eed85374 chore(nixpkgs-crate-holes): whitelist more maintainers
Change-Id: I6ed03ff8cbc590087cfa58264c0c28a7b1496740
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3825
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2021-11-16 10:37:43 +00:00
Vincent Ambo
d295ba2a4e chore(depot): Restrict access to targets from //corp
This folder is used for some TVL corp stuff, like the website and
maybe some documents and future projects, that are not under the same
license as the rest of depot.

To avoid accidental licensing issues, access to it is restricted to
other stuff within //corp.

In general, TVL corp projects *should* also be free software and live
outside of //corp - the folder is primarily intended for stuff that is
relevant to the company operations (also for the sake of
transparency).

Change-Id: I15e7e72e82d8ac1c875899f16becd731f64f6b3a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3875
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-11-15 13:28:42 +00:00
Vincent Ambo
ac41d89ba5 refactor(readTree): Flip argument order of argFilter
Since the filters return 'args', this makes nesting of filters more
readable.

Change-Id: I775252460e3e077cc6db2fab6f3948414a95ecbf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3873
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-11-15 12:54:32 +00:00
Vincent Ambo
dc8d3e869d refactor(depot): Generalise folder restriction readTree filter
This refactors the readTree filter which disallows access to //users
from outside of //users into a reusable function.

The only change in functionality is that the error message has changed
slightly. I thought it is useful to keep the message consistent (i.e.
always including a path), thus only a part of the error is templated
in (describing the reason for why a specific sub path is unavailable).

Change-Id: I30ad38b2677be5aa502c753c8c71e7ba3efc87be
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3872
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-11-15 12:26:41 +00:00
Vincent Ambo
81ca294877 chore(3p/overlays): Bump Emacs overlay to 2021-11-14
I'm having issues with vterm and I wonder if it's caused by something
in another package that is fixed in a newer overlay.

Change-Id: Icb89636cd6c72b10558184634b7c9a5b7b8548c5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3877
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-11-15 12:25:35 +00:00
Profpatsch
70d01b201f docs(users/profpatsch/blog): rust string conversions: &str -> &OsStr
Change-Id: I215cd311551d54ce42c71d4e80ea18f9a17d4cf8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3879
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-11-15 00:31:11 +00:00
Vincent Ambo
1ef8a6c153 feat(tazjin/tverskoy): Enable picom by default
... rather than launching it manually in a shell when I need it, which
is more often now that I have a large screen.

Change-Id: Ia526af98e513d29e70aeb093442465dce256c333
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3874
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-11-13 21:09:12 +00:00
Vincent Ambo
1cdc488f19 feat(tazjin/emacs): Disable annoying warnings from native comp
Change-Id: Ibe6bcd544188afb8746bf27a6467a436803e659f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3876
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-11-13 21:09:07 +00:00
Vincent Ambo
b28c94c101 fix(tazjin/emacs): Adjust tverskoy screen layout for TVL office
Change-Id: I4d1ad19ee5af52b7f01e1e2003a5c95b5a133865
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3871
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-11-13 16:46:18 +00:00
Griffin Smith
608e6e778e feat(gs/xanthous): Allow moving with the arrow keys
some... *ahem*... very insistent people have been asking for this,
despite the fact that it doesn't allow for diagonal movement.

Change-Id: Ic58e2435b34e27e3ed399c7b8f3bcbc1f634f6b3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3870
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
2021-11-13 15:57:18 +00:00
Griffin Smith
8d82bf2d36 fix(gs/emacs): require flycheck before trying to override it
Change-Id: I8573abc3f08d68f050d6a01ff29969f97c1d2858
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3869
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
2021-11-13 15:57:18 +00:00
Griffin Smith
1af67d9ca7 feat(gs/xanthous): Add a Husk creature, with limited generation
Add a new "husk" creature raw, limited to only being generated on levels
>= 1, including support for actually doing that limiting.

These guys are gonna get daggers next!

Change-Id: Ic4b58dc7ee36b50ced60fec6912cd1b46269d55c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3868
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
2021-11-13 15:57:18 +00:00
Griffin Smith
e2f8939a9e feat(gs/xanthous): Add a broken dagger raw
The plan is to use this as a test bed for generating creatures wielding
items, but for know it just shows up on the ground in places.

Change-Id: I8b292606f425cd41bff9e52727f1094886777102
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3867
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
2021-11-13 15:57:18 +00:00
Griffin Smith
2833104708 chore(gs/xanthous): Don't include docs in source closure
Change-Id: Ib6f2604096fa519f37ec4a2ce762229abca16b26
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3866
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
2021-11-13 15:57:18 +00:00
Griffin Smith
98397b8515 docs(gs/xanthous): Start documenting raw types
Start documenting the fields of the raw type YAML files and what they
mean, to make it easier to write new raw types.

Change-Id: I9672b757e89f1cc665d7e90078d83cfd87173d7f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3865
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
2021-11-13 15:57:18 +00:00
Griffin Smith
3c33a2c756 fix(xanthous/server): Mount the key into the docker image
mount the host key in as a single-file volume, so the server can
actually read it.

Change-Id: I5fb58536717c91480d1f4610b6fb3258a36169e0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3864
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
2021-11-13 14:47:02 +00:00
Griffin Smith
33f29d081d fix(xanthous/server): Fix decoding secret key
The actual function we want for the format we're using is
decode_secret_key, not decode_openssh, apparently - covered this with a
toneest to make sure.

Change-Id: I659226169f213b8464b96aec6b94bf13fd80aac8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3863
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2021-11-13 14:12:25 +00:00
sterni
3d4e992c6f feat(web/tvl/template): add title to derivation name
This should help when debugging template generated derivations.

Change-Id: I9958a7e67c8442c5ad97da2a9d3622a0556b6a1a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3861
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-11-13 13:28:06 +00:00
sterni
53ab5716aa fix(web/static): avoid drvHash unnecessarily inflating closures
The string context of drvPath apparently causes a derivation to
_directly_ reference the whole dependency closure of the derivation
drvPath belongs to. This not only is unnecessary in this case (since we
are using drvHash to construct HTTP URLs which are primarily contigent
on the deployed configuration and not the shape of the nix store), but
also creates a very confusing derivation (e. g. web.tvl's index.html
would *directly* reference pandoc).

Change-Id: I6e9900e9e35fbd639061e53322e4ccb3fbb7e7ec
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3862
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-11-13 13:27:59 +00:00
Profpatsch
e2fbc10ebd feat(users/Profpatsch/lens): add _ as reverse function application
Change-Id: I0bcd997ea469ff55d2170027184fc5bd10b44e00
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3847
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2021-11-13 01:22:58 +00:00
Profpatsch
d08fbd79c7 docs(users/Profpatsch/lens): setter inline arrows
Change-Id: I22bed7bc16b69f94556142cad1079e23f3550bb1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3846
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-11-13 00:57:28 +00:00
Profpatsch
539884f7ad docs(users/Profpatsch/netencode): fix typo
Change-Id: I7edb9027c0a9eb014931033760be5f3d6e734b8a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3845
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-11-13 00:57:28 +00:00
Profpatsch
8c6bf623b6 feat(users/Profpatsch/blog: inject css into markdown files
Change-Id: I72bba4bd8aa9a9fccab1fd3d618cfcfa7e0507c5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3844
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-11-13 00:57:28 +00:00
Profpatsch
850dcf615b feat(users/Profpatsch/lens): lens library for nix
Profunctor lenses for nix.

Implemented Profunctor and Strong instances for `(->)`,
and some simple setters.
Next step would be getters, which will need the `Forget` profunctor.

Fairly straightforward implementation of
https://github.com/purescript-contrib/purescript-profunctor-lenses
(with all the types erased and instance dicts passed manually).

```
> :p set (optic [_2 (field "foo") _1]) 42 (tuple 1 { foo = (tuple 1 2); })
{ fst = 1; snd = { foo = { fst = 42; snd = 2; }; }; }
```

Change-Id: Iad145523d1c035187b8b2db9302b840c282d427a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3295
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-11-13 00:57:28 +00:00
Profpatsch
b48c5c4976 feat(users/Profpatsch/blog): Add posts section
A new section for my awesome website.

Migrates an old blogpost from the github repository.

Change-Id: I5fd0c2b2679a1367015fa098e3e787bbc0cdd973
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3293
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-11-13 00:57:28 +00:00
Profpatsch
81e39b51cd feat(users/Profpatsch/blog): Add projects section
A new section for my awesome website.

Change-Id: I6c624aa0bfaf82aff943431da7499bec1d842c67
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3291
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-11-13 00:57:28 +00:00
Profpatsch
d4f4b0f6d4 docs(users/Profpatsch/blog): document symbols
… and clean up the import list a little.

Change-Id: I7a116e9bbf01731267795b5327fecf98f0c7c3e4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3286
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-11-13 00:57:28 +00:00
Profpatsch
2835e5ec7e docs(users/Profpatsch/lib): move split-stdin to lib & document
Change-Id: I39e81ed766cb209ded5309ea962a59a6f1c811c9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3285
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-11-13 00:57:28 +00:00
Profpatsch
4e2879282d chore(users/Profpatsch/blog): me -> depot.users.Profpatsch
Change-Id: I72e38ce4cef109df197eccedac8e67ec423d4996
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3284
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-11-13 00:57:28 +00:00
Profpatsch
dfdb6d8e15 chore(users/Profpatsch): move cdbListToNetencode out of the blog
It’s a small tool that I’ve used before but not anymore, but since it
has a few helpers for dealing with cdb stuff, I’m gonna keep it around
for now I guess.

Change-Id: I83c62fa2194113d021414708b0906350b3f2a222
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3283
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-11-13 00:57:28 +00:00