macos-sierra-shared: Make live code and add to nascent Darwin channel

Also add appropriate `meta.platforms = ...` to each derivation.
This commit is contained in:
John Ericson 2017-07-31 21:02:20 -04:00 committed by John Ericson
parent eeed1814dc
commit 14e05c30e8
3 changed files with 29 additions and 4 deletions

View File

@ -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;
}

View File

@ -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 {};
};
}

View File

@ -42,6 +42,7 @@ let
jobs.python.x86_64-darwin
jobs.rustc.x86_64-darwin
jobs.go.x86_64-darwin
jobs.tests.macOSSierraShared
];
};