windows: fix eval if ci enabled (#436840)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
stdenv,
|
||||
buildPackages,
|
||||
pkgs,
|
||||
@@ -9,7 +10,9 @@
|
||||
}:
|
||||
|
||||
lib.makeScope newScope (
|
||||
self: with self; {
|
||||
self:
|
||||
with self;
|
||||
{
|
||||
dlfcn = callPackage ./dlfcn { };
|
||||
|
||||
mingw_w64 = callPackage ./mingw-w64 {
|
||||
@@ -31,8 +34,6 @@ lib.makeScope newScope (
|
||||
|
||||
mingw_w64_headers = callPackage ./mingw-w64/headers.nix { };
|
||||
|
||||
mingw_w64_pthreads = lib.warn "windows.mingw_w64_pthreads is deprecated, windows.pthreads should be preferred" self.pthreads;
|
||||
|
||||
mcfgthreads = callPackage ./mcfgthreads { stdenv = crossThreadsStdenv; };
|
||||
|
||||
npiperelay = callPackage ./npiperelay { };
|
||||
@@ -43,4 +44,7 @@ lib.makeScope newScope (
|
||||
|
||||
sdk = callPackage ./msvcSdk { };
|
||||
}
|
||||
// lib.optionalAttrs config.allowAliases {
|
||||
mingw_w64_pthreads = lib.warn "windows.mingw_w64_pthreads is deprecated, windows.pthreads should be preferred" self.pthreads;
|
||||
}
|
||||
)
|
||||
|
||||
@@ -24,102 +24,104 @@ let
|
||||
else
|
||||
throw "Unsupported system";
|
||||
in
|
||||
if !config.microsoftVisualStudioLicenseAccepted then
|
||||
throw ''
|
||||
Microsoft Software License Terms are not accepted with config.microsoftVisualStudioLicenseAccepted.
|
||||
Please read https://visualstudio.microsoft.com/license-terms/mt644918/ and if you agree, change your
|
||||
config to indicate so.
|
||||
''
|
||||
else
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
inherit version;
|
||||
pname = "msvc-sdk";
|
||||
dontUnpack = true;
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
inherit version;
|
||||
pname = "msvc-sdk";
|
||||
dontUnpack = true;
|
||||
|
||||
strictDeps = true;
|
||||
nativeBuildInputs = [ xwin ];
|
||||
strictDeps = true;
|
||||
nativeBuildInputs = [ xwin ];
|
||||
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = hashes.${arch};
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash =
|
||||
if !config.microsoftVisualStudioLicenseAccepted then
|
||||
throw ''
|
||||
Microsoft Software License Terms are not accepted with config.microsoftVisualStudioLicenseAccepted.
|
||||
Please read https://visualstudio.microsoft.com/license-terms/mt644918/ and if you agree, change your
|
||||
config to indicate so.
|
||||
''
|
||||
else
|
||||
hashes.${arch};
|
||||
|
||||
__structuredAttrs = true;
|
||||
xwinArgs = [
|
||||
"--accept-license"
|
||||
"--cache-dir=xwin-out"
|
||||
"--manifest=${./manifest.json}"
|
||||
"--arch=${arch}"
|
||||
"splat"
|
||||
"--preserve-ms-arch-notation"
|
||||
];
|
||||
__structuredAttrs = true;
|
||||
xwinArgs = [
|
||||
"--accept-license"
|
||||
"--cache-dir=xwin-out"
|
||||
"--manifest=${./manifest.json}"
|
||||
"--arch=${arch}"
|
||||
"splat"
|
||||
"--preserve-ms-arch-notation"
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
xwin "''${xwinArgs[@]}"
|
||||
mkdir "$out"
|
||||
mv xwin-out/splat/* "$out"
|
||||
xwin "''${xwinArgs[@]}"
|
||||
mkdir "$out"
|
||||
mv xwin-out/splat/* "$out"
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
dontFixup = true;
|
||||
dontInstall = true;
|
||||
dontFixup = true;
|
||||
dontInstall = true;
|
||||
|
||||
passthru = {
|
||||
updateScript = ./update.nu;
|
||||
tests = {
|
||||
hello-world = testers.runCommand {
|
||||
name = "hello-msvc";
|
||||
passthru = {
|
||||
updateScript = ./update.nu;
|
||||
tests = {
|
||||
hello-world = testers.runCommand {
|
||||
name = "hello-msvc";
|
||||
|
||||
nativeBuildInputs = [
|
||||
llvmPackages.clang-unwrapped
|
||||
llvmPackages.bintools-unwrapped
|
||||
];
|
||||
nativeBuildInputs = [
|
||||
llvmPackages.clang-unwrapped
|
||||
llvmPackages.bintools-unwrapped
|
||||
];
|
||||
|
||||
script = ''
|
||||
set -euo pipefail
|
||||
script = ''
|
||||
set -euo pipefail
|
||||
|
||||
cat > hello.c <<- EOF
|
||||
#include <stdio.h>
|
||||
cat > hello.c <<- EOF
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
printf("Hello world!\n");
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
int main(int argc, char* argv[]) {
|
||||
printf("Hello world!\n");
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
clang-cl --target=x86_64-pc-windows-msvc -fuse-ld=lld \
|
||||
/vctoolsdir ${finalAttrs.finalPackage}/crt \
|
||||
/winsdkdir ${finalAttrs.finalPackage}/sdk \
|
||||
./hello.c -v
|
||||
clang-cl --target=x86_64-pc-windows-msvc -fuse-ld=lld \
|
||||
/vctoolsdir ${finalAttrs.finalPackage}/crt \
|
||||
/winsdkdir ${finalAttrs.finalPackage}/sdk \
|
||||
./hello.c -v
|
||||
|
||||
if test ! -f hello.exe; then
|
||||
echo "hello.exe not found!"
|
||||
exit 1
|
||||
else
|
||||
touch $out
|
||||
fi
|
||||
'';
|
||||
};
|
||||
if test ! -f hello.exe; then
|
||||
echo "hello.exe not found!"
|
||||
exit 1
|
||||
else
|
||||
touch $out
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "MSVC SDK and Windows CRT for cross compiling";
|
||||
homepage = "https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/";
|
||||
maintainers = [ lib.maintainers.RossSmyth ];
|
||||
license = {
|
||||
deprecated = false;
|
||||
fullName = "Microsoft Software License Terms";
|
||||
shortName = "msvc";
|
||||
spdxId = "unknown";
|
||||
url = "https://www.visualstudio.com/license-terms/mt644918/";
|
||||
};
|
||||
platforms = lib.platforms.all;
|
||||
# The arm32 manifest is missing critical pieces.
|
||||
broken = stdenvNoCC.hostPlatform.isAarch32;
|
||||
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
|
||||
teams = [ lib.teams.windows ];
|
||||
meta = {
|
||||
description = "MSVC SDK and Windows CRT for cross compiling";
|
||||
homepage = "https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/";
|
||||
maintainers = [ lib.maintainers.RossSmyth ];
|
||||
license = {
|
||||
deprecated = false;
|
||||
fullName = "Microsoft Software License Terms";
|
||||
shortName = "msvc";
|
||||
spdxId = "unknown";
|
||||
free = false;
|
||||
url = "https://www.visualstudio.com/license-terms/mt644918/";
|
||||
};
|
||||
})
|
||||
platforms = lib.platforms.all;
|
||||
# The arm32 manifest is missing critical pieces.
|
||||
broken = stdenvNoCC.hostPlatform.isAarch32;
|
||||
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
|
||||
teams = [ lib.teams.windows ];
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user