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

buildGoModule: support impure modules #76532

Merged
merged 5 commits into from Dec 28, 2019

Conversation

zimbatm
Copy link
Member

@zimbatm zimbatm commented Dec 26, 2019

When modSha256 is null, disable the nix sandbox instead of using a
fixed-output derivation. This requires the nix-daemon to have
sandbox = relaxed set in their config to work properly.

Because the output is (hopefully) deterministic based on the inputs,
this should give a reproducible output. This is useful for development
outside of nixpkgs where re-generating the modSha256 on each mod.sum
changes is cumbersome.

Don't use this in nixpkgs! This is why null is not the default value.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

When modSha256 is null, disable the nix sandbox instead of using a
fixed-output derivation. This requires the nix-daemon to have
`sandbox = relaxed` set in their config to work properly.

Because the output is (hopefully) deterministic based on the inputs,
this should give a reproducible output. This is useful for development
outside of nixpkgs where re-generating the modSha256 on each mod.sum
changes is cumbersome.

Don't use this in nixpkgs! This is why null is not the default value.
@flokli
Copy link
Contributor

flokli commented Dec 26, 2019

I'm not sure if I like this being in nixpkgs in at, but I see there might be usecases.

If this gets merged, we should at least print a big warning with lib.warn, so people don't accidentially use this when filing PRs.

@kalbasit
Copy link
Member

I'm on with this change, but I agree that we should at least warn so the user knows that is happening behind the scenes.

@kalbasit
Copy link
Member

Can we also document this in the manual?

@zimbatm
Copy link
Member Author

zimbatm commented Dec 26, 2019

Ok, I wanted to see what you think of the solution. I will document this more thoroughly then.

I would rather add the warning in the documentation than adding noise to the output with lib.warn. The user will have to read the doc to use this as it's not the default behavior. If it ends-up being used by mistake in nixpkgs, ofborg and hydra will refuse to build it.

@zimbatm
Copy link
Member Author

zimbatm commented Dec 26, 2019

doc added

Copy link
Contributor

@flokli flokli left a comment

Choose a reason for hiding this comment

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

We should explain why this shouldn't be used for Nixpkgs, and is discouraged except for development.

doc/languages-frameworks/go.xml Outdated Show resolved Hide resolved
Co-Authored-By: Florian Klink <flokli@flokli.de>
doc/languages-frameworks/go.xml Outdated Show resolved Hide resolved
doc/languages-frameworks/go.xml Outdated Show resolved Hide resolved
zimbatm and others added 2 commits December 27, 2019 11:42
Co-Authored-By: Wael Nasreddine <wael.nasreddine@gmail.com>
Co-Authored-By: Wael Nasreddine <wael.nasreddine@gmail.com>
@zimbatm
Copy link
Member Author

zimbatm commented Dec 28, 2019

all good now?

@kalbasit kalbasit merged commit f373ece into NixOS:master Dec 28, 2019
@zimbatm zimbatm deleted the buildGoModule-no-modSha256 branch December 28, 2019 21:45
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Jan 27, 2020
When modSha256 is null, disable the nix sandbox instead of using a
fixed-output derivation. This requires the nix-daemon to have
`sandbox = relaxed` set in their config to work properly.

Because the output is (hopefully) deterministic based on the inputs,
this should give a reproducible output. This is useful for development
outside of nixpkgs where re-generating the modSha256 on each mod.sum
changes is cumbersome.

Don't use this in nixpkgs! This is why null is not the default value.

(cherry picked from commit f373ece)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants