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

Idris: fix "addEnvHooks: command not found" (#33820) #33838

Closed
wants to merge 1 commit into from

Conversation

xrvdg
Copy link
Contributor

@xrvdg xrvdg commented Jan 13, 2018

Motivation for this change

On the current head 'addEnvHooks' doesn't seem to be available in 'preHook'.
This patch tries to stay as close as the original by moving the code to
'setupHook' and changing the ln options.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-review wip"
    • Packages that depend on this are already broken, but that is something for a different issue.
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

On the current head 'addEnvHooks' doesn't seem to be available in 'preHook'.
This patch tries to stay as close as the original by moving the code to
'setupHook'.
@Ericson2314
Copy link
Member

Sorry about that. I'll eventually do a mass rebuild hosting up the definition so it's in scope of the prehook.

For now though, this workaround isn't quite right. Make the script a nativeBuildInput instead of a setup hook. The former will have it just affect the current build, as the preHook did, while the latter makes it not affect the current build and just downstream builds.

@@ -35,6 +36,7 @@
'';

installPhase = ''
Copy link
Member

Choose a reason for hiding this comment

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

Likewise you won't need this.

Copy link
Contributor Author

@xrvdg xrvdg Jan 14, 2018

Choose a reason for hiding this comment

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

Do you mean I won't need the installPhase or just the export line?

Copy link
Member

Choose a reason for hiding this comment

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

Just the export line. Guess I highlighted the wrong one sorry.

@xrvdg
Copy link
Contributor Author

xrvdg commented Jan 14, 2018

@Ericson2314: Before I give it a go, could you give feedback on whether moving the script to nativeBuildInput is preferred over @pbogdan's fix in #33820.

@@ -2,26 +2,27 @@
#
# args: Additional arguments to pass to mkDerivation. Generally should include at least
# name and src.
{ stdenv, idris, gmp }: args: stdenv.mkDerivation ({
preHook = ''
Copy link
Member

Choose a reason for hiding this comment

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

have you tried postHook, that runs after the default setup.sh but before genericBuild

Copy link
Member

Choose a reason for hiding this comment

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

Please forgive my ignorance but now I'm curious - how would this part https://github.com/NixOS/nixpkgs/pull/33838/files#diff-852bb06e74b1ca7f9271dc4dd42aaca9R20 be implemented when using postHook? (and sorry for the noise - I'm struggling to figure out how the various pieces fit together here).

Copy link
Member

Choose a reason for hiding this comment

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

I only looked through this very briefly so I might be missing something.

The preHook runs at the very start of $stdenv/setup only a few things like helpers and PATH are defined at this point. On the other had the postHook will run at the very end of $stdenv/setup when all of the phases, etc. are defined. This is still before all of the phases run but at this point addEnvHooks will be available, I think that will work without having to use a setup hook.

Copy link
Member

@pbogdan pbogdan Jan 14, 2018

Choose a reason for hiding this comment

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

@LnL7 thank you! It seems to me that addEnvHooks would be available in postHook but at the point postHook adds hooks via addEnvHooks said hooks would have been executed already?

What I'm trying to say is that adding a hook via addEnvHooks in postHook seems to be too late for it to execute.

(apologies for derailing the discussion, I will shut up now 😆)

Copy link
Member

@LnL7 LnL7 Jan 14, 2018

Choose a reason for hiding this comment

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

Oh, you're right, you can ignore the comment then 😄. The env hooks run before that so we need to either move that down or define addEnvHooks earlier.

@xrvdg
Copy link
Contributor Author

xrvdg commented Feb 2, 2018

I'm not working with Idris anymore and this PR is not a proper fix, therefore I've decided to close this pull request.

@xrvdg xrvdg closed this Feb 2, 2018
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

5 participants