lighthouse icon indicating copy to clipboard operation
lighthouse copied to clipboard

Support builds that are reproducible and do not require network access

Open philipmw opened this issue 3 years ago • 5 comments

Description

I want to build Lighthouse for NixOS. This requires that Lighthouse builds in a reproducible way without needing network access.

Version

2.4.0

Present Behaviour

In several places of the code, Lighthouse downloads files via HTTPS during build.

Expected Behaviour

Lighthouse should support finding the needed files on the filesystem (placed there by the packager) without using the network.

Steps to resolve

Follow the pattern in deposit_contract, which supports specifying a filename via an environment variable.

philipmw avatar Jul 23 '22 17:07 philipmw

I had to work through the same issue and this was my solution:

https://gist.github.com/ralexstokes/e9e123ccc9386ad6de1470e3c9011d99

it just applies the result of what the network request would output

I think the output is static which suggests this could even be hardcoded into the repo -- I'd ask the maintainers to reconsider this aspect of the build at some point because it does complicate the build

ralexstokes avatar Jul 26 '22 00:07 ralexstokes

That's a neat approach. Is anything keeping you from contributing this to Nixpkgs?

philipmw avatar Jul 26 '22 05:07 philipmw

Is anything keeping you from contributing this to Nixpkgs?

lack of knowledge and somewhat time -- do I just make a PR to that repo? any links to docs etc? I'm relatively new to Nix world

ralexstokes avatar Jul 26 '22 14:07 ralexstokes

You already did the hard part! Now the easy part is to just make a pull request to the Nixpkgs repo. Here's a chapter in the NixOS manual that describes the process: https://nixos.org/manual/nixpkgs/stable/#chap-submitting-changes

One difference I noticed between my approach and yours is that I am building the full package, while you seem to be omitting tests. Did you run into any particular difficulties patching the tests, or just didn't bother?

philipmw avatar Jul 26 '22 16:07 philipmw

Did you run into any particular difficulties patching the tests, or just didn't bother?

yeah I skipped the stuff I did not need, feel free to take this and run w/ it if you want

if you improve what I had, I'd love to see it at some point!

ralexstokes avatar Jul 27 '22 16:07 ralexstokes