Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkgs/stdenv/generic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ let
# without running any commands. Because this will also skip `shopt -s extglob`
# commands and extglob affects the Bash parser, we enable extglob always.
shellDryRun = "${stdenv.shell} -n -O extglob";

tests = {
succeedOnFailure = import ../tests/succeedOnFailure.nix { inherit stdenv; };
};
passthru.tests = lib.warn "Use `stdenv.tests` instead. `passthru` is a `mkDerivation` detail." stdenv.tests;
Copy link
Member Author

Choose a reason for hiding this comment

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

Should this be triggered by nix eval? I have encountered this on my system and other peoples and I am unsure if the issue is here or in nix eval.

}

# Propagate any extra attributes. For instance, we use this to
Expand Down
2 changes: 1 addition & 1 deletion pkgs/stdenv/generic/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ exitHandler() {
echo "build failed with exit code $exitCode (ignored)"
mkdir -p "$out/nix-support"
printf "%s" "$exitCode" > "$out/nix-support/failed"
return 0
exit 0
fi

else
Expand Down
14 changes: 14 additions & 0 deletions pkgs/stdenv/tests/succeedOnFailure.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{ stdenv }:

stdenv.mkDerivation {
name = "stdenv-test-succeedOnFailure";

succeedOnFailure = true;

passAsFile = [ "buildCommand" ];
buildCommand = ''
mkdir $out
echo foo > $out/foo
exit 1
'';
}