tvl-depot/nix
sterni 16a7c4a1be feat(buildkite): avoid building extraSteps in pipeline construction
In principle we don't want to build any (later) pipeline target during
pipeline evaluation insofar they appear in extraSteps. For this reason,
we have the needsOutput mechanism which prevents the parent target of an
extraStep from being built in 🦙.

Unfortunately, this mechanism is not general purpose enough, as we use
other (i.e. non parent) targets from depot in extraSteps. As a
consequence, kind of expensive builds need to happen during pipeline
construction at the moment. The solution is to use the fact that the
command script we want to run is exposed via the readTree interface to
depot and build the script proper only when the extra step is executed.

To facilitate this, some prerequisite changes need to be made:

- We need to use a symlink different to result in case needsOutput is
  true which needs support in mkBuildCommand. We also need to avoid this
  symlink being picked up by git, as many extra steps check whether the
  tree is dirty or not. (Is there a way to have it outside the depot
  tree?)

- Since we rely on the build command printing a single store path we
  store in $command_script, we need to avoid it printing two paths
  in cases where nix-store(1) is used (nix-store(1) prints the symlink
  and readlink(1) would print the store path in a separate line).

Future work would be to remove/deprecate the needsOutput mechanism:
After this change the parent target wouldn't be built right away even if
it appeared in the script via string interpolation. Thus we could,
instead of expecting the target being available as `./result`, make our
extra steps nix-ier.

Change-Id: Idd2e88a865eadabe229ce1e05406e8cc4cb63f94
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10850
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2024-03-07 15:39:56 +00:00
..
binify style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
bufCheck chore(nix/bufCheck): remove git status check 2023-10-17 19:51:24 +00:00
buildGo chore(nix/buildGo): add support for Go 1.20+ 2024-02-12 15:58:58 +00:00
buildkite feat(buildkite): avoid building extraSteps in pipeline construction 2024-03-07 15:39:56 +00:00
buildLisp chore: remove comments formerly meant for alignment 2023-05-31 10:55:07 +00:00
buildManPages chore(gerrit): migrate OWNERS files to code-owners style 2022-09-19 11:13:28 +00:00
dependency-analyzer refactor(nix/dependency-analyzer): use unsafeDiscardOutputDependency 2022-10-20 18:21:25 +00:00
drvSeqL style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
emptyDerivation chore(gerrit): migrate OWNERS files to code-owners style 2022-09-19 11:13:28 +00:00
escapeExecline style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
getBins style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
lazy-deps feat(nix/lazy-deps): add override pattern for deps 2023-04-24 10:56:40 +00:00
mergePatch style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
netstring style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
nint chore(gerrit): migrate OWNERS files to code-owners style 2022-09-19 11:13:28 +00:00
nix-1p docs(nix-1p): clarify wording for what is an expression 2024-02-02 16:39:44 +00:00
readTree fix(nix/readTree): Fix typo in docs 2023-11-30 14:40:44 +00:00
renderMarkdown feat(nix/renderMarkdown): add optional tagfilter argument 2023-09-08 13:51:26 +00:00
runExecline style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
runTestsuite style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
sparseTree feat(nix/sparseTree): add optional name argument 2023-08-08 20:11:56 +00:00
stateMonad refactor(nix/stateMonad): optimize after 2022-10-08 10:59:45 +00:00
tag fix(nix/tag): correct no match check in discr 2022-10-09 13:25:14 +00:00
tailscale style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
utils revert(nix/utils): onlyDrvPath to get the drvPath w/o the outputs 2022-11-09 15:36:29 +00:00
writeElispBin chore(3p/sources): Bump channels and overlays 2022-04-21 16:54:07 +00:00
writeExecline style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
writers style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
writeScript style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
writeScriptBin refactor(nix): use our own writeScript(Bin) 2020-06-30 00:19:27 +00:00
writeTree feat(nix/writeTree): don't require IfD for drvs in tree 2024-02-21 20:52:20 +00:00
yants docs(yants): Update josh cloning instructions 2022-02-19 11:37:00 +00:00
OWNERS chore(gerrit): migrate OWNERS files to code-owners style 2022-09-19 11:13:28 +00:00