Commit graph

71 commits

Author SHA1 Message Date
sterni
5d8490d2fc feat(users/Profpatsch): build attrset members on CI
Setting meta.targets to include all derivations in the different package
sets in Profpatsch's user folder makes them checked by CI until they do
the readTree refactor as promised.

To reduce code duplication we handle this in a simple function which is
exposed from nix.utils which may be a good place for depot specific bits
and bops we accumulate over time.

To get around the issue of too nested sets we perform the following
renames:

* users.Profpatsch.tests gets moved into its own directory
* users.Profpatsch.arglib.netencode now lives in its own file instead of
  the default.nix
* users.Profpatsch.netstring.tests gets moved into its own directory

Change-Id: Icd039c29d7760a711c1c53554504d6b0cd19e120
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2603
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-03-15 22:16:19 +00:00
Profpatsch
851e32cfe7 feat(users/Profpatsch/advent-of-code): 2020 day 04
Change-Id: I422e43f33737ef4d8e250634fa68926ae340206a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2580
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-03-01 23:26:25 +00:00
Profpatsch
ace8c656be feat(users/Profpatsch): add advent of code 2020 day 1 2 3
Change-Id: I99d2882ac9ef5ede85032132f6727e7bad8f24eb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2564
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-27 20:48:53 +00:00
sterni
ee9da33576 chore(users/Profpatsch/netencode): update serde
Was messing around with serde and trying to build serde_json something,
might as well commit this.

Change-Id: I60f87aa3180f750fa171eca7f9c375ed053f8456
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2537
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-18 19:42:21 +00:00
sterni
fa99c128f8 test(users/Profpatsch/writers): use testRustSimple on transitive lib
This adds a trivial test case on the transitive lib in tests and builds
it by wrapping in with testRustSimple. This should check:

* testRustSimple doesn't change the output and other packages can just
  use it as a normal dependency
* tests are built and executed

Change-Id: Ia4ea7425432b8b0da09f63054f51f0c480300aa4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2531
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-14 12:40:06 +00:00
sterni
f8c92f4118 feat(users/Profpatsch/netencode-rs): run tests with testRustSimple
The rust tests are now automatically built and run if
users.Profpatsch.netencode-rs is built without changing the content of
its output. users.Profpatsch.netencode-rs-tests has been removed in
favor of this, but can still be accessed as

    builtins.head users.Profpatsch.netencode.netencode-rs.drvDeps

Change-Id: I25e8191f5b9efa08ace4a584a75978565c79d8d0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2530
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-14 12:40:06 +00:00
sterni
beed354904 feat(users/Profpatsch/writers): testRustSimple to test rust crates
testRustSimple is intended to wrap rustSimpleLib and rustSimpleBin and
theoretically pkgs.buildRustCrate with { buildTests = false; } while
building and running their tests, making them fail if the tests don't
succeed.

This is implemented using nix.drvSeqL which is a perfect fit here:

* { buildTests = true; } only returns an output with the test binaries
  and does not actually run the tests. With drvSeqL we can easily wrap
  this derivation.
* { buildTests = true } doesn't contain anything other derivations want
  to depend on, so it is an derivation output we don't want to have.
  drvSeqL hides the tests derivation away and only requires us to build
  it once.
* Usually drvSeqL has the issue that tests (or advantage) are not rebuilt
  if the test derivation changes. This is no question in this case as
  due to the embedded nature of Rust's test, both the derivation with
  and without tests change anyways regardless of which part was changed.

Future work: Allow injecting other tests?

Change-Id: If6ecfb3a360ce059320dbb05642b391b617aede7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2529
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-14 12:40:06 +00:00
Profpatsch
5a08316a3c fix(users/Profpatsch/netencode/gen/dwim): support derivations
We forgot the special casing of derivations; if we recurse into a
derivation like we’d recurse into an attrset, it always ends in tears,
so dwim will just print the derivation path instead, which is usually
what you want anyway.

Change-Id: Ieed1b68dfcf8f2925ee3a75ae4f460fa5081da28
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2526
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2021-02-13 20:00:23 +00:00
Profpatsch
18e6db0f21 fix(users/Profpatsch/lib/eprintenv): don’t crash when env is missing
eprintenv is a debugging tool, as such the code should probably not
crash when the environment variable we want to look at is missing.
But we can print a warning instead.

Change-Id: I41a24dc0c1cc488587563b85c1adbd089dd364f2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2525
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-13 20:00:23 +00:00
Profpatsch
d6bca70840 chore(users/Profpatsch/netencode): move nom dependencies to pkgset
Change-Id: I7393f60e4b29f24399d681d4546ac35140650d1a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2524
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-13 20:00:23 +00:00
Profpatsch
708f17d49b feat(users/Profpatsch/netencode/record-splice-env): ignore non-scal
The headers are not a scalar, so record-splice-env doesn’t know how to
convert them to an envvar; let’s just ignore everything that can’t be
converted to a scalar for now.

Change-Id: I74ed0aa942fcd26beb058705830bc2f2b516e93e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2523
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-13 20:00:23 +00:00
Profpatsch
1d752f031b feat(users/Profpatsch/netencode): add dec::Try
Tries to decode the inner type, turning it into an Option.

Change-Id: I29d1286fe873c28d7c4a4b71f220acaf2d23f8e1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2522
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-13 20:00:23 +00:00
Profpatsch
1b706b5ae3 feat(users/Profpatsch/lib): add runInEmptyEnv
Small helper that empties out the environment, except for the given
list of variables.

Change-Id: I5e265496aaa5c248136318aa1c6cd91a67d3f028
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2506
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-13 20:00:23 +00:00
Profpatsch
81122c1297 feat(users/Profpatsch/execline/exec_helpers): add args()
Some programs need an exact amount of arguments, and we want to fail
if they get too many or not enough.

Change-Id: Ic703949f38780718f26118b896e7c7d7aa5553d9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2504
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-13 20:00:23 +00:00
Profpatsch
060600f0d7 feat(users/Profpatsch/execline/exec_helpers): add no_args()
Some programs don’t need any arguments, so fail if they do get them,
because that’s usually a bug.

Change-Id: I28639056d3d9cea0cc0e7fcbfa42120c4f129c8c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2503
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-13 20:00:23 +00:00
Profpatsch
1e5baa0dea feat(users/Profpatsch/netencode): add record-get
Projecting into one record field of netencode given on stdin.

Change-Id: I975bd5558a06988aa159156ca73a449710db983f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2502
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-13 20:00:23 +00:00
Profpatsch
7a4aca42ad fix(users/Profpatsch/arglib): remove env var after read
arglib should remove its arguments after reading it, to prevent them
from leaking to any child processes.

Change-Id: Ifc107b1620b8e407bad6b3d0ad7f4728856ec2ba
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2501
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-13 20:00:23 +00:00
Profpatsch
4d9e5d8e47 fix(users/Profpatsch/execline/exec_helpers): fix arg loop off-by-1
Change-Id: If20a91eaa6693ba35ce645b104c625dbd0c71726
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2500
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-13 20:00:23 +00:00
Profpatsch
03f1fefc72 feat(users/Profpatsch): add sterni to my user dir OWNERS
\o/

Change-Id: I4cc93ccc834bee4301ae6369e53f65ab975d4ea9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2505
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-09 20:46:30 +00:00
Profpatsch
2f3e4ec3ca feat(users/Profpatsch/read-http): use netencode::dec for arglib
Interestingly, the code is not any shorter, but a lot more
declarative, and all parsing footwork and error message generation is
done by the `Decoder` trait. \o/

Change-Id: Idb1064a3b5198e38e06e1860d4d71054ae53bbb9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2499
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-09 01:36:27 +00:00
Profpatsch
fd0d0764ec feat(users/Profpatsch/netencode): add dec::{Text,Binary,OneOf}
`Text` and `Binary` should be self-explaining, they just match on the
primitive and throw an error otherwise.

OneOf is cool, because it allows the user to match on the
result type of decoding `inner`, and give a list of values that should
be allowed as the result type (the associated type `A` in the
`Decoder` trait).

Change-Id: Ia252e25194610555c17c37640a96953142f0a165
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2498
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-09 01:36:27 +00:00
Profpatsch
8ff77f0b9f fix(users/Profpatsch/netencode/gen: fix number generator
Shouldn’t use the netstring function, since that adds the length of
the containing string, which doesn’t make sense for numbers, they just
have their one length number and content.

Change-Id: I5591f6dd59154c5ef38d6e9b7300d19884a2d57b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2497
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-09 01:36:27 +00:00
Profpatsch
60b79b2d9d feat(users/Profpatsch/arglib): use exec_helpers for rust
Change-Id: I3056385eb11e45ae13456f4c47052651ba5fb62f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2496
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-09 01:36:27 +00:00
Profpatsch
9fe1db6193 feat(users/Profpatsch/netencode): add U::to_t()
This fell out of us moving the `U::List` to a `Vec`.

I noticed that now we have deep recursion for `U`s, which originally
wasn’t intended; reverting to contain `&[u8]` might be a good
experiment, as long as the lists stay a `Vec<&'a [u8]`, which was the
thing preventing us from parsing lists without allocating memory.

Change-Id: I4900c5dea460fa69a78ce0dbed5708495af5d2e1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2495
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-09 01:36:27 +00:00
Profpatsch
7d9c30ab3d feat(users/Profpatsch/netencode): add dec::RecordDot
`dec::RecordDot` accesses a specific field of a netencode record.

In order to implement this, either we’d have to introduce a type-level
string, but in all honesty this kind of typelevel circlejerking never
leads anywhere, so let’s change the trait to use `&self` after all.
Usage is pretty much the same, except actually more like you’d expect.

Change-Id: I5a7f1a3f587256c50df1b65c2969e5a7194bba70
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2494
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-09 01:36:27 +00:00
Profpatsch
3226e6243f feat(users/Profpatsch/netencode): add dec::AnyU as id
Change-Id: I3037882dff15243bd7a5c1c78331f8e2ffdbda84
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2493
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2021-02-09 01:36:27 +00:00
Profpatsch
3faf5b6f09 feat(users/Profpatsch/netencode): decode from U
Since we don’t necessarily need to decode deeply, we can make the
decoders take a `U` instead of a `T`.

Change-Id: I9704a21edb3922d58411e6807d027d684b18d390
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2492
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-06 22:29:21 +00:00
Profpatsch
32a5312dd8 feat(users/Profpatsch/netencode): encode() impl for T and U
Also change the toplevel `encode()` to take a `&U` instead of an owned
`U`.

Change-Id: I8e51540cc531e70ae1c94e3676f4dd88da7a924d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2491
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-06 22:29:21 +00:00
Profpatsch
e207785e1f feat(users/Profpatsch/{netencode,http-parse}): use HashMap
`U::Record` is required to be a hash map (later keys should be
ignored), so why not do the hash map immediately.

This surfaced a problem with read-http, because duplicate headers in
http are possible, but before they’d be silently ignored.
Now we merge them into a `U::List` in case, to be handled by
consumers of read-http.

Change-Id: Ifd594916f76e5acf9d08e705e0dec2c10a0081c9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2490
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-06 21:38:57 +00:00
Profpatsch
7d28f121c7 fix(users/Profpatsch/execline): fix exec_into_args off-by-1
We expect the users to pass an actual prog, not an argv, so 0 is the
program to exec into.

Also improve the exec error, by including the program we tried to exec
into (the rust IO error doesn’t contain the name).

Change-Id: I664f9f717e4f82bfc1b1da3bd7114124b7582d5f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2489
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2021-02-06 21:38:57 +00:00
Profpatsch
42974ddd64 feat(users/Profpatsch/netencode): nest Us in U::List
Earlier we left the next level of values unencoded, since lists are
just concatenated netencode values. But I noticed that you can’t write
e.g. a `t_to_u` function, because only in the case of lists you need
to allocate memory.

Turns out that if we read the next level of values, everything is
handled the same as in `Record` and things suddenly start working.

We can also throw away some of the strange and ad-hoc parser helpers
we needed before, `skip` and `list_take`, since now those are just
normal `Vec::iter().skip()` and take.

Change-Id: Ibc476e028102944a65c2b64621047086cfc09aa5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2488
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2021-02-06 19:43:06 +00:00
Profpatsch
14f9a22f46 fix(users/Profpatsch/netencode): decode U::Text directly into str
Since `Text` is a scalar, it doesn’t make sense to delay the utf-8
verification to the consumer.

Change-Id: I36e4d228fbf35374d7c1addb4b24828cf6e927e5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2478
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-06 19:43:06 +00:00
sterni
96edc545de fix(users/Profpatsch/netencode-rs-tests): reflect changed T::List type
a044a87084 removed boxes in T::List, but
the tests were not adjusted accordingly.

Seems like netencode fell victim to CI not recursing into attrsets not
generated by readTree in pipeline generation.

Change-Id: I65d58a82881059983f7d6bc7a32263c6671ccbba
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2486
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2021-02-06 17:52:01 +00:00
sterni
716bbb70f9 fix(users/Profpatsch/netencode_mustache): add arglib crate to deps
Seems like 5d44df3af6 forgot to add the
newly split out crate to the dependencies of netencode_mustache.

CI didn't pick up on it since it is hidden away from readTree in an
attrset in a file.

Change-Id: I7df9a636d849de48a99562d1cda8c0e6765f4781
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2485
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-06 17:51:51 +00:00
Profpatsch
492b79ec7a feat(users/Profpatsch): add die_* helpers for semantic exit errors
There is this semantic exit code schema championed by execline and
skaware tooling, and we refined and documented it a bit in lorri
d1d673d420/src/ops/mod.rs (L24-L35)
in the past.

This just transcribes the error messages into simple helper functions.

Applies the functions to the places where we would panic or die
`sys::exit()` instead.

Change-Id: I15ca05cd6f99a25a3378518be94110eab416354e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2475
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-01-31 16:06:25 +00:00
Profpatsch
83634341aa feat(users/Profpatsch/execline): add args_for_exec
`exec_into_args` would just read argv and exec into it, but we want to
be able to write commands which take some positional arguments first.

Thus we split the invocation into `args_for_exec`, which returns the
positional arguments and prog, and then pass prog to `exec_into_args`
when we want to exec eventually (prog is still an iterator at this
point).

Change-Id: I0b180c1a100b96363fe33ba2c42034ed41716b7a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2474
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-01-31 16:06:25 +00:00
Profpatsch
f0579313d3 fix(users/Profpatsch/read-http): actually parse ascii
There might be exploits since we parsed the headers as utf8 even
though we actually want to interpret them as ASCII.

This fixes it, by using the ascii crate.

Thanks to @sterni for noticing.

Change-Id: I50b6a588d99b34e677cb22968cf0dfd8b331d11c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2457
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2021-01-31 11:10:00 +00:00
Profpatsch
cf3aab3b78 feat(users/Profpatsch/netencode): add record-splice-env
Splice a netencode record from stdin into the environment.

Change-Id: I7eac19e18164e070e4463ee431d9b0e955857b9c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2454
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-01-31 11:10:00 +00:00
Profpatsch
3877243211 feat(users/Profpatsch/netencode): add decoder module
Decoders are implemented not directly on output types, but on trivial
proxy types, so that we can easily combine those into a decoder, and
then the associated type is the actual return value of the decoder.

Change-Id: Ibce98fa09fc944e02ab327112ec7ffbc09815830
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2455
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-01-31 11:10:00 +00:00
Profpatsch
06f4b75a18 feat(users/Profpatsch/execline): add exec helpers
Most tools end by execing into their argv, so here’s a small rust
function which does the boilerplate.

Change-Id: I9748955cf53828e02f04d7e8d74fbaf10c1158b5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2453
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-01-31 11:10:00 +00:00
Profpatsch
ca52b29078 refactor(users/Profpatsch/netencode): rust read from stdin helper
Change-Id: I195c0212e224f676de5db37807731b814f99e818
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2452
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-01-31 11:10:00 +00:00
Profpatsch
f05bece2cb refactor(users/Profpatsch/read-http): parse headers as utf8
Headers should always be ASCII, so let’s crash if they are not. The
thing gets a lot easier to use, and clients who fail this restriction
can just fuck off.

Also actually print the results to stdout instead of stderr …

Change-Id: I782c96c537ae11b541175e96453c4114e0a71b05
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2451
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-01-31 11:10:00 +00:00
Profpatsch
ef743ffbb5 fix(users/Profpatsch/lib): eprintenv should exec into prog
Change-Id: I2eab4ce24871121381011c1cfc8ef5e042502cb2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2450
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-01-31 11:10:00 +00:00
Profpatsch
5d44df3af6 refactor(users/Profpatsch): move arglib_netencode into its own lib
arglib is the simple idea of passing structured data via a
conventional environment variable instead of implementing an optparser
for every little tool.

Pop the envvar, decode the contents, return the contents.

Change-Id: Ie44148293a58aae9a0a613895176227d43b491bb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2449
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-01-31 11:10:00 +00:00
Profpatsch
1fb5a17f14 feat(users/Profpatsch): add read-http
reads a http request or response from stdin, and parses its headers
into a netencoded record.

Darn rust code took way too long to write.

Change-Id: Ie99faa6d4bbd4996fa4e43fb119a11d85b611c99
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2447
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2021-01-27 13:41:18 +00:00
Profpatsch
f68781da1b chore(users/Profpatsch/netencode): netencode.nix -> gen.nix
Change-Id: I7ccbfe863fbff65015caa8c740b80c4bb5c59dc1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2446
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2021-01-27 13:41:18 +00:00
Profpatsch
b725e9b7e4 feat(users/Profpatsch/netencode): add dwim function to nix gen
Basically what you expect, strings to text, ints to 64-bit integers,
attrs and lists to nested records and lists.

Change-Id: I9d3d841f32ab32a152cd61522f02ebde4a9b11d3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2444
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2021-01-27 13:41:18 +00:00
Profpatsch
a044a87084 fix(users/Profpatsch/netencode): remove Boxes in AST struct
Apparently HashMap and Vec already do internal boxing, so the extra
indirection in the value isn’t needed.

Then, in order to make things uniform, move the boxing of `Sum` into
the `Tag` value. No extra boxing in the recursion! \o/

Change-Id: Ic21d2e3e6ac0c6e1f045bf2c9d3e9c5af446fcff
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2443
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2021-01-27 13:41:18 +00:00
Profpatsch
81d5571398 feat(users/Profpatsch/netencode): rename spec -> README
Change-Id: I0afda1c3705b8789cf6a0c57f7b74d005deb4ff5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2433
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2021-01-23 15:37:26 +00:00
Profpatsch
222016a174 feat(users/Profpatsch/netstring): add README
Change-Id: I2b5e74f376ac2212ec12fd85267e115621095639
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2432
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2021-01-23 15:33:50 +00:00