feat(.envrc): gcroot third_party.sources

This is a bit slower than I'd like, but acceptable.

Change-Id: I419b3c49201540de9d0ade1c6c2ac97758d8a811
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6576
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
sterni 2022-09-13 22:18:06 +02:00
parent ee1f62f5e5
commit 16da548f93
3 changed files with 17 additions and 2 deletions

15
.envrc
View file

@ -1,7 +1,18 @@
# Create a gcroot that keeps all third_party.sources alive
nix-build --out-link .gcroots/sources -E '
with import ./. {};
third_party.nixpkgs.writeText "depot-3p-sources.txt" (
toString (
builtins.map (s: s.outPath or null) (
builtins.attrValues third_party.sources
)
)
)'
# Configure the local PATH to contain tools which are fetched ad-hoc
# from Nix.
out=$(nix-build -A tools.depot-deps --no-out-link)
out=$(nix-build -A tools.depot-deps --out-link .gcroots/depot-deps)
PATH_add "$out/bin"
watch_file tools/depot-deps.nix
watch_file third_party/sources/sources.json

1
.gcroots/.skip-subtree Normal file
View file

@ -0,0 +1 @@
these are just symlinks to prevent Nix from gc-ing paths we'd like to keep

3
.gitignore vendored
View file

@ -2,6 +2,9 @@
# trash locally that might be valuable in the future.
garbage/
# Nix gcroot symlinks created by .envrc
/.gcroots/*
# Ignore Nix result symlinks
result
result-*