blob: 0d8890e61da2b293855ad5f0fe687d4f1f7572d7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# TODO: switch to stdenvNoCC
{ stdenv
, lib
, writeText
, testers
, runCommand
}: type: args: stdenv.mkDerivation (finalAttrs: args // {
doInstallCheck = true;
# TODO: this should probably be postInstallCheck
# TODO: send output to /dev/null
installCheckPhase = args.installCheckPhase or "" + ''
$out/bin/dotnet --info
'';
# TODO: move this to sdk section?
setupHook = writeText "dotnet-setup-hook" (''
if [ ! -w "$HOME" ]; then
export HOME=$(mktemp -d) # Dotnet expects a writable home directory for its configuration files
fi
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 # Dont try to expand NuGetFallbackFolder to disk
export DOTNET_NOLOGO=1 # Disables the welcome message
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_WORKLOAD_INTEGRITY_CHECK=1 # Skip integrity check on first run, which fails due to read-only directory
'' + args.setupHook or "");
} // lib.optionalAttrs (type == "sdk") {
passthru = {
tests = {
version = testers.testVersion {
package = finalAttrs.finalPackage;
};
console = runCommand "dotnet-test-console" {
nativeBuildInputs = [ finalAttrs.finalPackage ];
} ''
HOME=$(pwd)/fake-home
dotnet new nugetconfig
dotnet nuget disable source nuget
dotnet new console -n test -o .
output="$(dotnet run)"
# yes, older SDKs omit the comma
[[ "$output" =~ Hello,?\ World! ]] && touch "$out"
'';
single-file = let build = runCommand "dotnet-test-build-single-file" {
nativeBuildInputs = [ finalAttrs.finalPackage ];
} ''
HOME=$(pwd)/fake-home
dotnet new nugetconfig
dotnet nuget disable source nuget
dotnet nuget add source ${finalAttrs.finalPackage.packages}
dotnet new console -n test -o .
dotnet publish --use-current-runtime -p:PublishSingleFile=true -o $out
''; in runCommand "dotnet-test-run-single-file" {} ''
output="$(${build}/test)"
# yes, older SDKs omit the comma
[[ "$output" =~ Hello,?\ World! ]] && touch "$out"
'';
} // args.passthru.tests or {};
} // args.passthru or {};
})
|