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>
This commit is contained in:
sterni 2021-03-15 22:32:16 +01:00
parent 5b9229186f
commit 5d8490d2fc
11 changed files with 58 additions and 43 deletions

3
nix/utils/OWNERS Normal file
View file

@ -0,0 +1,3 @@
inherited: true
owners:
- sterni

24
nix/utils/default.nix Normal file
View file

@ -0,0 +1,24 @@
{ depot, lib, ... }:
let
/* Takes an attribute set and adds a meta.targets
attribute to it which contains all direct children
of the attribute set which are derivations.
Type: attrs -> attrs
*/
drvTargets = attrs:
attrs // {
meta = {
targets = builtins.filter
(x: lib.isDerivation attrs."${x}")
(builtins.attrNames attrs);
} // (attrs.meta or {});
};
in {
inherit
drvTargets
;
}

View file

@ -37,8 +37,4 @@ let
'';
};
in {
inherit
netencode
;
}
in depot.nix.utils.drvTargets netencode

View file

@ -5,7 +5,7 @@ let
name = "exec-helpers";
} (builtins.readFile ./exec_helpers.rs);
in {
in depot.nix.utils.drvTargets {
inherit
exec-helpers
;

View file

@ -125,7 +125,7 @@ let
}
'';
in {
in depot.nix.utils.drvTargets {
inherit
netencode-rs
netencode-mustache

View file

@ -52,25 +52,11 @@ let
}
'';
tests = import ./tests.nix {
inherit
depot
pkgs
lib
python-netstring
rust-netstring
toNetstring
toNetstringKeyVal
;
};
in {
in depot.nix.utils.drvTargets {
inherit
toNetstring
toNetstringKeyVal
python-netstring
rust-netstring
tests
;
}

View file

@ -1,7 +1,14 @@
{ depot, lib, pkgs, python-netstring, rust-netstring, toNetstring, toNetstringKeyVal }:
{ depot, lib, pkgs, ... }:
let
inherit (depot.users.Profpatsch.netstring)
toNetstring
toNetstringKeyVal
python-netstring
rust-netstring
;
python-netstring-test = depot.users.Profpatsch.writers.python3 {
name = "python-netstring-test";
libraries = p: [
@ -53,7 +60,7 @@ let
}
'';
in {
in depot.nix.utils.drvTargets {
inherit
python-netstring-test
rust-netstring-test

View file

@ -102,7 +102,7 @@ let
"nix-instantiate" "$1" "-A" "{}"
];
in {
in depot.nix.utils.drvTargets {
inherit
instantiate-nixpkgs-randomly
# requires hnix, which we dont want in tvl for now

View file

@ -169,7 +169,7 @@ let
'';
};
in {
in depot.nix.utils.drvTargets {
inherit
print-ast
tree-sitter-nix

View file

@ -138,19 +138,6 @@ let
];
in drvSeqL [ tests ] (crate false);
tests = import ./tests.nix {
inherit
depot
pkgs
python3
python3Lib
rustSimpleLib
rustSimple
testRustSimple
;
};
in {
inherit
python3
@ -159,6 +146,5 @@ in {
rustSimpleBin
rustSimpleLib
testRustSimple
tests
;
}

View file

@ -1,10 +1,23 @@
{ depot, pkgs, python3, python3Lib, rustSimpleLib, rustSimple, testRustSimple }:
{ depot, ... }:
let
inherit (depot.users.Profpatsch.writers)
python3Lib
python3
testRustSimple
rustSimple
rustSimpleLib
rustSimpleBin
;
inherit (depot.third_party)
coreutils
;
run = drv: depot.nix.runExecline.local "run-${drv.name}" {} [
"if" [ drv ]
"importas" "out" "out"
"${pkgs.coreutils}/bin/touch" "$out"
"${coreutils}/bin/touch" "$out"
];
pythonTransitiveLib = python3Lib {
@ -76,7 +89,7 @@ let
'');
in {
in depot.nix.utils.drvTargets {
inherit
pythonWithLib
rustTransitiveLib