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

Simplify nix_file_deps checking #86

Merged
merged 2 commits into from
Jul 20, 2019
Merged

Simplify nix_file_deps checking #86

merged 2 commits into from
Jul 20, 2019

Conversation

mboes
Copy link
Member

@mboes mboes commented Jul 20, 2019

To check that dependencies of nix_file_deps are correctly declared, we
copy all declared dependencies into the external repository directory. If
any dependencies were missed, then nix evaluation will fail.

To test that this really works, remove the

   nix_file_deps = ["//tests:pkgname.nix"],

line in @nix-file-deps-test. I tried writing a failure test for this
using Skylibs analysistest framework, but that doesn't seem to work for
failures in external repositories.

Like #76, this likewise closes #74, but in a simpler way.

Closes #84

To check that dependencies of `nix_file_deps` are correctly declared,
we copy all declared dependencies into the external repository
directory. If any dependencies were missed, then nix evaluation will
fail.

To test that this really works, remove the

```
    nix_file_deps = ["//tests:pkgname.nix"],
```

line in `@nix-file-deps-test`. I tried writing a failure test for this
using Skylibs `analysistest` framework, but that doesn't seem to work
for failures in external repositories.

Like #76, this likewise closes #74, but in a simpler way.
@mboes mboes requested a review from guibou July 20, 2019 13:13
Copy link
Contributor

@guibou guibou left a comment

Choose a reason for hiding this comment

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

LGTM

@mboes mboes merged commit a3475b7 into master Jul 20, 2019
@mboes mboes deleted the hermetic-nix-deps branch July 20, 2019 15:53
mboes added a commit that referenced this pull request Apr 12, 2020
Historically, the user was able to see the output of `nix-build` in
real-time. This was useful, because building derivations can take
a long time. Even if the binary cache can be used for all derivations,
downloading can take a long time. Then #77 came along, which made
`nix-build` quiet as a side-effect. Later, #86 subsumed #77 with
a simpler implementation. However, people argued in #82 that being
quiet is the right thing to do, because otherwise workspace rule
output can garble the output of `bazel query` and break scripts. So we
stuck to quiet output and this was called out in the v0.6 changelog.

It turns out that the problem affects other rule authors too (see
bazel-contrib/rules_nodejs#583). This led to bazelbuild/bazel#10611,
which fixes the problem for everyone, and shipped in Bazel 3.0. Now,
all workspace rule output goes to `stderr`, so scripts calling `bazel
query` shouldn't be affected.

Given this upstream change, my position is that being verbose is now
the right thing to do. If #85 is implemented, then being verbose
should remain the default, at least for users of Bazel 3.0 onwards.
Because even small packages may have a large set of dependencies that
must be downloaded first. It's nigh impossible for the author of the
workspace file to anticipate the state of the user's cache.
mboes added a commit that referenced this pull request Apr 15, 2020
Historically, the user was able to see the output of `nix-build` in
real-time. This was useful, because building derivations can take
a long time. Even if the binary cache can be used for all derivations,
downloading can take a long time. Then #77 came along, which made
`nix-build` quiet as a side-effect. Later, #86 subsumed #77 with
a simpler implementation. However, people argued in #82 that being
quiet is the right thing to do, because otherwise workspace rule
output can garble the output of `bazel query` and break scripts. So we
stuck to quiet output and this was called out in the v0.6 changelog.

It turns out that the problem affects other rule authors too (see
bazel-contrib/rules_nodejs#583). This led to bazelbuild/bazel#10611,
which fixes the problem for everyone, and shipped in Bazel 3.0. Now,
all workspace rule output goes to `stderr`, so scripts calling `bazel
query` shouldn't be affected.

Given this upstream change, my position is that being verbose is now
the right thing to do. If #85 is implemented, then being verbose
should remain the default, at least for users of Bazel 3.0 onwards.
Because even small packages may have a large set of dependencies that
must be downloaded first. It's nigh impossible for the author of the
workspace file to anticipate the state of the user's cache.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rework the hermeticity heuristic nixpkgs_package dependency change does not invalidate repository
2 participants