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: only preBuild is passed to go-module #208036

Closed
urandom2 opened this issue Dec 27, 2022 · 2 comments · Fixed by #212800
Closed

buildGoModule: only preBuild is passed to go-module #208036

urandom2 opened this issue Dec 27, 2022 · 2 comments · Fixed by #212800

Comments

@urandom2
Copy link
Contributor

Describe the bug

I keep hitting a heisenbug in #198963, where we get make: /usr/bin/env: No such file or directory. this is triggered because, per @SuperSandro2000's suggestion, we split setup into postPatch and preBuild. this makes intuitive sense, because the former is a bunch of nix related in place substitutions, and the latter is a pre-build code generation phase.

because this suggestion came late in the development process, I had already seeded a fod into the nix store, with a single preBuild containing all the logic. as such, when I broke them apart, the derivation was broken, but it worked on my system. this caused a large amount of delay, and probably annoyed @SuperSandro2000, sorry.

I understand the logic of wanting to share preBuild between the main derivation and go-module, but most authors will not be clear that only preBuild gets shared, and it needs to work without other hooks.

Steps To Reproduce

Steps to reproduce the behavior:

  1. make a buildGoModule derivation with both preBuild vendorHash attrs
  2. successfully build the derivation
  3. split preBuild in two (say postPatch and preBuild) such that preBuild alone is not enough
  4. confirm that it builds successfully locally
  5. confirm that it fails to build on empty nix store

Expected behavior

I would have expected that we pass all the hooks or none. I know we already have modBuildPhase, and maybe that is the correct way to pass things like preBuild or postPatch, e.g. modPreBuild and modPostPatch respectively. the ux for this would not be too bad: modPreBuild = preBuild;, but I get that this is a breaking change.

Notify maintainers

@NixOS/golang

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.82, NixOS, 23.05 (Stoat), 23.05.20221218.04f574a`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.12.0`
 - channels(root): `""`
 - channels(User Name): `"nixos-22.05-22.05"`
 - channels(user): `""`
 - nixpkgs: `/nix/store/dk1bqlz87dzsd8g4fq92pscgd60ji2vr-source`
@zowoq
Copy link
Contributor

zowoq commented Dec 27, 2022

I've seen a couple of people get bitten by this sort of thing, been meaning to do something about.

Give me a week or two and I'll take a look at improving it.

@urandom2
Copy link
Contributor Author

yep, no rush. I opened the issue half to document what went wrong, so that other people searching this might find it. I am also happy to help, if you can sketch out what your proposed solution would be, e.g. my naive modPreBuild suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants