about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorFilesLines
2021-02-14 r/2215 feat(users/Profpatsch/writers): testRustSimple to test rust cratessterni1-1/+30
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 r/2214 feat(nix/drvSeqL): make build of a drv depend on unrelated drvssterni1-0/+43
This adds the star of NixCon 2017 from vuizvui, slightly reformatted and now using yants. While it has some flaws, I realized that it is ideal to run the tests of rustSimple{Lib,Bin} where the normal and the -tests variant would have to be rebuilt if either the tests or the library / executable itself changes. Change-Id: Ie8f84f98c51c9fafc046eff916c8f0df7e8f224b Reviewed-on: https://cl.tvl.fyi/c/depot/+/2528 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-13 r/2213 fix(users/Profpatsch/netencode/gen/dwim): support derivationsProfpatsch1-5/+9
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 r/2212 fix(users/Profpatsch/lib/eprintenv): don’t crash when env is missingProfpatsch1-1/+4
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 r/2211 chore(users/Profpatsch/netencode): move nom dependencies to pkgsetProfpatsch2-23/+24
Change-Id: I7393f60e4b29f24399d681d4546ac35140650d1a Reviewed-on: https://cl.tvl.fyi/c/depot/+/2524 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-13 r/2210 feat(users/Profpatsch/netencode/record-splice-env): ignore non-scalProfpatsch1-3/+8
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 r/2209 feat(users/Profpatsch/netencode): add dec::TryProfpatsch1-5/+13
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 r/2208 feat(users/Profpatsch/lib): add runInEmptyEnvProfpatsch1-0/+11
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 r/2207 feat(users/Profpatsch/execline/exec_helpers): add args()Profpatsch2-1/+11
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 r/2206 feat(users/Profpatsch/execline/exec_helpers): add no_args()Profpatsch2-0/+11
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 r/2205 feat(users/Profpatsch/netencode): add record-getProfpatsch1-0/+30
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 r/2204 fix(users/Profpatsch/arglib): remove env var after readProfpatsch1-2/+4
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 r/2203 fix(users/Profpatsch/execline/exec_helpers): fix arg loop off-by-1Profpatsch1-1/+1
Change-Id: If20a91eaa6693ba35ce645b104c625dbd0c71726 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2500 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-12 r/2202 feat(nix/yants/tests): test drv typesterni1-0/+10
By using an extremely trivial derivation we can ensure that it will not throw if evaluated using deepSeq. When using stdenv.mkDerivation or similar at some point something will most likely throw or generate some kind of error which is alright in the context of nixpkgs, but makes testing yants harder than you'd think it should be. Change-Id: I61ff7dc01a00a4815ef39066e4e223123356ddd5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2507 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2021-02-10 r/2201 fix(ops/www/tazj.in): Force SSL for git.tazj.in redirectVincent Ambo1-0/+1
Change-Id: If5b8096cb693d96936f9b954e2ebe3dc9b63af66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2521 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2021-02-10 r/2200 fix(ops/www/tazj.in): Redirect git.tazj.in to our cgitVincent Ambo1-0/+5
Change-Id: Ia0be95e2618aeb4f8d394a8e3602c73faec0d72f Reviewed-on: https://cl.tvl.fyi/c/depot/+/2508 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2021-02-09 r/2199 feat(nix/yants/tests): port to runTestsuitesterni1-48/+92
Port existing tests to runTestsuite and add some obvious additional tests that wouldn't be possible before (using assertThrows and assertEq). Change-Id: Ibe950a7a0cda3e23ebb226bdff35f52cdfec5ddf Reviewed-on: https://cl.tvl.fyi/c/depot/+/2479 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de> Reviewed-by: tazjin <mail@tazj.in>
2021-02-09 r/2198 feat(nix/runTestsuite): add assertDoesNotThrowsterni1-0/+7
assertDoesNotThrow is like assertThrows, but fails if the expression throws. In that case the new unexpected-throw branch of AssertErrorContext is returned. Change-Id: I7195eb5df8965456e9ab9b69e35ec96b33f00a35 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2476 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-09 r/2197 refactor(nix/runTestsuite): implement in terms of generic assertBoolsterni1-26/+46
Refactor assertEq and assertThrows to be implemented in terms of a more generic assertBool to reduce code duplication and ease adding new assert types. To preserve meaningful error messages AssertResult is changed slightly: nope-eq and nope-throw have been replaced by a single nope branch which contains an AssertErrorContext which contains error information. To implement an assert assertBoolContext (which is not exposed) can be used: It takes an AssertErrorContext which is returned in case of an error and a boolean determining whether the assert was successful. The currently possible AssertErrorContext are: * should-throw: error result of assertThrows, formerly nope-throw * not-equal: error result of assertEq, formerly nope-eq Change-Id: Ifd6b3aa4187c90c3add2df63fa7c906c8f03fd2d Reviewed-on: https://cl.tvl.fyi/c/depot/+/2473 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-09 r/2196 feat(users/Profpatsch): add sterni to my user dir OWNERSProfpatsch1-0/+1
\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 r/2195 feat(users/Profpatsch/read-http): use netencode::dec for arglibProfpatsch1-14/+13
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 r/2194 feat(users/Profpatsch/netencode): add dec::{Text,Binary,OneOf}Profpatsch1-6/+60
`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 r/2193 fix(users/Profpatsch/netencode/gen: fix number generatorProfpatsch1-2/+2
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 r/2192 feat(users/Profpatsch/arglib): use exec_helpers for rustProfpatsch3-9/+11
Change-Id: I3056385eb11e45ae13456f4c47052651ba5fb62f Reviewed-on: https://cl.tvl.fyi/c/depot/+/2496 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-09 r/2191 feat(users/Profpatsch/netencode): add `U::to_t()`Profpatsch1-7/+32
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 r/2190 feat(users/Profpatsch/netencode): add `dec::RecordDot`Profpatsch2-6/+29
`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 r/2189 feat(users/Profpatsch/netencode): add `dec::AnyU` as idProfpatsch1-0/+26
Change-Id: I3037882dff15243bd7a5c1c78331f8e2ffdbda84 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2493 Reviewed-by: Profpatsch <mail@profpatsch.de> Tested-by: BuildkiteCI
2021-02-06 r/2188 feat(users/Profpatsch/netencode): decode from UProfpatsch2-27/+28
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 r/2187 feat(users/Profpatsch/netencode): `encode()` impl for T and UProfpatsch2-5/+46
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 r/2186 feat(users/Profpatsch/{netencode,http-parse}): use HashMapProfpatsch3-30/+48
`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 r/2185 fix(users/Profpatsch/execline): fix exec_into_args off-by-1Profpatsch1-2/+2
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 r/2184 feat(users/Profpatsch/netencode): nest Us in U::ListProfpatsch1-32/+18
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 r/2183 fix(users/Profpatsch/netencode): decode U::Text directly into strProfpatsch2-15/+15
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 r/2182 fix(config): remove ciBuilds inheritsterni2-3/+3
The ciBuilds attribute seems to no longer exist and it breaks the evaluation of the config attribute. It's only appearance was in besadii which doesn't actually use the attribute. Removing the ciBuilds inherit fixes these issues. Change-Id: Ibbf3413ba6efe10ad868cf57cf0711d574860f97 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2487 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2021-02-06 r/2181 fix(users/Profpatsch/netencode-rs-tests): reflect changed T::List typesterni1-1/+1
a044a870849d03b3a71df17e589112e0c228a06e 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 r/2180 fix(users/Profpatsch/netencode_mustache): add arglib crate to depssterni1-0/+1
Seems like 5d44df3af65767e731c0dd239bd1d9664edbb361 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-02 r/2179 docs(tvix): fix path in build instructions, add note about testssterni1-1/+4
Change-Id: If9dcd8e39f416c11460e66454df9f53096691699 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2484 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2021-02-02 r/2178 fix(tvix/libexpr): backport fix for functionArgs failing on primopssterni5-3/+18
Nix internally differentiates between lambdas and primops, but their type in the nix expression language is the same (lambda). The implementation of builtins.functionArgs only checks if the given expression is of type tLambda and fails if the type is tPrimop or tPrimopApp which are also functions. This most notably breaks lib.generators.toPretty when called on a builtin making for example yants fail if a primop is typechecked and an error message is generated. This fix generates an empty set for primops like for plain lambdas and is based upstream commit b2748c6e99239ff6803ba0da76c362790c8be192. Additionally we add to two tests: * eval-okay-functionargs now includes a few test cases checking that builtins.functionArgs always returns an empty set for builtins and also works as expected for normal functions. * eval-okay-types now also checks if builtins are functions. Future work would be to make builtins.functionArgs work as users would expect for builtins like builtins.fetchurl, builtins.fetchGit etc. which take a set as an argument. These currently don't register as formal arguments, but it would be an usability improvement at least if they did. See also https://github.com/NixOS/nix/pull/3626#issuecomment-698546704 Change-Id: I2bf4cb80d44a4b72ade13d3e0dbd7dfb1d049f32 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2477 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de> Reviewed-by: glittershark <grfn@gws.fyi>
2021-02-01 r/2177 chore(3p/gerrit_plugins): fix fixed-output sha256 of checksterni1-1/+1
Once again the sha256 of the fetchgit fixed output derivation for check changed which was brought to light by the recent GC on whitby. Change-Id: Ib3c3b5b489717ac6d73631282f27e4363d4ac5c1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2481 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2021-01-31 r/2176 feat(users/Profpatsch): add die_* helpers for semantic exit errorsProfpatsch5-28/+80
There is this semantic exit code schema championed by execline and skaware tooling, and we refined and documented it a bit in lorri https://github.com/nix-community/lorri/blob/d1d673d42090f0cfe8ab9b92b465315a9e7d30a3/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 r/2175 feat(users/Profpatsch/execline): add args_for_execProfpatsch3-25/+50
`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 r/2174 fix(users/Profpatsch/read-http): actually parse asciiProfpatsch3-3/+12
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 r/2173 feat(users/Profpatsch/netencode): add record-splice-envProfpatsch1-0/+25
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 r/2172 feat(users/Profpatsch/netencode): add decoder moduleProfpatsch1-0/+46
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 r/2171 feat(users/Profpatsch/execline): add exec helpersProfpatsch1-0/+27
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 r/2170 refactor(users/Profpatsch/netencode): rust read from stdin helperProfpatsch1-1/+13
Change-Id: I195c0212e224f676de5db37807731b814f99e818 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2452 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-01-31 r/2169 refactor(users/Profpatsch/read-http): parse headers as utf8Profpatsch1-9/+11
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 r/2168 fix(users/Profpatsch/lib): eprintenv should exec into progProfpatsch1-1/+1
Change-Id: I2eab4ce24871121381011c1cfc8ef5e042502cb2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2450 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-01-31 r/2167 refactor(users/Profpatsch): move arglib_netencode into its own libProfpatsch2-21/+43
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-30 r/2166 feat(nix): add nix.tag, a way of discriminating via tagged unionsProfpatsch2-0/+237
Introduces the concept of a “tag”, a single-keyed attrset which annotates a nix value with a name. This can be used to implement tagged unions (by implying the list of possible tags is well-known), which has some overlap with how `nix.yants` does it. However, the more fascinating use-case is in concert with a so-called discriminator, `match` and hylomorphisms. The discriminator can take a nix value, and add tags to it based on some predicate. With `match`, we can then use that information to convert the discriminated values again. With `hylo`, we can combine both the “constructive” discriminator step with the “destructive” match step to recursively walk over a nix data structure (based on a description of how to recurse, e.g. through attrset values or list values), and then apply a transformation in one go. Change-Id: Ia335ca8b0881447fbbcb6bcd80f49feb835f1715 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2434 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>