forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stdenv: Make it easier to correctly run phases in nix-shell
Currently, it's a bit annoying to run build phases manually inside a nix-shell. To run say, buildPhase, the invocation that works correctly in all cases is: eval "${buildPhase:-buildPhase}" Which is quite a mouthful and non-obvious. Even worse, the obvious thing to try, i.e.: buildPhase works _sometimes_ (i.e. when the package doesn't have a `buildPhase = "...";`) but silently does the wrong thing in other cases. Let's fix this by having the obvious thing work always. To do that, we simply pull the logic of 'if $buildPhase exists as a variable, then eval "$buildPhase", else do the default buildPhase' into the buildPhase() function itself using a common helper: buildPhase() { commonPhaseImpl buildPhase --default defaultBuildPhase --pre-hook preBuild --post-hook postBuild } As a bonus, we get to fix another current annoyance/footgun at the same time, that is setting e.g. `buildPhase = "...";` makes the preBuild and postBuild hooks not being run anymore.
- Loading branch information
Showing
8 changed files
with
198 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
preConfigurePhases+=" autoreconfPhase" | ||
|
||
autoreconfPhase() { | ||
runHook preAutoreconf | ||
commonPhaseImpl autoreconfPhase --default defaultAutoreconfPhase --pre-hook preAutoreconf --post-hook postAutoreconf | ||
} | ||
|
||
defaultAutoreconfPhase() { | ||
autoreconf ${autoreconfFlags:---install --force --verbose} | ||
runHook postAutoreconf | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
unpackPhase="unpackGog" | ||
|
||
unpackGog() { | ||
runHook preUnpackGog | ||
commonPhaseImpl unpackGog --default defaultUnpackGog --pre-hook preUnpackGog --post-hook postUnpackGog | ||
} | ||
|
||
defaultUnpackGog() { | ||
innoextract --silent --extract --exclude-temp "${src}" | ||
|
||
find . -depth -print -execdir rename -f 'y/A-Z/a-z/' '{}' \; | ||
|
||
runHook postUnpackGog | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.