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

stdenv: add runPhase function #21060

Closed
wants to merge 1 commit into from
Closed

Conversation

LnL7
Copy link
Member

@LnL7 LnL7 commented Dec 11, 2016

Motivation for this change

This is useful for running phases inside a nix-shell, using buildPhase for example will always execute make even when a derivation has a custom buildPhase.

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
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested stdenv.mkDerivation
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

@LnL7, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @vcunat and @urkud to be potential reviewers.

# function named $phase.
eval "${!phase:-$phase}"

if [ "$curPhase" = unpackPhase ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be checking for $phase instead of $curPhase.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh I missed that one, pretty strange that I didn't notice any build issues.

Copy link
Contributor

@dezgeg dezgeg Dec 11, 2016

Choose a reason for hiding this comment

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

I guess $curPhase is global and this is only called from a single place (where $phase == $curPhase)..

Copy link
Member Author

Choose a reason for hiding this comment

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

right, it's not a local

fi

stopNest
runPhase $curPhase
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add quotes here.

this is useful for running phases inside a nix-shell
@LnL7
Copy link
Member Author

LnL7 commented Dec 11, 2016

Another solution for this behaviour would be to do this in the functions for each phase, that way we would get the expected behaviour without having to use the runPhase function.

@LnL7
Copy link
Member Author

LnL7 commented Jan 3, 2017

I think it's better if this is fixed in the phases, that way it will work as expected.

@LnL7 LnL7 closed this Jan 3, 2017
@LnL7 LnL7 deleted the stdenv-run-phase branch January 30, 2019 15:11
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