diff --git a/pkgs/test/macos-sierra-shared/default.nix b/pkgs/test/macos-sierra-shared/default.nix index 690d09414fbd..51e8ae53736c 100644 --- a/pkgs/test/macos-sierra-shared/default.nix +++ b/pkgs/test/macos-sierra-shared/default.nix @@ -1,4 +1,4 @@ -{ lib, clangStdenv, clang-sierraHack-stdenv }: +{ lib, clangStdenv, clang-sierraHack-stdenv, stdenvNoCC }: let makeBigExe = stdenv: prefix: rec { @@ -22,6 +22,7 @@ let mkdir -p "$out/lib" mv lib${name}.dylib "$out/lib" ''; + meta.platforms = lib.platforms.darwin; }) count; finalExe = stdenv.mkDerivation rec { @@ -53,18 +54,36 @@ let EOF ''; buildPhase = '' - $CXX -std=c++11 main.cxx ${toString (map (x: "-l${x.name}") sillyLibs)} -o asdf + $CXX -std=c++11 main.cxx ${toString (map (x: "-l${x.name}") sillyLibs)} -o ${prefix}-asdf ''; buildInputs = sillyLibs; installPhase = '' mkdir -p "$out/bin" - mv asdf "$out/bin" + mv ${prefix}-asdf "$out/bin" ''; + meta.platforms = lib.platforms.darwin; }; }; -in { good = makeBigExe clang-sierraHack-stdenv "good"; + bad = makeBigExe clangStdenv "bad"; + +in stdenvNoCC.mkDerivation { + name = "macos-sierra-shared-test"; + buildInputs = [ good.finalExe bad.finalExe ]; + # TODO(@Ericson2314): Be impure or require exact MacOS version of builder? + buildCommand = '' + if bad-asdf + then echo "bad-asdf can succeed on non-sierra, OK" >&2 + else echo "bad-asdf should fail on sierra, OK" >&2 + fi + + # Must succeed on all supported MacOS versions + good-asdf + + touch $out + ''; + meta.platforms = lib.platforms.darwin; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 85573b10321b..a1d83e314584 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19223,4 +19223,9 @@ with pkgs; undaemonize = callPackage ../tools/system/undaemonize {}; houdini = callPackage ../applications/misc/houdini {}; + + # No `recurseIntoAttrs` because there's no need to nix-env these. + tests = { + macOSSierraShared = callPackage ../test/macos-sierra-shared {}; + }; } diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix index be57b40fca64..0c7c67a0d03b 100644 --- a/pkgs/top-level/release.nix +++ b/pkgs/top-level/release.nix @@ -42,6 +42,7 @@ let jobs.python.x86_64-darwin jobs.rustc.x86_64-darwin jobs.go.x86_64-darwin + jobs.tests.macOSSierraShared ]; };