Commit graph

14 commits

Author SHA1 Message Date
Profpatsch
0fc1634255 feat(users/Profpatsch): init haskell exec-helpers
Mirrors the rust exec-helpers

Change-Id: I8fba49525949a8f38ca8c215e2ec7ba9d97d3bf9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6116
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2022-08-22 12:47:53 +00:00
Vincent Ambo
3d8ee62087 style(rust): Format all Rust code with rustfmt
Change-Id: Iab7e00cc26a4f9727d3ab98691ef379921a33052
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5240
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: Profpatsch <mail@profpatsch.de>
Reviewed-by: grfn <grfn@gws.fyi>
Reviewed-by: tazjin <tazjin@tvl.su>
2022-02-08 12:06:39 +00:00
Vincent Ambo
aa122cbae7 style: format entire depot with nixpkgs-fmt
This CL can be used to compare the style of nixpkgs-fmt against other
formatters (nixpkgs, alejandra).

Change-Id: I87c6abff6bcb546b02ead15ad0405f81e01b6d9e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4397
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: lukegb <lukegb@tvl.fyi>
Reviewed-by: wpcarro <wpcarro@gmail.com>
Reviewed-by: Profpatsch <mail@profpatsch.de>
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: tazjin <tazjin@tvl.su>
Reviewed-by: cynthia <cynthia@tvl.fyi>
Reviewed-by: edef <edef@edef.eu>
Reviewed-by: eta <tvl@eta.st>
Reviewed-by: grfn <grfn@gws.fyi>
2022-01-31 16:11:53 +00:00
Profpatsch
fed41f4959 feat(users/Profpatsch): set up stow for nix-home
nix-home is (hopefully) gonna be a home-manager alternative for my
home directory.

Files are symlinked into the home directory via GNU stow (since that
is a tried and tested tool), so first step is to set up the base code
for that.

Implements a small tool that reads a single environment variable and
prints it to stdout.

Change-Id: Ifa3fd9f9e1cedc52c3002196d3971b02cb840e80
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4832
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
Autosubmit: Profpatsch <mail@profpatsch.de>
2022-01-09 09:32:01 +00: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
Profpatsch
eb41eef612 chore(nix): move rustSimple from users.Profpatsch.writers
I think it’s solid enough to use in a wider context.

Change-Id: If53e8bbb6b90fa88d73fb42730db470e822ea182
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3055
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: lukegb <lukegb@tvl.fyi>
2021-04-24 10:23:55 +00:00
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
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
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
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
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
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