summaryrefslogtreecommitdiff
path: root/Biz/Bild.nix
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2024-04-03 11:54:14 -0400
committerBen Sima <ben@bsima.me>2024-04-03 16:18:12 -0400
commit6534e188843da5a5be7342b9a2a189ccc80d3268 (patch)
tree9e400d0805d809bc4055ce636c8c1d9cd2dee8f5 /Biz/Bild.nix
parent177b2f42de0339c3ac91ee7b9a91d47bd39d3062 (diff)
Set CODEROOT dynamically in nix builds
This seems to be needed for git test to work, in particular the directory inside the nix sandbox is like '/build/<name-of-checkout-directory>' which, in the case of git test, is the name of the worktree that git-branchless uses to checkout the commit under test. This is something like 'test-worktree-2'. So, I can't hardcode anything there.
Diffstat (limited to 'Biz/Bild.nix')
-rw-r--r--Biz/Bild.nix3
1 files changed, 1 insertions, 2 deletions
diff --git a/Biz/Bild.nix b/Biz/Bild.nix
index 04be55f..24ce4bf 100644
--- a/Biz/Bild.nix
+++ b/Biz/Bild.nix
@@ -116,13 +116,12 @@ in nixpkgs // {
src = ../.;
USER = "nixbld";
HOSTNAME = "nix-sandbox";
- # this is the default sandbox path where bild will be working:
- CODEROOT = "/build/omni";
# we need to remove the $src root because bild expects paths relative to the
# working directory:
TARGET = "."
+ lib.strings.removePrefix (toString src) (toString target);
buildPhase = ''
+ export CODEROOT=$(pwd)
mkdir $out
${bild}/bin/bild --plan "$TARGET" 1> $out/analysis.json \
2> >(tee -a $out/stderr >&2)