Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working build #4

Merged
merged 2 commits into from
Sep 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,17 @@ cp -r "$ekamSrc" ekam
chmod -R u+w ekam
cd ekam
mkdir -p deps
ln -s "$capnprotoSrc" deps/capnproto
# A single capnproto test file expects to be able to write to
# /var/tmp. We change it to use /tmp because /var is not available
# under nix-build.
cp -r "$capnprotoSrc" deps/capnproto
chmod u+w deps/capnproto/c++/src/kj -R
sed -i 's/\/var\/tmp/\/tmp/g' deps/capnproto/c++/src/kj/filesystem-disk-test.c++
# Turn off the purity check because it doesn't fare well with ekam.
# This is also done in a handful of other expressions in nixpkgs. See
# discussion at https://github.com/NixOS/nixpkgs/issues/13532 and at
# https://github.com/zenhack/ekam-nix/pull/4
unset NIX_ENFORCE_PURITY
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is going to be our solution, I think it could stand a comment explaining what the issues/with links to relevant docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I can link to that previous issue (and perhaps this one), but I really have no deep understanding of what is going on so far. I figured this out by noticing that builder.sh fails under nix-shell but succeeds if the line . "$stdenv/setup" is commented out (#2). So I ran the following script under nix-shell

set > env-pre
. "$stdenv/setup"
set > env-post

... diffed the outputs, and then manually set the environment variables that were different. I bisected them (started by commenting out half of the lines) and after a few such rounds determined that NIX_ENFORCE_PURITY alone is causing the issues. Interestingly, the linked issue is pretty much the first thing that comes up when searching the internet for that identifier. I had found that issue previously, but thought it must have been closed for good reason.

Also, while the current workaround is good enough to get ekam to build, I suspect that ekam is unlikely to be able to build anything else unless the user were to unset NIX_ENFORCE_PURITY before invoking ekam in that build as well.

Copy link
Contributor Author

@garrison garrison Sep 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, there are a handful of other expressions in nixpkgs that either unset NIX_ENFORCE_PURITY or set it to the empty string. So maybe my solution is an acceptable one after all.

make
mkdir $out
cp -r bin $out