tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
dotnet: format with nixfmt
David McFarland
2 years ago
6582132c
24959f93
+1025
-872
14 changed files
expand all
collapse all
unified
split
pkgs
development
compilers
dotnet
build-dotnet.nix
combine-deps.nix
combine-packages.nix
common.nix
default.nix
dotnet.nix
packages.nix
patch-nupkgs.nix
sign-apphost.nix
sigtool.nix
stage0.nix
stage1.nix
update.nix
vmr.nix
+104
-74
pkgs/development/compilers/dotnet/build-dotnet.nix
reviewed
···
1
1
-
{ type
2
2
-
, version
3
3
-
, srcs
4
4
-
, packages ? null
1
1
+
{
2
2
+
type,
3
3
+
version,
4
4
+
srcs,
5
5
+
packages ? null,
5
6
}:
6
7
7
7
-
assert builtins.elem type [ "aspnetcore" "runtime" "sdk" ];
8
8
+
assert builtins.elem type [
9
9
+
"aspnetcore"
10
10
+
"runtime"
11
11
+
"sdk"
12
12
+
];
8
13
assert if type == "sdk" then packages != null else true;
9
14
10
10
-
{ lib
11
11
-
, stdenv
12
12
-
, fetchurl
13
13
-
, writeText
14
14
-
, autoPatchelfHook
15
15
-
, makeWrapper
16
16
-
, libunwind
17
17
-
, icu
18
18
-
, libuuid
19
19
-
, zlib
20
20
-
, libkrb5
21
21
-
, openssl
22
22
-
, curl
23
23
-
, lttng-ust_2_12
24
24
-
, testers
25
25
-
, runCommand
26
26
-
, writeShellScript
27
27
-
, mkNugetDeps
28
28
-
, callPackage
29
29
-
, dotnetCorePackages
30
30
-
, xmlstarlet
15
15
+
{
16
16
+
lib,
17
17
+
stdenv,
18
18
+
fetchurl,
19
19
+
writeText,
20
20
+
autoPatchelfHook,
21
21
+
makeWrapper,
22
22
+
libunwind,
23
23
+
icu,
24
24
+
libuuid,
25
25
+
zlib,
26
26
+
libkrb5,
27
27
+
openssl,
28
28
+
curl,
29
29
+
lttng-ust_2_12,
30
30
+
testers,
31
31
+
runCommand,
32
32
+
writeShellScript,
33
33
+
mkNugetDeps,
34
34
+
callPackage,
35
35
+
dotnetCorePackages,
36
36
+
xmlstarlet,
31
37
}:
32
38
33
39
let
···
45
51
sdk = ".NET SDK ${version}";
46
52
};
47
53
48
48
-
mkCommon = callPackage ./common.nix {};
54
54
+
mkCommon = callPackage ./common.nix { };
49
55
50
56
targetRid = dotnetCorePackages.systemToDotnetRid stdenv.targetPlatform.system;
51
57
52
52
-
sigtool = callPackage ./sigtool.nix {};
53
53
-
signAppHost = callPackage ./sign-apphost.nix {};
58
58
+
sigtool = callPackage ./sigtool.nix { };
59
59
+
signAppHost = callPackage ./sign-apphost.nix { };
54
60
55
55
-
hasILCompiler =
56
56
-
lib.versionAtLeast version (if targetRid == "osx-arm64" then "8" else "7");
61
61
+
hasILCompiler = lib.versionAtLeast version (if targetRid == "osx-arm64" then "8" else "7");
57
62
58
58
-
extraTargets = writeText "extra.targets" (''
59
59
-
<Project>
60
60
-
'' + lib.optionalString hasILCompiler ''
63
63
+
extraTargets = writeText "extra.targets" (
64
64
+
''
65
65
+
<Project>
66
66
+
''
67
67
+
+ lib.optionalString hasILCompiler ''
61
68
<ItemGroup>
62
62
-
<CustomLinkerArg Include="-Wl,-rpath,'${lib.makeLibraryPath [ icu zlib openssl ]}'" />
69
69
+
<CustomLinkerArg Include="-Wl,-rpath,'${
70
70
+
lib.makeLibraryPath [
71
71
+
icu
72
72
+
zlib
73
73
+
openssl
74
74
+
]
75
75
+
}'" />
63
76
</ItemGroup>
64
64
-
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
77
77
+
''
78
78
+
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
65
79
<Import Project="${signAppHost}" />
66
66
-
'' + ''
67
67
-
</Project>
68
68
-
'');
80
80
+
''
81
81
+
+ ''
82
82
+
</Project>
83
83
+
''
84
84
+
);
69
85
70
86
in
71
87
mkCommon type rec {
72
88
inherit pname version;
73
89
74
90
# Some of these dependencies are `dlopen()`ed.
75
75
-
nativeBuildInputs = [
76
76
-
makeWrapper
77
77
-
] ++ lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook
78
78
-
++ lib.optionals (type == "sdk" && stdenv.hostPlatform.isDarwin) [
79
79
-
xmlstarlet
80
80
-
sigtool
81
81
-
];
91
91
+
nativeBuildInputs =
92
92
+
[
93
93
+
makeWrapper
94
94
+
]
95
95
+
++ lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook
96
96
+
++ lib.optionals (type == "sdk" && stdenv.hostPlatform.isDarwin) [
97
97
+
xmlstarlet
98
98
+
sigtool
99
99
+
];
82
100
83
101
buildInputs = [
84
102
stdenv.cc.cc
···
90
108
] ++ lib.optional stdenv.hostPlatform.isLinux lttng-ust_2_12;
91
109
92
110
src = fetchurl (
93
93
-
srcs."${stdenv.hostPlatform.system}" or (throw
94
94
-
"Missing source (url and hash) for host system: ${stdenv.hostPlatform.system}")
111
111
+
srcs."${stdenv.hostPlatform.system}"
112
112
+
or (throw "Missing source (url and hash) for host system: ${stdenv.hostPlatform.system}")
95
113
);
96
114
97
115
sourceRoot = ".";
98
116
99
99
-
postPatch = if type == "sdk" then (''
100
100
-
xmlstarlet ed \
101
101
-
--inplace \
102
102
-
-s //_:Project -t elem -n Import \
103
103
-
-i \$prev -t attr -n Project -v "${extraTargets}" \
104
104
-
sdk/*/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets
105
105
-
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
106
106
-
codesign --remove-signature packs/Microsoft.NETCore.App.Host.osx-*/*/runtimes/osx-*/native/{apphost,singlefilehost}
107
107
-
'') else null;
117
117
+
postPatch =
118
118
+
if type == "sdk" then
119
119
+
(
120
120
+
''
121
121
+
xmlstarlet ed \
122
122
+
--inplace \
123
123
+
-s //_:Project -t elem -n Import \
124
124
+
-i \$prev -t attr -n Project -v "${extraTargets}" \
125
125
+
sdk/*/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets
126
126
+
''
127
127
+
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
128
128
+
codesign --remove-signature packs/Microsoft.NETCore.App.Host.osx-*/*/runtimes/osx-*/native/{apphost,singlefilehost}
129
129
+
''
130
130
+
)
131
131
+
else
132
132
+
null;
108
133
109
134
dontPatchELF = true;
110
135
noDumpEnvVars = true;
···
151
176
(global-name "com.apple.system.opendirectoryd.membership"))
152
177
'';
153
178
154
154
-
passthru = {
155
155
-
inherit icu hasILCompiler;
156
156
-
} // lib.optionalAttrs (type == "sdk") {
157
157
-
packages = mkNugetDeps {
158
158
-
name = "${pname}-${version}-deps";
159
159
-
nugetDeps = packages;
179
179
+
passthru =
180
180
+
{
181
181
+
inherit icu hasILCompiler;
182
182
+
}
183
183
+
// lib.optionalAttrs (type == "sdk") {
184
184
+
packages = mkNugetDeps {
185
185
+
name = "${pname}-${version}-deps";
186
186
+
nugetDeps = packages;
187
187
+
};
188
188
+
189
189
+
updateScript =
190
190
+
let
191
191
+
majorVersion = lib.concatStringsSep "." (lib.take 2 (lib.splitVersion version));
192
192
+
in
193
193
+
writeShellScript "update-dotnet-${majorVersion}" ''
194
194
+
pushd pkgs/development/compilers/dotnet
195
195
+
exec ${./update.sh} "${majorVersion}"
196
196
+
'';
160
197
};
161
198
162
162
-
updateScript =
163
163
-
let
164
164
-
majorVersion = lib.concatStringsSep "." (lib.take 2 (lib.splitVersion version));
165
165
-
in
166
166
-
writeShellScript "update-dotnet-${majorVersion}" ''
167
167
-
pushd pkgs/development/compilers/dotnet
168
168
-
exec ${./update.sh} "${majorVersion}"
169
169
-
'';
170
170
-
};
171
171
-
172
199
meta = with lib; {
173
200
description = builtins.getAttr type descriptions;
174
201
homepage = "https://dotnet.github.io/";
175
202
license = licenses.mit;
176
176
-
maintainers = with maintainers; [ kuznero mdarocha ];
203
203
+
maintainers = with maintainers; [
204
204
+
kuznero
205
205
+
mdarocha
206
206
+
];
177
207
mainProgram = "dotnet";
178
208
platforms = attrNames srcs;
179
209
};
+21
-16
pkgs/development/compilers/dotnet/combine-deps.nix
reviewed
···
2
2
list,
3
3
baseRid,
4
4
otherRids,
5
5
-
pkgs ? import ../../../.. {}
5
5
+
pkgs ? import ../../../.. { },
6
6
}:
7
7
let
8
8
inherit (pkgs) writeText;
···
20
20
21
21
fns = map (file: import file) list;
22
22
23
23
-
packages = unique
24
24
-
(concatMap (fn: fn { fetchNuGet = package: package; }) fns);
23
23
+
packages = unique (concatMap (fn: fn { fetchNuGet = package: package; }) fns);
25
24
26
26
-
changePackageRid = package: rid:
27
27
-
let replace = replaceStrings [".${baseRid}"] [".${rid}"];
28
28
-
in rec {
25
25
+
changePackageRid =
26
26
+
package: rid:
27
27
+
let
28
28
+
replace = replaceStrings [ ".${baseRid}" ] [ ".${rid}" ];
29
29
+
in
30
30
+
rec {
29
31
pname = replace package.pname;
30
32
inherit (package) version;
31
33
url = replace package.url;
32
34
sha256 = builtins.hashFile "sha256" (builtins.fetchurl url);
33
35
};
34
36
35
35
-
expandPackage = package:
36
36
-
[ package ] ++
37
37
-
optionals (strings.match ".*\\.${baseRid}(\\..*|$)" package.pname != null)
38
38
-
(map (changePackageRid package) otherRids);
37
37
+
expandPackage =
38
38
+
package:
39
39
+
[ package ]
40
40
+
++ optionals (strings.match ".*\\.${baseRid}(\\..*|$)" package.pname != null) (
41
41
+
map (changePackageRid package) otherRids
42
42
+
);
39
43
40
40
-
allPackages =
41
41
-
sortOn (package: [ package.pname package.version ])
42
42
-
(concatMap expandPackage packages);
44
44
+
allPackages = sortOn (package: [
45
45
+
package.pname
46
46
+
package.version
47
47
+
]) (concatMap expandPackage packages);
43
48
44
44
-
fetchExpr = package:
45
45
-
" (fetchNuGet ${generators.toPretty { multiline = false; } package})";
49
49
+
fetchExpr = package: " (fetchNuGet ${generators.toPretty { multiline = false; } package})";
46
50
47
47
-
in writeText "deps.nix" ''
51
51
+
in
52
52
+
writeText "deps.nix" ''
48
53
{ fetchNuGet }: [
49
54
${concatMapStringsSep "\n" fetchExpr allPackages}
50
55
]
+39
-26
pkgs/development/compilers/dotnet/combine-packages.nix
reviewed
···
1
1
dotnetPackages:
2
2
-
{ buildEnv, makeWrapper, lib, symlinkJoin }:
2
2
+
{
3
3
+
buildEnv,
4
4
+
makeWrapper,
5
5
+
lib,
6
6
+
symlinkJoin,
7
7
+
}:
3
8
# TODO: Rethink how we determine and/or get the CLI.
4
9
# Possible options raised in #187118:
5
10
# 1. A separate argument for the CLI (as suggested by IvarWithoutBones
6
11
# 2. Use the highest version SDK for the CLI (as suggested by GGG)
7
12
# 3. Something else?
8
8
-
let cli = builtins.head dotnetPackages;
13
13
+
let
14
14
+
cli = builtins.head dotnetPackages;
9
15
in
10
10
-
assert lib.assertMsg ((builtins.length dotnetPackages) > 0)
11
11
-
''You must include at least one package, e.g
12
12
-
`with dotnetCorePackages; combinePackages [
13
13
-
sdk_6_0 aspnetcore_7_0
14
14
-
];`'' ;
15
15
-
buildEnv {
16
16
-
name = "dotnet-core-combined";
17
17
-
paths = dotnetPackages;
18
18
-
pathsToLink = [ "/host" "/packs" "/sdk" "/sdk-manifests" "/shared" "/templates" ];
19
19
-
ignoreCollisions = true;
20
20
-
postBuild = ''
21
21
-
cp -R ${cli}/{dotnet,share,nix-support} $out/
16
16
+
assert lib.assertMsg ((builtins.length dotnetPackages) > 0) ''
17
17
+
You must include at least one package, e.g
18
18
+
`with dotnetCorePackages; combinePackages [
19
19
+
sdk_6_0 aspnetcore_7_0
20
20
+
];`'';
21
21
+
buildEnv {
22
22
+
name = "dotnet-core-combined";
23
23
+
paths = dotnetPackages;
24
24
+
pathsToLink = [
25
25
+
"/host"
26
26
+
"/packs"
27
27
+
"/sdk"
28
28
+
"/sdk-manifests"
29
29
+
"/shared"
30
30
+
"/templates"
31
31
+
];
32
32
+
ignoreCollisions = true;
33
33
+
postBuild = ''
34
34
+
cp -R ${cli}/{dotnet,share,nix-support} $out/
22
35
23
23
-
mkdir $out/bin
24
24
-
ln -s $out/dotnet $out/bin/dotnet
25
25
-
'';
26
26
-
passthru = {
27
27
-
inherit (cli) icu;
36
36
+
mkdir $out/bin
37
37
+
ln -s $out/dotnet $out/bin/dotnet
38
38
+
'';
39
39
+
passthru = {
40
40
+
inherit (cli) icu;
28
41
29
29
-
versions = lib.catAttrs "version" dotnetPackages;
30
30
-
packages = symlinkJoin {
31
31
-
name = "combined-packages";
32
32
-
paths = lib.remove null (lib.catAttrs "packages" dotnetPackages);
33
33
-
};
42
42
+
versions = lib.catAttrs "version" dotnetPackages;
43
43
+
packages = symlinkJoin {
44
44
+
name = "combined-packages";
45
45
+
paths = lib.remove null (lib.catAttrs "packages" dotnetPackages);
34
46
};
47
47
+
};
35
48
36
36
-
inherit (cli) meta;
37
37
-
}
49
49
+
inherit (cli) meta;
50
50
+
}
+228
-191
pkgs/development/compilers/dotnet/common.nix
reviewed
···
1
1
# TODO: switch to stdenvNoCC
2
2
-
{ stdenv
3
3
-
, stdenvNoCC
4
4
-
, lib
5
5
-
, writeText
6
6
-
, testers
7
7
-
, runCommand
8
8
-
, runCommandWith
9
9
-
, expect
10
10
-
, curl
11
11
-
, installShellFiles
12
12
-
, callPackage
13
13
-
, zlib
14
14
-
, swiftPackages
15
15
-
, darwin
16
16
-
, icu
17
17
-
, lndir
18
18
-
, substituteAll
19
19
-
, nugetPackageHook
20
20
-
, xmlstarlet
21
21
-
}: type: args: stdenv.mkDerivation (finalAttrs: args // {
22
22
-
doInstallCheck = true;
2
2
+
{
3
3
+
stdenv,
4
4
+
stdenvNoCC,
5
5
+
lib,
6
6
+
writeText,
7
7
+
testers,
8
8
+
runCommand,
9
9
+
runCommandWith,
10
10
+
expect,
11
11
+
curl,
12
12
+
installShellFiles,
13
13
+
callPackage,
14
14
+
zlib,
15
15
+
swiftPackages,
16
16
+
darwin,
17
17
+
icu,
18
18
+
lndir,
19
19
+
substituteAll,
20
20
+
nugetPackageHook,
21
21
+
xmlstarlet,
22
22
+
}:
23
23
+
type: args:
24
24
+
stdenv.mkDerivation (
25
25
+
finalAttrs:
26
26
+
args
27
27
+
// {
28
28
+
doInstallCheck = true;
23
29
24
24
-
# TODO: this should probably be postInstallCheck
25
25
-
# TODO: send output to /dev/null
26
26
-
installCheckPhase = args.installCheckPhase or "" + ''
27
27
-
$out/bin/dotnet --info
28
28
-
'';
30
30
+
# TODO: this should probably be postInstallCheck
31
31
+
# TODO: send output to /dev/null
32
32
+
installCheckPhase =
33
33
+
args.installCheckPhase or ""
34
34
+
+ ''
35
35
+
$out/bin/dotnet --info
36
36
+
'';
29
37
30
30
-
setupHooks = args.setupHooks or [] ++ [
31
31
-
./dotnet-setup-hook.sh
32
32
-
] ++ lib.optional (type == "sdk") (substituteAll {
33
33
-
src = ./dotnet-sdk-setup-hook.sh;
34
34
-
inherit lndir xmlstarlet;
35
35
-
});
38
38
+
setupHooks =
39
39
+
args.setupHooks or [ ]
40
40
+
++ [
41
41
+
./dotnet-setup-hook.sh
42
42
+
]
43
43
+
++ lib.optional (type == "sdk") (substituteAll {
44
44
+
src = ./dotnet-sdk-setup-hook.sh;
45
45
+
inherit lndir xmlstarlet;
46
46
+
});
36
47
37
37
-
propagatedBuildInputs =
38
38
-
(args.propagatedBuildInputs or [ ])
39
39
-
++ lib.optional (type == "sdk") nugetPackageHook;
48
48
+
propagatedBuildInputs =
49
49
+
(args.propagatedBuildInputs or [ ])
50
50
+
++ lib.optional (type == "sdk") nugetPackageHook;
40
51
41
41
-
nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ installShellFiles ];
52
52
+
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ installShellFiles ];
42
53
43
43
-
postInstall = ''
44
44
-
# completions snippets taken from https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete
45
45
-
installShellCompletion --cmd dotnet \
46
46
-
--bash ${./completions/dotnet.bash} \
47
47
-
--zsh ${./completions/dotnet.zsh} \
48
48
-
--fish ${./completions/dotnet.fish}
49
49
-
'';
54
54
+
postInstall = ''
55
55
+
# completions snippets taken from https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete
56
56
+
installShellCompletion --cmd dotnet \
57
57
+
--bash ${./completions/dotnet.bash} \
58
58
+
--zsh ${./completions/dotnet.zsh} \
59
59
+
--fish ${./completions/dotnet.fish}
60
60
+
'';
50
61
51
51
-
passthru = {
52
52
-
tests = let
53
53
-
mkDotnetTest =
54
54
-
{
55
55
-
name,
56
56
-
stdenv ? stdenvNoCC,
57
57
-
template,
58
58
-
usePackageSource ? false,
59
59
-
build,
60
60
-
buildInputs ? [],
61
61
-
# TODO: use correct runtimes instead of sdk
62
62
-
runtime ? finalAttrs.finalPackage,
63
63
-
runInputs ? [],
64
64
-
run ? null,
65
65
-
runAllowNetworking ? false,
66
66
-
}:
62
62
+
passthru = {
63
63
+
tests =
67
64
let
68
68
-
sdk = finalAttrs.finalPackage;
69
69
-
built = stdenv.mkDerivation {
70
70
-
name = "dotnet-test-${name}";
71
71
-
buildInputs =
72
72
-
[ sdk ]
73
73
-
++ buildInputs
74
74
-
++ lib.optional (usePackageSource) sdk.packages;
75
75
-
# make sure ICU works in a sandbox
76
76
-
propagatedSandboxProfile = toString sdk.__propagatedSandboxProfile;
77
77
-
unpackPhase = ''
78
78
-
mkdir test
79
79
-
cd test
80
80
-
dotnet new ${template} -o .
81
81
-
'';
82
82
-
buildPhase = build;
83
83
-
dontPatchELF = true;
84
84
-
};
65
65
+
mkDotnetTest =
66
66
+
{
67
67
+
name,
68
68
+
stdenv ? stdenvNoCC,
69
69
+
template,
70
70
+
usePackageSource ? false,
71
71
+
build,
72
72
+
buildInputs ? [ ],
73
73
+
# TODO: use correct runtimes instead of sdk
74
74
+
runtime ? finalAttrs.finalPackage,
75
75
+
runInputs ? [ ],
76
76
+
run ? null,
77
77
+
runAllowNetworking ? false,
78
78
+
}:
79
79
+
let
80
80
+
sdk = finalAttrs.finalPackage;
81
81
+
built = stdenv.mkDerivation {
82
82
+
name = "dotnet-test-${name}";
83
83
+
buildInputs = [ sdk ] ++ buildInputs ++ lib.optional (usePackageSource) sdk.packages;
84
84
+
# make sure ICU works in a sandbox
85
85
+
propagatedSandboxProfile = toString sdk.__propagatedSandboxProfile;
86
86
+
unpackPhase = ''
87
87
+
mkdir test
88
88
+
cd test
89
89
+
dotnet new ${template} -o .
90
90
+
'';
91
91
+
buildPhase = build;
92
92
+
dontPatchELF = true;
93
93
+
};
94
94
+
in
95
95
+
if run == null then
96
96
+
built
97
97
+
else
98
98
+
runCommand "${built.name}-run"
99
99
+
(
100
100
+
{
101
101
+
src = built;
102
102
+
nativeBuildInputs = [ built ] ++ runInputs;
103
103
+
passthru = {
104
104
+
inherit built;
105
105
+
};
106
106
+
}
107
107
+
// lib.optionalAttrs (stdenv.hostPlatform.isDarwin && runAllowNetworking) {
108
108
+
sandboxProfile = ''
109
109
+
(allow network-inbound (local ip))
110
110
+
(allow mach-lookup (global-name "com.apple.FSEvents"))
111
111
+
'';
112
112
+
__darwinAllowLocalNetworking = true;
113
113
+
}
114
114
+
)
115
115
+
(
116
116
+
lib.optionalString (runtime != null) ''
117
117
+
# TODO: use runtime here
118
118
+
export DOTNET_ROOT=${runtime}
119
119
+
''
120
120
+
+ run
121
121
+
);
122
122
+
123
123
+
# Setting LANG to something other than 'C' forces the runtime to search
124
124
+
# for ICU, which will be required in most user environments.
125
125
+
checkConsoleOutput = command: ''
126
126
+
output="$(LANG=C.UTF-8 ${command})"
127
127
+
# yes, older SDKs omit the comma
128
128
+
[[ "$output" =~ Hello,?\ World! ]] && touch "$out"
129
129
+
'';
85
130
in
86
86
-
if run == null
87
87
-
then built
88
88
-
else
89
89
-
runCommand "${built.name}-run" ({
90
90
-
src = built;
91
91
-
nativeBuildInputs = [ built ] ++ runInputs;
92
92
-
passthru = { inherit built; };
93
93
-
} // lib.optionalAttrs (stdenv.hostPlatform.isDarwin && runAllowNetworking) {
94
94
-
sandboxProfile = ''
95
95
-
(allow network-inbound (local ip))
96
96
-
(allow mach-lookup (global-name "com.apple.FSEvents"))
97
97
-
'';
98
98
-
__darwinAllowLocalNetworking = true;
99
99
-
}) (lib.optionalString (runtime != null) ''
100
100
-
# TODO: use runtime here
101
101
-
export DOTNET_ROOT=${runtime}
102
102
-
'' + run);
131
131
+
{
132
132
+
version = testers.testVersion (
133
133
+
{
134
134
+
package = finalAttrs.finalPackage;
135
135
+
}
136
136
+
// lib.optionalAttrs (type != "sdk") {
137
137
+
command = "dotnet --info";
138
138
+
}
139
139
+
);
140
140
+
}
141
141
+
// lib.optionalAttrs (type == "sdk") (
142
142
+
{
143
143
+
console = mkDotnetTest {
144
144
+
name = "console";
145
145
+
template = "console";
146
146
+
build = checkConsoleOutput "dotnet run";
147
147
+
};
103
148
104
104
-
# Setting LANG to something other than 'C' forces the runtime to search
105
105
-
# for ICU, which will be required in most user environments.
106
106
-
checkConsoleOutput = command: ''
107
107
-
output="$(LANG=C.UTF-8 ${command})"
108
108
-
# yes, older SDKs omit the comma
109
109
-
[[ "$output" =~ Hello,?\ World! ]] && touch "$out"
110
110
-
'';
111
111
-
in {
112
112
-
version = testers.testVersion ({
113
113
-
package = finalAttrs.finalPackage;
114
114
-
} // lib.optionalAttrs (type != "sdk") {
115
115
-
command = "dotnet --info";
116
116
-
});
117
117
-
}
118
118
-
// lib.optionalAttrs (type == "sdk") ({
119
119
-
console = mkDotnetTest {
120
120
-
name = "console";
121
121
-
template = "console";
122
122
-
build = checkConsoleOutput "dotnet run";
123
123
-
};
149
149
+
publish = mkDotnetTest {
150
150
+
name = "publish";
151
151
+
template = "console";
152
152
+
build = "dotnet publish -o $out/bin";
153
153
+
run = checkConsoleOutput "$src/bin/test";
154
154
+
};
124
155
125
125
-
publish = mkDotnetTest {
126
126
-
name = "publish";
127
127
-
template = "console";
128
128
-
build = "dotnet publish -o $out/bin";
129
129
-
run = checkConsoleOutput "$src/bin/test";
130
130
-
};
156
156
+
self-contained = mkDotnetTest {
157
157
+
name = "self-contained";
158
158
+
template = "console";
159
159
+
usePackageSource = true;
160
160
+
build = "dotnet publish --use-current-runtime --sc -o $out";
161
161
+
runtime = null;
162
162
+
run = checkConsoleOutput "$src/test";
163
163
+
};
131
164
132
132
-
self-contained = mkDotnetTest {
133
133
-
name = "self-contained";
134
134
-
template = "console";
135
135
-
usePackageSource = true;
136
136
-
build = "dotnet publish --use-current-runtime --sc -o $out";
137
137
-
runtime = null;
138
138
-
run = checkConsoleOutput "$src/test";
139
139
-
};
165
165
+
single-file = mkDotnetTest {
166
166
+
name = "single-file";
167
167
+
template = "console";
168
168
+
usePackageSource = true;
169
169
+
build = "dotnet publish --use-current-runtime -p:PublishSingleFile=true -o $out/bin";
170
170
+
runtime = null;
171
171
+
run = checkConsoleOutput "$src/bin/test";
172
172
+
};
140
173
141
141
-
single-file = mkDotnetTest {
142
142
-
name = "single-file";
143
143
-
template = "console";
144
144
-
usePackageSource = true;
145
145
-
build = "dotnet publish --use-current-runtime -p:PublishSingleFile=true -o $out/bin";
146
146
-
runtime = null;
147
147
-
run = checkConsoleOutput "$src/bin/test";
148
148
-
};
149
149
-
150
150
-
web = mkDotnetTest {
151
151
-
name = "web";
152
152
-
template = "web";
153
153
-
build = "dotnet publish -o $out/bin";
154
154
-
runInputs = [ expect curl ];
155
155
-
run = ''
156
156
-
expect <<"EOF"
157
157
-
set status 1
158
158
-
spawn $env(src)/bin/test
159
159
-
proc abort { } { exit 2 }
160
160
-
expect_before default abort
161
161
-
expect -re {Now listening on: ([^\r]+)\r} {
162
162
-
set url $expect_out(1,string)
163
163
-
}
164
164
-
expect "Application started. Press Ctrl+C to shut down."
165
165
-
set output [exec curl -sSf $url]
166
166
-
if {$output != "Hello World!"} {
167
167
-
send_error "Unexpected output: $output\n"
168
168
-
exit 1
169
169
-
}
170
170
-
send \x03
171
171
-
expect_before timeout abort
172
172
-
expect eof
173
173
-
catch wait result
174
174
-
exit [lindex $result 3]
175
175
-
EOF
176
176
-
touch $out
177
177
-
'';
178
178
-
runAllowNetworking = true;
179
179
-
};
180
180
-
} // lib.optionalAttrs finalAttrs.finalPackage.hasILCompiler {
181
181
-
aot = mkDotnetTest {
182
182
-
name = "aot";
183
183
-
stdenv = if stdenv.hostPlatform.isDarwin then swiftPackages.stdenv else stdenv;
184
184
-
template = "console";
185
185
-
usePackageSource = true;
186
186
-
buildInputs =
187
187
-
[ zlib
188
188
-
] ++ lib.optional stdenv.hostPlatform.isDarwin (with darwin; with apple_sdk.frameworks; [
189
189
-
swiftPackages.swift
190
190
-
Foundation
191
191
-
CryptoKit
192
192
-
GSS
193
193
-
ICU
194
194
-
]);
195
195
-
build = ''
196
196
-
dotnet restore -p:PublishAot=true
197
197
-
dotnet publish -p:PublishAot=true -o $out/bin
198
198
-
'';
199
199
-
runtime = null;
200
200
-
run = checkConsoleOutput "$src/bin/test";
201
201
-
};
202
202
-
}) // args.passthru.tests or {};
203
203
-
} // args.passthru or {};
204
204
-
})
174
174
+
web = mkDotnetTest {
175
175
+
name = "web";
176
176
+
template = "web";
177
177
+
build = "dotnet publish -o $out/bin";
178
178
+
runInputs = [
179
179
+
expect
180
180
+
curl
181
181
+
];
182
182
+
run = ''
183
183
+
expect <<"EOF"
184
184
+
set status 1
185
185
+
spawn $env(src)/bin/test
186
186
+
proc abort { } { exit 2 }
187
187
+
expect_before default abort
188
188
+
expect -re {Now listening on: ([^\r]+)\r} {
189
189
+
set url $expect_out(1,string)
190
190
+
}
191
191
+
expect "Application started. Press Ctrl+C to shut down."
192
192
+
set output [exec curl -sSf $url]
193
193
+
if {$output != "Hello World!"} {
194
194
+
send_error "Unexpected output: $output\n"
195
195
+
exit 1
196
196
+
}
197
197
+
send \x03
198
198
+
expect_before timeout abort
199
199
+
expect eof
200
200
+
catch wait result
201
201
+
exit [lindex $result 3]
202
202
+
EOF
203
203
+
touch $out
204
204
+
'';
205
205
+
runAllowNetworking = true;
206
206
+
};
207
207
+
}
208
208
+
// lib.optionalAttrs finalAttrs.finalPackage.hasILCompiler {
209
209
+
aot = mkDotnetTest {
210
210
+
name = "aot";
211
211
+
stdenv = if stdenv.hostPlatform.isDarwin then swiftPackages.stdenv else stdenv;
212
212
+
template = "console";
213
213
+
usePackageSource = true;
214
214
+
buildInputs =
215
215
+
[
216
216
+
zlib
217
217
+
]
218
218
+
++ lib.optional stdenv.hostPlatform.isDarwin (
219
219
+
with darwin;
220
220
+
with apple_sdk.frameworks;
221
221
+
[
222
222
+
swiftPackages.swift
223
223
+
Foundation
224
224
+
CryptoKit
225
225
+
GSS
226
226
+
ICU
227
227
+
]
228
228
+
);
229
229
+
build = ''
230
230
+
dotnet restore -p:PublishAot=true
231
231
+
dotnet publish -p:PublishAot=true -o $out/bin
232
232
+
'';
233
233
+
runtime = null;
234
234
+
run = checkConsoleOutput "$src/bin/test";
235
235
+
};
236
236
+
}
237
237
+
)
238
238
+
// args.passthru.tests or { };
239
239
+
} // args.passthru or { };
240
240
+
}
241
241
+
)
+29
-19
pkgs/development/compilers/dotnet/default.nix
reviewed
···
1
1
/*
2
2
-
How to combine packages for use in development:
3
3
-
dotnetCombined = with dotnetCorePackages; combinePackages [ sdk_6_0 aspnetcore_7_0 ];
2
2
+
How to combine packages for use in development:
3
3
+
dotnetCombined = with dotnetCorePackages; combinePackages [ sdk_6_0 aspnetcore_7_0 ];
4
4
5
5
-
Hashes and urls are retrieved from:
6
6
-
https://dotnet.microsoft.com/download/dotnet
5
5
+
Hashes and urls are retrieved from:
6
6
+
https://dotnet.microsoft.com/download/dotnet
7
7
*/
8
8
-
{ lib
9
9
-
, config
10
10
-
, recurseIntoAttrs
11
11
-
, generateSplicesForMkScope
12
12
-
, makeScopeWithSplicing'
8
8
+
{
9
9
+
lib,
10
10
+
config,
11
11
+
recurseIntoAttrs,
12
12
+
generateSplicesForMkScope,
13
13
+
makeScopeWithSplicing',
13
14
}:
14
15
15
16
makeScopeWithSplicing' {
16
17
otherSplices = generateSplicesForMkScope "dotnetCorePackages";
17
17
-
f = (self:
18
18
+
f = (
19
19
+
self:
18
20
let
19
21
callPackage = self.callPackage;
20
22
21
21
-
buildDotnet = attrs: callPackage (import ./build-dotnet.nix attrs) {};
23
23
+
buildDotnet = attrs: callPackage (import ./build-dotnet.nix attrs) { };
22
24
buildAttrs = {
23
25
buildAspNetCore = attrs: buildDotnet (attrs // { type = "aspnetcore"; });
24
26
buildNetRuntime = attrs: buildDotnet (attrs // { type = "runtime"; });
···
40
42
"i686-windows" = "win-x86";
41
43
};
42
44
43
43
-
in {
45
45
+
in
46
46
+
{
44
47
inherit callPackage;
45
48
46
49
# Convert a "stdenv.hostPlatform.system" to a dotnet RID
47
47
-
systemToDotnetRid = system: runtimeIdentifierMap.${system} or (throw "unsupported platform ${system}");
50
50
+
systemToDotnetRid =
51
51
+
system: runtimeIdentifierMap.${system} or (throw "unsupported platform ${system}");
48
52
49
49
-
combinePackages = attrs: callPackage (import ./combine-packages.nix attrs) {};
53
53
+
combinePackages = attrs: callPackage (import ./combine-packages.nix attrs) { };
50
54
51
51
-
patchNupkgs = callPackage ./patch-nupkgs.nix {};
52
52
-
nugetPackageHook = callPackage ./nuget-package-hook.nix {};
55
55
+
patchNupkgs = callPackage ./patch-nupkgs.nix { };
56
56
+
nugetPackageHook = callPackage ./nuget-package-hook.nix { };
53
57
54
58
buildDotnetModule = callPackage ../../../build-support/dotnet/build-dotnet-module { };
55
59
buildDotnetGlobalTool = callPackage ../../../build-support/dotnet/build-dotnet-global-tool { };
···
60
64
fetchNupkg = callPackage ../../../build-support/dotnet/fetch-nupkg { };
61
65
62
66
dotnet_8 = recurseIntoAttrs (callPackage ./8 { bootstrapSdk = dotnet_8_0.sdk_8_0_1xx; });
63
63
-
dotnet_9 = recurseIntoAttrs (callPackage ./9 {});
64
64
-
} // lib.optionalAttrs config.allowAliases {
67
67
+
dotnet_9 = recurseIntoAttrs (callPackage ./9 { });
68
68
+
}
69
69
+
// lib.optionalAttrs config.allowAliases {
65
70
# EOL
66
71
sdk_2_1 = throw "Dotnet SDK 2.1 is EOL, please use 6.0 (LTS) or 7.0 (Current)";
67
72
sdk_2_2 = throw "Dotnet SDK 2.2 is EOL, please use 6.0 (LTS) or 7.0 (Current)";
68
73
sdk_3_0 = throw "Dotnet SDK 3.0 is EOL, please use 6.0 (LTS) or 7.0 (Current)";
69
74
sdk_3_1 = throw "Dotnet SDK 3.1 is EOL, please use 6.0 (LTS) or 7.0 (Current)";
70
75
sdk_5_0 = throw "Dotnet SDK 5.0 is EOL, please use 6.0 (LTS) or 7.0 (Current)";
71
71
-
} // dotnet_6_0 // dotnet_7_0 // dotnet_8_0 // dotnet_9_0);
76
76
+
}
77
77
+
// dotnet_6_0
78
78
+
// dotnet_7_0
79
79
+
// dotnet_8_0
80
80
+
// dotnet_9_0
81
81
+
);
72
82
}
+20
-15
pkgs/development/compilers/dotnet/dotnet.nix
reviewed
···
1
1
-
{ callPackage
2
2
-
, lib
3
3
-
, releaseManifestFile
4
4
-
, releaseInfoFile
5
5
-
, allowPrerelease ? false
6
6
-
, depsFile
7
7
-
, bootstrapSdk
8
8
-
, pkgsBuildHost
1
1
+
{
2
2
+
callPackage,
3
3
+
lib,
4
4
+
releaseManifestFile,
5
5
+
releaseInfoFile,
6
6
+
allowPrerelease ? false,
7
7
+
depsFile,
8
8
+
bootstrapSdk,
9
9
+
pkgsBuildHost,
9
10
}:
10
11
11
12
let
···
14
15
pkgs = callPackage ./stage1.nix {
15
16
inherit releaseManifestFile tarballHash depsFile;
16
17
bootstrapSdk =
17
17
-
{ stdenvNoCC
18
18
-
, dotnetCorePackages
19
19
-
, fetchurl
20
20
-
}: bootstrapSdk.overrideAttrs (old: {
21
21
-
passthru = old.passthru or {} // {
18
18
+
{
19
19
+
stdenvNoCC,
20
20
+
dotnetCorePackages,
21
21
+
fetchurl,
22
22
+
}:
23
23
+
bootstrapSdk.overrideAttrs (old: {
24
24
+
passthru = old.passthru or { } // {
22
25
artifacts = stdenvNoCC.mkDerivation rec {
23
26
name = lib.nameFromURL artifactsUrl ".tar.gz";
24
27
···
38
41
});
39
42
};
40
43
41
41
-
in pkgs // {
42
42
-
vmr = pkgs.vmr.overrideAttrs(old: {
44
44
+
in
45
45
+
pkgs
46
46
+
// {
47
47
+
vmr = pkgs.vmr.overrideAttrs (old: {
43
48
passthru = old.passthru // {
44
49
updateScript = pkgsBuildHost.callPackage ./update.nix {
45
50
inherit releaseManifestFile releaseInfoFile allowPrerelease;
+15
-9
pkgs/development/compilers/dotnet/packages.nix
reviewed
···
1
1
-
{ stdenv
2
2
-
, callPackage
3
3
-
, vmr
4
4
-
, xmlstarlet
5
5
-
, strip-nondeterminism
6
6
-
, zip
1
1
+
{
2
2
+
stdenv,
3
3
+
callPackage,
4
4
+
vmr,
5
5
+
xmlstarlet,
6
6
+
strip-nondeterminism,
7
7
+
zip,
7
8
}:
8
9
9
10
let
10
10
-
mkCommon = callPackage ./common.nix {};
11
11
+
mkCommon = callPackage ./common.nix { };
11
12
inherit (vmr) targetRid releaseManifest;
12
13
13
13
-
in {
14
14
+
in
15
15
+
{
14
16
inherit vmr;
15
17
sdk = mkCommon "sdk" rec {
16
18
pname = "dotnet-sdk";
···
25
27
zip
26
28
];
27
29
28
28
-
outputs = [ "out" "packages" "artifacts" ];
30
30
+
outputs = [
31
31
+
"out"
32
32
+
"packages"
33
33
+
"artifacts"
34
34
+
];
29
35
30
36
installPhase = ''
31
37
runHook preInstall
+87
-78
pkgs/development/compilers/dotnet/patch-nupkgs.nix
reviewed
···
1
1
-
{ stdenv
2
2
-
, lib
3
3
-
, zlib
4
4
-
, curl
5
5
-
, icu
6
6
-
, libunwind
7
7
-
, libuuid
8
8
-
, openssl
9
9
-
, lttng-ust_2_12
10
10
-
, patchelf
11
11
-
, writeShellScriptBin
1
1
+
{
2
2
+
stdenv,
3
3
+
lib,
4
4
+
zlib,
5
5
+
curl,
6
6
+
icu,
7
7
+
libunwind,
8
8
+
libuuid,
9
9
+
openssl,
10
10
+
lttng-ust_2_12,
11
11
+
patchelf,
12
12
+
writeShellScriptBin,
12
13
}:
13
14
14
15
let
15
15
-
binaryRPath = lib.makeLibraryPath ([
16
16
-
stdenv.cc.cc
17
17
-
zlib
18
18
-
curl
19
19
-
icu
20
20
-
libunwind
21
21
-
libuuid
22
22
-
openssl
23
23
-
] ++ lib.optional stdenv.hostPlatform.isLinux lttng-ust_2_12);
16
16
+
binaryRPath = lib.makeLibraryPath (
17
17
+
[
18
18
+
stdenv.cc.cc
19
19
+
zlib
20
20
+
curl
21
21
+
icu
22
22
+
libunwind
23
23
+
libuuid
24
24
+
openssl
25
25
+
]
26
26
+
++ lib.optional stdenv.hostPlatform.isLinux lttng-ust_2_12
27
27
+
);
24
28
25
25
-
in writeShellScriptBin "patch-nupkgs" (''
26
26
-
set -euo pipefail
27
27
-
shopt -s nullglob
28
28
-
isELF() {
29
29
-
local fn="$1"
30
30
-
local fd
31
31
-
local magic
32
32
-
exec {fd}< "$fn"
33
33
-
read -r -n 4 -u "$fd" magic
34
34
-
exec {fd}<&-
35
35
-
if [ "$magic" = $'\177ELF' ]; then return 0; else return 1; fi
36
36
-
}
37
37
-
cd "$1"
38
38
-
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
39
39
-
for x in */* */*; do
40
40
-
# .nupkg.metadata is written last, so we know the packages is complete
41
41
-
[[ -d "$x" ]] && [[ -f "$x"/.nupkg.metadata ]] \
42
42
-
&& [[ ! -f "$x"/.nix-patched ]] || continue
43
43
-
echo "Patching package $x"
44
44
-
find "$x" -type f -print0 | while IFS= read -rd "" p; do
45
45
-
if [[ "$p" != *.nix-patched ]] \
46
46
-
&& isELF "$p" \
47
47
-
&& ${patchelf}/bin/patchelf --print-interpreter "$p" &>/dev/null; then
48
48
-
tmp="$p".$$.nix-patched
49
49
-
# if this fails to copy then another process must have patched it
50
50
-
cp --reflink=auto "$p" "$tmp" || continue
51
51
-
echo "Patchelfing $p as $tmp"
52
52
-
${patchelf}/bin/patchelf \
53
53
-
--set-interpreter "${stdenv.cc.bintools.dynamicLinker}" \
54
54
-
"$tmp" ||:
55
55
-
# This makes sure that if the binary requires some specific runtime dependencies, it can find it.
56
56
-
# This fixes dotnet-built binaries like crossgen2
57
57
-
${patchelf}/bin/patchelf \
58
58
-
--add-needed libicui18n.so \
59
59
-
--add-needed libicuuc.so \
60
60
-
--add-needed libz.so \
61
61
-
--add-needed libssl.so \
62
62
-
"$tmp"
63
63
-
${patchelf}/bin/patchelf \
64
64
-
--add-rpath "${binaryRPath}" \
65
65
-
"$tmp" ||:
66
66
-
mv "$tmp" "$p"
67
67
-
fi
29
29
+
in
30
30
+
writeShellScriptBin "patch-nupkgs" (
31
31
+
''
32
32
+
set -euo pipefail
33
33
+
shopt -s nullglob
34
34
+
isELF() {
35
35
+
local fn="$1"
36
36
+
local fd
37
37
+
local magic
38
38
+
exec {fd}< "$fn"
39
39
+
read -r -n 4 -u "$fd" magic
40
40
+
exec {fd}<&-
41
41
+
if [ "$magic" = $'\177ELF' ]; then return 0; else return 1; fi
42
42
+
}
43
43
+
cd "$1"
44
44
+
''
45
45
+
+ lib.optionalString stdenv.hostPlatform.isLinux ''
46
46
+
for x in */* */*; do
47
47
+
# .nupkg.metadata is written last, so we know the packages is complete
48
48
+
[[ -d "$x" ]] && [[ -f "$x"/.nupkg.metadata ]] \
49
49
+
&& [[ ! -f "$x"/.nix-patched ]] || continue
50
50
+
echo "Patching package $x"
51
51
+
find "$x" -type f -print0 | while IFS= read -rd "" p; do
52
52
+
if [[ "$p" != *.nix-patched ]] \
53
53
+
&& isELF "$p" \
54
54
+
&& ${patchelf}/bin/patchelf --print-interpreter "$p" &>/dev/null; then
55
55
+
tmp="$p".$$.nix-patched
56
56
+
# if this fails to copy then another process must have patched it
57
57
+
cp --reflink=auto "$p" "$tmp" || continue
58
58
+
echo "Patchelfing $p as $tmp"
59
59
+
${patchelf}/bin/patchelf \
60
60
+
--set-interpreter "${stdenv.cc.bintools.dynamicLinker}" \
61
61
+
"$tmp" ||:
62
62
+
# This makes sure that if the binary requires some specific runtime dependencies, it can find it.
63
63
+
# This fixes dotnet-built binaries like crossgen2
64
64
+
${patchelf}/bin/patchelf \
65
65
+
--add-needed libicui18n.so \
66
66
+
--add-needed libicuuc.so \
67
67
+
--add-needed libz.so \
68
68
+
--add-needed libssl.so \
69
69
+
"$tmp"
70
70
+
${patchelf}/bin/patchelf \
71
71
+
--add-rpath "${binaryRPath}" \
72
72
+
"$tmp" ||:
73
73
+
mv "$tmp" "$p"
74
74
+
fi
75
75
+
done
76
76
+
touch "$x"/.nix-patched
77
77
+
done
78
78
+
''
79
79
+
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
80
80
+
for x in microsoft.dotnet.ilcompiler/*; do
81
81
+
# .nupkg.metadata is written last, so we know the packages is complete
82
82
+
[[ -d "$x" ]] && [[ -f "$x"/.nupkg.metadata ]] \
83
83
+
&& [[ ! -f "$x"/.nix-patched-ilcompiler ]] || continue
84
84
+
echo "Patching package $x"
85
85
+
pushd "$x"
86
86
+
sed -i 's: -no_code_signature_warning::g' build/Microsoft.NETCore.Native.targets
87
87
+
sed -i 's:Include="-ld_classic"::g' build/Microsoft.NETCore.Native.Unix.targets
88
88
+
touch .nix-patched-ilcompiler
89
89
+
popd
68
90
done
69
69
-
touch "$x"/.nix-patched
70
70
-
done
71
71
-
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
72
72
-
for x in microsoft.dotnet.ilcompiler/*; do
73
73
-
# .nupkg.metadata is written last, so we know the packages is complete
74
74
-
[[ -d "$x" ]] && [[ -f "$x"/.nupkg.metadata ]] \
75
75
-
&& [[ ! -f "$x"/.nix-patched-ilcompiler ]] || continue
76
76
-
echo "Patching package $x"
77
77
-
pushd "$x"
78
78
-
sed -i 's: -no_code_signature_warning::g' build/Microsoft.NETCore.Native.targets
79
79
-
sed -i 's:Include="-ld_classic"::g' build/Microsoft.NETCore.Native.Unix.targets
80
80
-
touch .nix-patched-ilcompiler
81
81
-
popd
82
82
-
done
83
83
-
'')
91
91
+
''
92
92
+
)
+6
-4
pkgs/development/compilers/dotnet/sign-apphost.nix
reviewed
···
1
1
-
{ substituteAll
2
2
-
, callPackage
1
1
+
{
2
2
+
substituteAll,
3
3
+
callPackage,
3
4
}:
4
5
let
5
5
-
sigtool = callPackage ./sigtool.nix {};
6
6
+
sigtool = callPackage ./sigtool.nix { };
6
7
7
7
-
in substituteAll {
8
8
+
in
9
9
+
substituteAll {
8
10
src = ./sign-apphost.proj;
9
11
codesign = "${sigtool}/bin/codesign";
10
12
}
+13
-10
pkgs/development/compilers/dotnet/sigtool.nix
reviewed
···
1
1
-
{ cctools
2
2
-
, darwin
3
3
-
, fetchFromGitHub
4
4
-
, makeWrapper
1
1
+
{
2
2
+
cctools,
3
3
+
darwin,
4
4
+
fetchFromGitHub,
5
5
+
makeWrapper,
5
6
}:
6
7
7
8
darwin.sigtool.overrideAttrs (old: {
···
14
15
sha256 = "sha256-EVM5ZG3sAHrIXuWrnqA9/4pDkJOpWCeBUl5fh0mkK4k=";
15
16
};
16
17
17
17
-
nativeBuildInputs = old.nativeBuildInputs or [] ++ [
18
18
+
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
18
19
makeWrapper
19
20
];
20
21
21
21
-
postInstall = old.postInstall or "" + ''
22
22
-
wrapProgram $out/bin/codesign \
23
23
-
--set-default CODESIGN_ALLOCATE \
24
24
-
"${cctools}/bin/${cctools.targetPrefix}codesign_allocate"
25
25
-
'';
22
22
+
postInstall =
23
23
+
old.postInstall or ""
24
24
+
+ ''
25
25
+
wrapProgram $out/bin/codesign \
26
26
+
--set-default CODESIGN_ALLOCATE \
27
27
+
"${cctools}/bin/${cctools.targetPrefix}codesign_allocate"
28
28
+
'';
26
29
})
+112
-101
pkgs/development/compilers/dotnet/stage0.nix
reviewed
···
1
1
-
{ stdenv
2
2
-
, callPackage
3
3
-
, lib
4
4
-
, writeShellScript
5
5
-
, mkNugetDeps
6
6
-
, nix
7
7
-
, cacert
8
8
-
, nuget-to-nix
9
9
-
, dotnetCorePackages
10
10
-
, xmlstarlet
11
11
-
, patchNupkgs
1
1
+
{
2
2
+
stdenv,
3
3
+
callPackage,
4
4
+
lib,
5
5
+
writeShellScript,
6
6
+
mkNugetDeps,
7
7
+
nix,
8
8
+
cacert,
9
9
+
nuget-to-nix,
10
10
+
dotnetCorePackages,
11
11
+
xmlstarlet,
12
12
+
patchNupkgs,
12
13
13
13
-
, releaseManifestFile
14
14
-
, tarballHash
15
15
-
, depsFile
16
16
-
, bootstrapSdk
14
14
+
releaseManifestFile,
15
15
+
tarballHash,
16
16
+
depsFile,
17
17
+
bootstrapSdk,
17
18
}:
18
19
19
20
let
20
21
mkPackages = callPackage ./packages.nix;
21
22
mkVMR = callPackage ./vmr.nix;
22
23
23
23
-
dotnetSdk = callPackage bootstrapSdk {};
24
24
+
dotnetSdk = callPackage bootstrapSdk { };
24
25
25
26
deps = mkNugetDeps {
26
27
name = "dotnet-vmr-deps";
···
31
32
installable = true;
32
33
};
33
34
34
34
-
vmr = (mkVMR {
35
35
-
inherit releaseManifestFile tarballHash dotnetSdk;
36
36
-
}).overrideAttrs (old: rec {
37
37
-
prebuiltPackages = mkNugetDeps {
38
38
-
name = "dotnet-vmr-deps";
39
39
-
sourceFile = depsFile;
40
40
-
installable = true;
41
41
-
};
35
35
+
vmr =
36
36
+
(mkVMR {
37
37
+
inherit releaseManifestFile tarballHash dotnetSdk;
38
38
+
}).overrideAttrs
39
39
+
(old: rec {
40
40
+
prebuiltPackages = mkNugetDeps {
41
41
+
name = "dotnet-vmr-deps";
42
42
+
sourceFile = depsFile;
43
43
+
installable = true;
44
44
+
};
42
45
43
43
-
nativeBuildInputs =
44
44
-
old.nativeBuildInputs or []
45
45
-
++ [ xmlstarlet patchNupkgs ];
46
46
+
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
47
47
+
xmlstarlet
48
48
+
patchNupkgs
49
49
+
];
46
50
47
47
-
postPatch = old.postPatch or "" + ''
48
48
-
xmlstarlet ed \
49
49
-
--inplace \
50
50
-
-s //Project -t elem -n Import \
51
51
-
-i \$prev -t attr -n Project -v "${./patch-restored-packages.proj}" \
52
52
-
src/*/Directory.Build.targets
53
53
-
'';
51
51
+
postPatch =
52
52
+
old.postPatch or ""
53
53
+
+ ''
54
54
+
xmlstarlet ed \
55
55
+
--inplace \
56
56
+
-s //Project -t elem -n Import \
57
57
+
-i \$prev -t attr -n Project -v "${./patch-restored-packages.proj}" \
58
58
+
src/*/Directory.Build.targets
59
59
+
'';
54
60
55
55
-
postConfigure = old.postConfigure or "" + ''
56
56
-
[[ ! -v prebuiltPackages ]] || \
57
57
-
ln -sf "$prebuiltPackages"/share/nuget/source/*/*/*.nupkg prereqs/packages/prebuilt/
58
58
-
ln -sf "${sdkPackages}"/share/nuget/source/*/*/*.nupkg prereqs/packages/prebuilt/
59
59
-
'';
61
61
+
postConfigure =
62
62
+
old.postConfigure or ""
63
63
+
+ ''
64
64
+
[[ ! -v prebuiltPackages ]] || \
65
65
+
ln -sf "$prebuiltPackages"/share/nuget/source/*/*/*.nupkg prereqs/packages/prebuilt/
66
66
+
ln -sf "${sdkPackages}"/share/nuget/source/*/*/*.nupkg prereqs/packages/prebuilt/
67
67
+
'';
60
68
61
61
-
buildFlags =
62
62
-
old.buildFlags
63
63
-
++ lib.optionals (lib.versionAtLeast old.version "9") [
64
64
-
# We need to set this as long as we have something in deps.nix. Currently
65
65
-
# that's the portable ilasm/ildasm which aren't in the centos sourcebuilt
66
66
-
# artifacts.
67
67
-
"-p:SkipErrorOnPrebuilts=true"
68
68
-
];
69
69
+
buildFlags =
70
70
+
old.buildFlags
71
71
+
++ lib.optionals (lib.versionAtLeast old.version "9") [
72
72
+
# We need to set this as long as we have something in deps.nix. Currently
73
73
+
# that's the portable ilasm/ildasm which aren't in the centos sourcebuilt
74
74
+
# artifacts.
75
75
+
"-p:SkipErrorOnPrebuilts=true"
76
76
+
];
69
77
70
70
-
passthru = old.passthru or {} // { fetch-deps =
71
71
-
let
72
72
-
inherit (vmr) targetRid updateScript;
73
73
-
otherRids =
74
74
-
lib.remove targetRid (
75
75
-
map (system: dotnetCorePackages.systemToDotnetRid system)
76
76
-
vmr.meta.platforms);
78
78
+
passthru = old.passthru or { } // {
79
79
+
fetch-deps =
80
80
+
let
81
81
+
inherit (vmr) targetRid updateScript;
82
82
+
otherRids = lib.remove targetRid (
83
83
+
map (system: dotnetCorePackages.systemToDotnetRid system) vmr.meta.platforms
84
84
+
);
77
85
78
78
-
pkg = vmr.overrideAttrs (old: {
79
79
-
nativeBuildInputs = old.nativeBuildInputs ++ [
80
80
-
nix
81
81
-
cacert
82
82
-
nuget-to-nix
83
83
-
];
84
84
-
postPatch = old.postPatch or "" + ''
85
85
-
xmlstarlet ed \
86
86
-
--inplace \
87
87
-
-s //Project -t elem -n Import \
88
88
-
-i \$prev -t attr -n Project -v "${./record-downloaded-packages.proj}" \
89
89
-
repo-projects/Directory.Build.targets
90
90
-
# make nuget-client use the standard arcade package-cache dir, which
91
91
-
# is where we scan for dependencies
92
92
-
xmlstarlet ed \
93
93
-
--inplace \
94
94
-
-s //Project -t elem -n ItemGroup \
95
95
-
-s \$prev -t elem -n EnvironmentVariables \
96
96
-
-i \$prev -t attr -n Include -v 'NUGET_PACKAGES=$(ProjectDirectory)artifacts/sb/package-cache/' \
97
97
-
repo-projects/nuget-client.proj
98
98
-
'';
99
99
-
buildFlags = [ "--online" ] ++ old.buildFlags;
100
100
-
prebuiltPackages = null;
101
101
-
});
86
86
+
pkg = vmr.overrideAttrs (old: {
87
87
+
nativeBuildInputs = old.nativeBuildInputs ++ [
88
88
+
nix
89
89
+
cacert
90
90
+
nuget-to-nix
91
91
+
];
92
92
+
postPatch =
93
93
+
old.postPatch or ""
94
94
+
+ ''
95
95
+
xmlstarlet ed \
96
96
+
--inplace \
97
97
+
-s //Project -t elem -n Import \
98
98
+
-i \$prev -t attr -n Project -v "${./record-downloaded-packages.proj}" \
99
99
+
repo-projects/Directory.Build.targets
100
100
+
# make nuget-client use the standard arcade package-cache dir, which
101
101
+
# is where we scan for dependencies
102
102
+
xmlstarlet ed \
103
103
+
--inplace \
104
104
+
-s //Project -t elem -n ItemGroup \
105
105
+
-s \$prev -t elem -n EnvironmentVariables \
106
106
+
-i \$prev -t attr -n Include -v 'NUGET_PACKAGES=$(ProjectDirectory)artifacts/sb/package-cache/' \
107
107
+
repo-projects/nuget-client.proj
108
108
+
'';
109
109
+
buildFlags = [ "--online" ] ++ old.buildFlags;
110
110
+
prebuiltPackages = null;
111
111
+
});
102
112
103
103
-
drv = builtins.unsafeDiscardOutputDependency pkg.drvPath;
104
104
-
in
105
105
-
writeShellScript "fetch-dotnet-sdk-deps" ''
106
106
-
${nix}/bin/nix-shell --pure --run 'source /dev/stdin' "${drv}" << 'EOF'
107
107
-
set -e
113
113
+
drv = builtins.unsafeDiscardOutputDependency pkg.drvPath;
114
114
+
in
115
115
+
writeShellScript "fetch-dotnet-sdk-deps" ''
116
116
+
${nix}/bin/nix-shell --pure --run 'source /dev/stdin' "${drv}" << 'EOF'
117
117
+
set -e
108
118
109
109
-
tmp=$(mktemp -d)
110
110
-
trap 'rm -fr "$tmp"' EXIT
119
119
+
tmp=$(mktemp -d)
120
120
+
trap 'rm -fr "$tmp"' EXIT
111
121
112
112
-
HOME=$tmp/.home
113
113
-
cd "$tmp"
122
122
+
HOME=$tmp/.home
123
123
+
cd "$tmp"
114
124
115
115
-
phases="''${prePhases[*]:-} unpackPhase patchPhase ''${preConfigurePhases[*]:-} \
116
116
-
configurePhase ''${preBuildPhases[*]:-} buildPhase checkPhase" \
117
117
-
genericBuild
125
125
+
phases="''${prePhases[*]:-} unpackPhase patchPhase ''${preConfigurePhases[*]:-} \
126
126
+
configurePhase ''${preBuildPhases[*]:-} buildPhase checkPhase" \
127
127
+
genericBuild
118
128
119
119
-
depsFiles=(./src/*/deps.nix)
129
129
+
depsFiles=(./src/*/deps.nix)
120
130
121
121
-
cat $(nix-build ${toString ./combine-deps.nix} \
122
122
-
--arg list "[ ''${depsFiles[*]} ]" \
123
123
-
--argstr baseRid ${targetRid} \
124
124
-
--arg otherRids '${lib.generators.toPretty { multiline = false; } otherRids}' \
125
125
-
) > "${toString prebuiltPackages.sourceFile}"
126
126
-
EOF
127
127
-
'';
128
128
-
};
129
129
-
});
130
130
-
in mkPackages { inherit vmr; }
131
131
+
cat $(nix-build ${toString ./combine-deps.nix} \
132
132
+
--arg list "[ ''${depsFiles[*]} ]" \
133
133
+
--argstr baseRid ${targetRid} \
134
134
+
--arg otherRids '${lib.generators.toPretty { multiline = false; } otherRids}' \
135
135
+
) > "${toString prebuiltPackages.sourceFile}"
136
136
+
EOF
137
137
+
'';
138
138
+
};
139
139
+
});
140
140
+
in
141
141
+
mkPackages { inherit vmr; }
+20
-16
pkgs/development/compilers/dotnet/stage1.nix
reviewed
···
1
1
-
{ stdenv
2
2
-
, lib
3
3
-
, callPackage
1
1
+
{
2
2
+
stdenv,
3
3
+
lib,
4
4
+
callPackage,
4
5
5
5
-
, releaseManifestFile
6
6
-
, tarballHash
7
7
-
, depsFile
8
8
-
, bootstrapSdk
6
6
+
releaseManifestFile,
7
7
+
tarballHash,
8
8
+
depsFile,
9
9
+
bootstrapSdk,
9
10
}@args:
10
11
11
12
let
···
14
15
15
16
stage0 = callPackage ./stage0.nix args;
16
17
17
17
-
vmr = (mkVMR {
18
18
-
inherit releaseManifestFile tarballHash;
19
19
-
dotnetSdk = stage0.sdk;
20
20
-
}).overrideAttrs (old: {
21
21
-
passthru = old.passthru or {} // {
22
22
-
inherit (stage0.vmr) fetch-deps;
23
23
-
};
24
24
-
});
18
18
+
vmr =
19
19
+
(mkVMR {
20
20
+
inherit releaseManifestFile tarballHash;
21
21
+
dotnetSdk = stage0.sdk;
22
22
+
}).overrideAttrs
23
23
+
(old: {
24
24
+
passthru = old.passthru or { } // {
25
25
+
inherit (stage0.vmr) fetch-deps;
26
26
+
};
27
27
+
});
25
28
26
26
-
in mkPackages { inherit vmr; } // { stage0 = lib.dontRecurseIntoAttrs stage0; }
29
29
+
in
30
30
+
mkPackages { inherit vmr; } // { stage0 = lib.dontRecurseIntoAttrs stage0; }
+17
-15
pkgs/development/compilers/dotnet/update.nix
reviewed
···
1
1
-
{ stdenvNoCC
2
2
-
, lib
3
3
-
, fetchurl
4
4
-
, writeScript
5
5
-
, nix
6
6
-
, runtimeShell
7
7
-
, curl
8
8
-
, cacert
9
9
-
, jq
10
10
-
, yq
11
11
-
, gnupg
1
1
+
{
2
2
+
stdenvNoCC,
3
3
+
lib,
4
4
+
fetchurl,
5
5
+
writeScript,
6
6
+
nix,
7
7
+
runtimeShell,
8
8
+
curl,
9
9
+
cacert,
10
10
+
jq,
11
11
+
yq,
12
12
+
gnupg,
12
13
13
13
-
, releaseManifestFile
14
14
-
, releaseInfoFile
15
15
-
, allowPrerelease
14
14
+
releaseManifestFile,
15
15
+
releaseInfoFile,
16
16
+
allowPrerelease,
16
17
}:
17
18
18
19
let
···
38
39
39
40
drv = builtins.unsafeDiscardOutputDependency pkg.drvPath;
40
41
41
41
-
in writeScript "update-dotnet-vmr.sh" ''
42
42
+
in
43
43
+
writeScript "update-dotnet-vmr.sh" ''
42
44
#! ${nix}/bin/nix-shell
43
45
#! nix-shell -i ${runtimeShell} --pure ${drv}
44
46
set -euo pipefail
+314
-298
pkgs/development/compilers/dotnet/vmr.nix
reviewed
···
1
1
-
{ clangStdenv
2
2
-
, lib
3
3
-
, fetchurl
4
4
-
, dotnetCorePackages
5
5
-
, jq
6
6
-
, curl
7
7
-
, git
8
8
-
, cmake
9
9
-
, pkg-config
10
10
-
, llvm
11
11
-
, zlib
12
12
-
, icu
13
13
-
, lttng-ust_2_12
14
14
-
, krb5
15
15
-
, glibcLocales
16
16
-
, ensureNewerSourcesForZipFilesHook
17
17
-
, darwin
18
18
-
, xcbuild
19
19
-
, swiftPackages
20
20
-
, openssl
21
21
-
, getconf
22
22
-
, python3
23
23
-
, xmlstarlet
24
24
-
, nodejs
25
25
-
, callPackage
26
26
-
, unzip
27
27
-
, yq
1
1
+
{
2
2
+
clangStdenv,
3
3
+
lib,
4
4
+
fetchurl,
5
5
+
dotnetCorePackages,
6
6
+
jq,
7
7
+
curl,
8
8
+
git,
9
9
+
cmake,
10
10
+
pkg-config,
11
11
+
llvm,
12
12
+
zlib,
13
13
+
icu,
14
14
+
lttng-ust_2_12,
15
15
+
krb5,
16
16
+
glibcLocales,
17
17
+
ensureNewerSourcesForZipFilesHook,
18
18
+
darwin,
19
19
+
xcbuild,
20
20
+
swiftPackages,
21
21
+
openssl,
22
22
+
getconf,
23
23
+
python3,
24
24
+
xmlstarlet,
25
25
+
nodejs,
26
26
+
callPackage,
27
27
+
unzip,
28
28
+
yq,
28
29
29
29
-
, dotnetSdk
30
30
-
, releaseManifestFile
31
31
-
, tarballHash
30
30
+
dotnetSdk,
31
31
+
releaseManifestFile,
32
32
+
tarballHash,
32
33
}:
33
34
34
35
let
35
35
-
stdenv = if clangStdenv.hostPlatform.isDarwin
36
36
-
then swiftPackages.stdenv
37
37
-
else clangStdenv;
36
36
+
stdenv = if clangStdenv.hostPlatform.isDarwin then swiftPackages.stdenv else clangStdenv;
38
37
39
38
inherit (stdenv)
40
39
isLinux
41
40
isDarwin
42
41
buildPlatform
43
43
-
targetPlatform;
42
42
+
targetPlatform
43
43
+
;
44
44
inherit (swiftPackages) apple_sdk swift;
45
45
46
46
releaseManifest = lib.importJSON releaseManifestFile;
···
50
50
targetRid = dotnetCorePackages.systemToDotnetRid targetPlatform.system;
51
51
targetArch = lib.elemAt (lib.splitString "-" targetRid) 1;
52
52
53
53
-
sigtool = callPackage ./sigtool.nix {};
53
53
+
sigtool = callPackage ./sigtool.nix { };
54
54
55
55
_icu = if isDarwin then darwin.ICU else icu;
56
56
57
57
-
in stdenv.mkDerivation rec {
57
57
+
in
58
58
+
stdenv.mkDerivation rec {
58
59
pname = "dotnet-vmr";
59
60
version = release;
60
61
···
69
70
hash = tarballHash;
70
71
};
71
72
72
72
-
nativeBuildInputs = [
73
73
-
ensureNewerSourcesForZipFilesHook
74
74
-
jq
75
75
-
curl.bin
76
76
-
git
77
77
-
cmake
78
78
-
pkg-config
79
79
-
python3
80
80
-
xmlstarlet
81
81
-
unzip
82
82
-
yq
83
83
-
]
84
84
-
++ lib.optionals (lib.versionAtLeast version "9") [
85
85
-
nodejs
86
86
-
]
87
87
-
++ lib.optionals isDarwin [
88
88
-
getconf
89
89
-
];
73
73
+
nativeBuildInputs =
74
74
+
[
75
75
+
ensureNewerSourcesForZipFilesHook
76
76
+
jq
77
77
+
curl.bin
78
78
+
git
79
79
+
cmake
80
80
+
pkg-config
81
81
+
python3
82
82
+
xmlstarlet
83
83
+
unzip
84
84
+
yq
85
85
+
]
86
86
+
++ lib.optionals (lib.versionAtLeast version "9") [
87
87
+
nodejs
88
88
+
]
89
89
+
++ lib.optionals isDarwin [
90
90
+
getconf
91
91
+
];
90
92
91
91
-
buildInputs = [
92
92
-
# this gets copied into the tree, but we still want the hooks to run
93
93
-
dotnetSdk
94
94
-
# the propagated build inputs in llvm.dev break swift compilation
95
95
-
llvm.out
96
96
-
zlib
97
97
-
_icu
98
98
-
openssl
99
99
-
]
100
100
-
++ lib.optionals isLinux [
101
101
-
krb5
102
102
-
lttng-ust_2_12
103
103
-
]
104
104
-
++ lib.optionals isDarwin (with apple_sdk.frameworks; [
105
105
-
xcbuild
106
106
-
swift
107
107
-
(krb5.overrideAttrs (old: {
108
108
-
# the propagated build inputs break swift compilation
109
109
-
buildInputs = old.buildInputs ++ old.propagatedBuildInputs;
110
110
-
propagatedBuildInputs = [];
111
111
-
}))
112
112
-
sigtool
113
113
-
Foundation
114
114
-
CoreFoundation
115
115
-
CryptoKit
116
116
-
System
117
117
-
]
118
118
-
++ lib.optional (lib.versionAtLeast version "9") GSS);
93
93
+
buildInputs =
94
94
+
[
95
95
+
# this gets copied into the tree, but we still want the hooks to run
96
96
+
dotnetSdk
97
97
+
# the propagated build inputs in llvm.dev break swift compilation
98
98
+
llvm.out
99
99
+
zlib
100
100
+
_icu
101
101
+
openssl
102
102
+
]
103
103
+
++ lib.optionals isLinux [
104
104
+
krb5
105
105
+
lttng-ust_2_12
106
106
+
]
107
107
+
++ lib.optionals isDarwin (
108
108
+
with apple_sdk.frameworks;
109
109
+
[
110
110
+
xcbuild
111
111
+
swift
112
112
+
(krb5.overrideAttrs (old: {
113
113
+
# the propagated build inputs break swift compilation
114
114
+
buildInputs = old.buildInputs ++ old.propagatedBuildInputs;
115
115
+
propagatedBuildInputs = [ ];
116
116
+
}))
117
117
+
sigtool
118
118
+
Foundation
119
119
+
CoreFoundation
120
120
+
CryptoKit
121
121
+
System
122
122
+
]
123
123
+
++ lib.optional (lib.versionAtLeast version "9") GSS
124
124
+
);
119
125
120
126
# This is required to fix the error:
121
127
# > CSSM_ModuleLoad(): One or more parameters passed to a function were not valid.
···
136
142
./fix-aspnetcore-portable-build.patch
137
143
];
138
144
139
139
-
postPatch = ''
140
140
-
# set the sdk version in global.json to match the bootstrap sdk
141
141
-
jq '(.tools.dotnet=$dotnet)' global.json --arg dotnet "$(${dotnetSdk}/bin/dotnet --version)" > global.json~
142
142
-
mv global.json{~,}
145
145
+
postPatch =
146
146
+
''
147
147
+
# set the sdk version in global.json to match the bootstrap sdk
148
148
+
jq '(.tools.dotnet=$dotnet)' global.json --arg dotnet "$(${dotnetSdk}/bin/dotnet --version)" > global.json~
149
149
+
mv global.json{~,}
143
150
144
144
-
patchShebangs $(find -name \*.sh -type f -executable)
151
151
+
patchShebangs $(find -name \*.sh -type f -executable)
145
152
146
146
-
# I'm not sure why this is required, but these files seem to use the wrong
147
147
-
# property name.
148
148
-
# TODO: not needed in 9.0?
149
149
-
[[ ! -f src/xliff-tasks/eng/Versions.props ]] || \
150
150
-
sed -i 's:\bVersionBase\b:VersionPrefix:g' \
151
151
-
src/xliff-tasks/eng/Versions.props
153
153
+
# I'm not sure why this is required, but these files seem to use the wrong
154
154
+
# property name.
155
155
+
# TODO: not needed in 9.0?
156
156
+
[[ ! -f src/xliff-tasks/eng/Versions.props ]] || \
157
157
+
sed -i 's:\bVersionBase\b:VersionPrefix:g' \
158
158
+
src/xliff-tasks/eng/Versions.props
152
159
153
153
-
# at least in 9.0 preview 1, this package depends on a specific beta build
154
154
-
# of System.CommandLine
155
155
-
xmlstarlet ed \
156
156
-
--inplace \
157
157
-
-s //Project -t elem -n PropertyGroup \
158
158
-
-s \$prev -t elem -n NoWarn -v '$(NoWarn);NU1603' \
159
159
-
src/nuget-client/src/NuGet.Core/NuGet.CommandLine.XPlat/NuGet.CommandLine.XPlat.csproj
160
160
+
# at least in 9.0 preview 1, this package depends on a specific beta build
161
161
+
# of System.CommandLine
162
162
+
xmlstarlet ed \
163
163
+
--inplace \
164
164
+
-s //Project -t elem -n PropertyGroup \
165
165
+
-s \$prev -t elem -n NoWarn -v '$(NoWarn);NU1603' \
166
166
+
src/nuget-client/src/NuGet.Core/NuGet.CommandLine.XPlat/NuGet.CommandLine.XPlat.csproj
160
167
161
161
-
# AD0001 crashes intermittently in source-build-reference-packages with
162
162
-
# CSC : error AD0001: Analyzer 'Microsoft.NetCore.CSharp.Analyzers.Runtime.CSharpDetectPreviewFeatureAnalyzer' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'.
163
163
-
# possibly related to https://github.com/dotnet/runtime/issues/90356
164
164
-
xmlstarlet ed \
165
165
-
--inplace \
166
166
-
-s //Project -t elem -n PropertyGroup \
167
167
-
-s \$prev -t elem -n NoWarn -v '$(NoWarn);AD0001' \
168
168
-
src/source-build-reference-packages/src/referencePackages/Directory.Build.props
168
168
+
# AD0001 crashes intermittently in source-build-reference-packages with
169
169
+
# CSC : error AD0001: Analyzer 'Microsoft.NetCore.CSharp.Analyzers.Runtime.CSharpDetectPreviewFeatureAnalyzer' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'.
170
170
+
# possibly related to https://github.com/dotnet/runtime/issues/90356
171
171
+
xmlstarlet ed \
172
172
+
--inplace \
173
173
+
-s //Project -t elem -n PropertyGroup \
174
174
+
-s \$prev -t elem -n NoWarn -v '$(NoWarn);AD0001' \
175
175
+
src/source-build-reference-packages/src/referencePackages/Directory.Build.props
169
176
170
170
-
# https://github.com/microsoft/ApplicationInsights-dotnet/issues/2848
171
171
-
xmlstarlet ed \
172
172
-
--inplace \
173
173
-
-u //_:Project/_:PropertyGroup/_:BuildNumber -v 0 \
174
174
-
src/source-build-externals/src/application-insights/.props/_GlobalStaticVersion.props
177
177
+
# https://github.com/microsoft/ApplicationInsights-dotnet/issues/2848
178
178
+
xmlstarlet ed \
179
179
+
--inplace \
180
180
+
-u //_:Project/_:PropertyGroup/_:BuildNumber -v 0 \
181
181
+
src/source-build-externals/src/application-insights/.props/_GlobalStaticVersion.props
175
182
176
176
-
# this fixes compile errors with clang 15 (e.g. darwin)
177
177
-
substituteInPlace \
178
178
-
src/runtime/src/native/libs/CMakeLists.txt \
179
179
-
--replace-fail 'add_compile_options(-Weverything)' 'add_compile_options(-Wall)'
183
183
+
# this fixes compile errors with clang 15 (e.g. darwin)
184
184
+
substituteInPlace \
185
185
+
src/runtime/src/native/libs/CMakeLists.txt \
186
186
+
--replace-fail 'add_compile_options(-Weverything)' 'add_compile_options(-Wall)'
180
187
181
181
-
# strip native symbols in runtime
182
182
-
# see: https://github.com/dotnet/source-build/issues/2543
183
183
-
xmlstarlet ed \
184
184
-
--inplace \
185
185
-
-s //Project -t elem -n PropertyGroup \
186
186
-
-s \$prev -t elem -n KeepNativeSymbols -v false \
187
187
-
src/runtime/Directory.Build.props
188
188
-
''
189
189
-
+ lib.optionalString (lib.versionAtLeast version "9") ''
190
190
-
# repro.csproj fails to restore due to missing freebsd packages
191
191
-
xmlstarlet ed \
192
192
-
--inplace \
193
193
-
-s //Project -t elem -n PropertyGroup \
194
194
-
-s \$prev -t elem -n RuntimeIdentifiers -v ${targetRid} \
195
195
-
src/runtime/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj
188
188
+
# strip native symbols in runtime
189
189
+
# see: https://github.com/dotnet/source-build/issues/2543
190
190
+
xmlstarlet ed \
191
191
+
--inplace \
192
192
+
-s //Project -t elem -n PropertyGroup \
193
193
+
-s \$prev -t elem -n KeepNativeSymbols -v false \
194
194
+
src/runtime/Directory.Build.props
195
195
+
''
196
196
+
+ lib.optionalString (lib.versionAtLeast version "9") ''
197
197
+
# repro.csproj fails to restore due to missing freebsd packages
198
198
+
xmlstarlet ed \
199
199
+
--inplace \
200
200
+
-s //Project -t elem -n PropertyGroup \
201
201
+
-s \$prev -t elem -n RuntimeIdentifiers -v ${targetRid} \
202
202
+
src/runtime/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj
196
203
197
197
-
# https://github.com/dotnet/runtime/pull/98559#issuecomment-1965338627
198
198
-
xmlstarlet ed \
199
199
-
--inplace \
200
200
-
-s //Project -t elem -n PropertyGroup \
201
201
-
-s \$prev -t elem -n NoWarn -v '$(NoWarn);CS9216' \
202
202
-
src/runtime/Directory.Build.props
204
204
+
# https://github.com/dotnet/runtime/pull/98559#issuecomment-1965338627
205
205
+
xmlstarlet ed \
206
206
+
--inplace \
207
207
+
-s //Project -t elem -n PropertyGroup \
208
208
+
-s \$prev -t elem -n NoWarn -v '$(NoWarn);CS9216' \
209
209
+
src/runtime/Directory.Build.props
203
210
204
204
-
# patch packages installed from npm cache
205
205
-
xmlstarlet ed \
206
206
-
--inplace \
207
207
-
-s //Project -t elem -n Import \
208
208
-
-i \$prev -t attr -n Project -v "${./patch-npm-packages.proj}" \
209
209
-
src/aspnetcore/eng/DotNetBuild.props
210
210
-
''
211
211
-
+ lib.optionalString (lib.versionAtLeast version "9") ''
212
212
-
# https://github.com/dotnet/source-build/issues/3131#issuecomment-2030215805
213
213
-
substituteInPlace \
214
214
-
src/aspnetcore/eng/Dependencies.props \
215
215
-
--replace-fail \
216
216
-
"'\$(DotNetBuildSourceOnly)' == 'true'" \
217
217
-
"'\$(DotNetBuildSourceOnly)' == 'true' and \$(PortableBuild) == 'false'"
211
211
+
# patch packages installed from npm cache
212
212
+
xmlstarlet ed \
213
213
+
--inplace \
214
214
+
-s //Project -t elem -n Import \
215
215
+
-i \$prev -t attr -n Project -v "${./patch-npm-packages.proj}" \
216
216
+
src/aspnetcore/eng/DotNetBuild.props
217
217
+
''
218
218
+
+ lib.optionalString (lib.versionAtLeast version "9") ''
219
219
+
# https://github.com/dotnet/source-build/issues/3131#issuecomment-2030215805
220
220
+
substituteInPlace \
221
221
+
src/aspnetcore/eng/Dependencies.props \
222
222
+
--replace-fail \
223
223
+
"'\$(DotNetBuildSourceOnly)' == 'true'" \
224
224
+
"'\$(DotNetBuildSourceOnly)' == 'true' and \$(PortableBuild) == 'false'"
218
225
219
219
-
# https://github.com/dotnet/source-build/issues/4325
220
220
-
xmlstarlet ed \
221
221
-
--inplace \
222
222
-
-r '//Target[@Name="UnpackTarballs"]/Move' -v Copy \
223
223
-
eng/init-source-only.proj
226
226
+
# https://github.com/dotnet/source-build/issues/4325
227
227
+
xmlstarlet ed \
228
228
+
--inplace \
229
229
+
-r '//Target[@Name="UnpackTarballs"]/Move' -v Copy \
230
230
+
eng/init-source-only.proj
224
231
225
225
-
# error: _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror,-W#warnings]
226
226
-
substituteInPlace \
227
227
-
src/runtime/src/coreclr/ilasm/CMakeLists.txt \
228
228
-
--replace-fail 'set_source_files_properties( prebuilt/asmparse.cpp PROPERTIES COMPILE_FLAGS "-O0" )' ""
232
232
+
# error: _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror,-W#warnings]
233
233
+
substituteInPlace \
234
234
+
src/runtime/src/coreclr/ilasm/CMakeLists.txt \
235
235
+
--replace-fail 'set_source_files_properties( prebuilt/asmparse.cpp PROPERTIES COMPILE_FLAGS "-O0" )' ""
229
236
230
230
-
# https://github.com/dotnet/source-build/issues/4444
231
231
-
xmlstarlet ed \
232
232
-
--inplace \
233
233
-
-s '//Project/Target/MSBuild[@Targets="Restore"]' \
234
234
-
-t attr -n Properties -v "NUGET_PACKAGES='\$(CurrentRepoSourceBuildPackageCache)'" \
235
235
-
src/aspnetcore/eng/Tools.props
236
236
-
''
237
237
-
+ lib.optionalString isLinux (''
238
238
-
substituteInPlace \
239
239
-
src/runtime/src/native/libs/System.Security.Cryptography.Native/opensslshim.c \
240
240
-
--replace-fail '"libssl.so"' '"${openssl.out}/lib/libssl.so"'
237
237
+
# https://github.com/dotnet/source-build/issues/4444
238
238
+
xmlstarlet ed \
239
239
+
--inplace \
240
240
+
-s '//Project/Target/MSBuild[@Targets="Restore"]' \
241
241
+
-t attr -n Properties -v "NUGET_PACKAGES='\$(CurrentRepoSourceBuildPackageCache)'" \
242
242
+
src/aspnetcore/eng/Tools.props
243
243
+
''
244
244
+
+ lib.optionalString isLinux (
245
245
+
''
246
246
+
substituteInPlace \
247
247
+
src/runtime/src/native/libs/System.Security.Cryptography.Native/opensslshim.c \
248
248
+
--replace-fail '"libssl.so"' '"${openssl.out}/lib/libssl.so"'
241
249
242
242
-
substituteInPlace \
243
243
-
src/runtime/src/native/libs/System.Net.Security.Native/pal_gssapi.c \
244
244
-
--replace-fail '"libgssapi_krb5.so.2"' '"${lib.getLib krb5}/lib/libgssapi_krb5.so.2"'
250
250
+
substituteInPlace \
251
251
+
src/runtime/src/native/libs/System.Net.Security.Native/pal_gssapi.c \
252
252
+
--replace-fail '"libgssapi_krb5.so.2"' '"${lib.getLib krb5}/lib/libgssapi_krb5.so.2"'
245
253
246
246
-
substituteInPlace \
247
247
-
src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \
248
248
-
--replace-fail '"libicui18n.so"' '"${icu}/lib/libicui18n.so"' \
249
249
-
--replace-fail '"libicuuc.so"' '"${icu}/lib/libicuuc.so"'
250
250
-
''
251
251
-
+ lib.optionalString (lib.versionAtLeast version "9") ''
252
252
-
substituteInPlace \
253
253
-
src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \
254
254
-
--replace-fail '#define VERSIONED_LIB_NAME_LEN 64' '#define VERSIONED_LIB_NAME_LEN 256'
255
255
-
''
256
256
-
+ lib.optionalString (lib.versionOlder version "9") ''
257
257
-
substituteInPlace \
258
258
-
src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \
259
259
-
--replace-warn 'libicuucName[64]' 'libicuucName[256]' \
260
260
-
--replace-warn 'libicui18nName[64]' 'libicui18nName[256]'
261
261
-
'')
262
262
-
+ lib.optionalString isDarwin (''
263
263
-
substituteInPlace \
264
264
-
src/runtime/src/native/libs/System.Globalization.Native/CMakeLists.txt \
265
265
-
--replace-fail '/usr/lib/libicucore.dylib' '${darwin.ICU}/lib/libicucore.dylib'
254
254
+
substituteInPlace \
255
255
+
src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \
256
256
+
--replace-fail '"libicui18n.so"' '"${icu}/lib/libicui18n.so"' \
257
257
+
--replace-fail '"libicuuc.so"' '"${icu}/lib/libicuuc.so"'
258
258
+
''
259
259
+
+ lib.optionalString (lib.versionAtLeast version "9") ''
260
260
+
substituteInPlace \
261
261
+
src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \
262
262
+
--replace-fail '#define VERSIONED_LIB_NAME_LEN 64' '#define VERSIONED_LIB_NAME_LEN 256'
263
263
+
''
264
264
+
+ lib.optionalString (lib.versionOlder version "9") ''
265
265
+
substituteInPlace \
266
266
+
src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \
267
267
+
--replace-warn 'libicuucName[64]' 'libicuucName[256]' \
268
268
+
--replace-warn 'libicui18nName[64]' 'libicui18nName[256]'
269
269
+
''
270
270
+
)
271
271
+
+ lib.optionalString isDarwin (
272
272
+
''
273
273
+
substituteInPlace \
274
274
+
src/runtime/src/native/libs/System.Globalization.Native/CMakeLists.txt \
275
275
+
--replace-fail '/usr/lib/libicucore.dylib' '${darwin.ICU}/lib/libicucore.dylib'
266
276
267
267
-
substituteInPlace \
268
268
-
src/runtime/src/installer/managed/Microsoft.NET.HostModel/HostModelUtils.cs \
269
269
-
src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets \
270
270
-
--replace-fail '/usr/bin/codesign' '${sigtool}/bin/codesign'
277
277
+
substituteInPlace \
278
278
+
src/runtime/src/installer/managed/Microsoft.NET.HostModel/HostModelUtils.cs \
279
279
+
src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets \
280
280
+
--replace-fail '/usr/bin/codesign' '${sigtool}/bin/codesign'
271
281
272
272
-
# fix: strip: error: unknown argument '-n'
273
273
-
substituteInPlace \
274
274
-
src/runtime/eng/native/functions.cmake \
275
275
-
--replace-fail ' -no_code_signature_warning' ""
282
282
+
# fix: strip: error: unknown argument '-n'
283
283
+
substituteInPlace \
284
284
+
src/runtime/eng/native/functions.cmake \
285
285
+
--replace-fail ' -no_code_signature_warning' ""
276
286
277
277
-
# [...]/installer.singlerid.targets(434,5): error MSB3073: The command "pkgbuild [...]" exited with code 127
278
278
-
xmlstarlet ed \
279
279
-
--inplace \
280
280
-
-s //Project -t elem -n PropertyGroup \
281
281
-
-s \$prev -t elem -n SkipInstallerBuild -v true \
282
282
-
src/runtime/Directory.Build.props
287
287
+
# [...]/installer.singlerid.targets(434,5): error MSB3073: The command "pkgbuild [...]" exited with code 127
288
288
+
xmlstarlet ed \
289
289
+
--inplace \
290
290
+
-s //Project -t elem -n PropertyGroup \
291
291
+
-s \$prev -t elem -n SkipInstallerBuild -v true \
292
292
+
src/runtime/Directory.Build.props
283
293
284
284
-
# stop passing -sdk without a path
285
285
-
# stop using xcrun
286
286
-
# add -module-cache-path to fix swift errors, see sandboxProfile
287
287
-
# <unknown>:0: error: unable to open output file '/var/folders/[...]/C/clang/ModuleCache/[...]/SwiftShims-[...].pcm': 'Operation not permitted'
288
288
-
# <unknown>:0: error: could not build Objective-C module 'SwiftShims'
289
289
-
substituteInPlace \
290
290
-
src/runtime/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt \
291
291
-
--replace-fail ' -sdk ''${CMAKE_OSX_SYSROOT}' "" \
292
292
-
--replace-fail 'xcrun swiftc' 'swiftc -module-cache-path "$ENV{HOME}/.cache/module-cache"'
293
293
-
''
294
294
-
+ lib.optionalString (lib.versionAtLeast version "9") ''
295
295
-
# fix: strip: error: unknown argument '-n'
296
296
-
substituteInPlace \
297
297
-
src/runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets \
298
298
-
src/runtime/src/native/managed/native-library.targets \
299
299
-
--replace-fail ' -no_code_signature_warning' ""
294
294
+
# stop passing -sdk without a path
295
295
+
# stop using xcrun
296
296
+
# add -module-cache-path to fix swift errors, see sandboxProfile
297
297
+
# <unknown>:0: error: unable to open output file '/var/folders/[...]/C/clang/ModuleCache/[...]/SwiftShims-[...].pcm': 'Operation not permitted'
298
298
+
# <unknown>:0: error: could not build Objective-C module 'SwiftShims'
299
299
+
substituteInPlace \
300
300
+
src/runtime/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt \
301
301
+
--replace-fail ' -sdk ''${CMAKE_OSX_SYSROOT}' "" \
302
302
+
--replace-fail 'xcrun swiftc' 'swiftc -module-cache-path "$ENV{HOME}/.cache/module-cache"'
303
303
+
''
304
304
+
+ lib.optionalString (lib.versionAtLeast version "9") ''
305
305
+
# fix: strip: error: unknown argument '-n'
306
306
+
substituteInPlace \
307
307
+
src/runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets \
308
308
+
src/runtime/src/native/managed/native-library.targets \
309
309
+
--replace-fail ' -no_code_signature_warning' ""
300
310
301
301
-
# ld: library not found for -ld_classic
302
302
-
substituteInPlace \
303
303
-
src/runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets \
304
304
-
src/runtime/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj \
305
305
-
--replace-fail 'Include="-ld_classic"' ""
306
306
-
''
307
307
-
+ lib.optionalString (lib.versionOlder version "9") ''
308
308
-
# [...]/build.proj(123,5): error : Did not find PDBs for the following SDK files:
309
309
-
# [...]/build.proj(123,5): error : sdk/8.0.102/System.Resources.Extensions.dll
310
310
-
# [...]/build.proj(123,5): error : sdk/8.0.102/System.CodeDom.dll
311
311
-
# [...]/build.proj(123,5): error : sdk/8.0.102/FSharp/System.Resources.Extensions.dll
312
312
-
# [...]/build.proj(123,5): error : sdk/8.0.102/FSharp/System.CodeDom.dll
313
313
-
substituteInPlace \
314
314
-
build.proj \
315
315
-
--replace-fail 'FailOnMissingPDBs="true"' 'FailOnMissingPDBs="false"'
311
311
+
# ld: library not found for -ld_classic
312
312
+
substituteInPlace \
313
313
+
src/runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets \
314
314
+
src/runtime/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj \
315
315
+
--replace-fail 'Include="-ld_classic"' ""
316
316
+
''
317
317
+
+ lib.optionalString (lib.versionOlder version "9") ''
318
318
+
# [...]/build.proj(123,5): error : Did not find PDBs for the following SDK files:
319
319
+
# [...]/build.proj(123,5): error : sdk/8.0.102/System.Resources.Extensions.dll
320
320
+
# [...]/build.proj(123,5): error : sdk/8.0.102/System.CodeDom.dll
321
321
+
# [...]/build.proj(123,5): error : sdk/8.0.102/FSharp/System.Resources.Extensions.dll
322
322
+
# [...]/build.proj(123,5): error : sdk/8.0.102/FSharp/System.CodeDom.dll
323
323
+
substituteInPlace \
324
324
+
build.proj \
325
325
+
--replace-fail 'FailOnMissingPDBs="true"' 'FailOnMissingPDBs="false"'
316
326
317
317
-
substituteInPlace \
318
318
-
src/runtime/src/mono/CMakeLists.txt \
319
319
-
--replace-fail '/usr/lib/libicucore.dylib' '${darwin.ICU}/lib/libicucore.dylib'
320
320
-
'');
327
327
+
substituteInPlace \
328
328
+
src/runtime/src/mono/CMakeLists.txt \
329
329
+
--replace-fail '/usr/lib/libicucore.dylib' '${darwin.ICU}/lib/libicucore.dylib'
330
330
+
''
331
331
+
);
321
332
322
333
prepFlags = [
323
334
"--no-artifacts"
324
335
"--no-prebuilts"
325
325
-
"--with-packages" dotnetSdk.artifacts
336
336
+
"--with-packages"
337
337
+
dotnetSdk.artifacts
326
338
];
327
339
328
328
-
configurePhase = let
329
329
-
prepScript =
330
330
-
if (lib.versionAtLeast version "9")
331
331
-
then "./prep-source-build.sh"
332
332
-
else "./prep.sh";
333
333
-
in ''
334
334
-
runHook preConfigure
340
340
+
configurePhase =
341
341
+
let
342
342
+
prepScript = if (lib.versionAtLeast version "9") then "./prep-source-build.sh" else "./prep.sh";
343
343
+
in
344
344
+
''
345
345
+
runHook preConfigure
335
346
336
336
-
# The build process tries to overwrite some things in the sdk (e.g.
337
337
-
# SourceBuild.MSBuildSdkResolver.dll), so it needs to be mutable.
338
338
-
cp -Tr ${dotnetSdk} .dotnet
339
339
-
chmod -R +w .dotnet
347
347
+
# The build process tries to overwrite some things in the sdk (e.g.
348
348
+
# SourceBuild.MSBuildSdkResolver.dll), so it needs to be mutable.
349
349
+
cp -Tr ${dotnetSdk} .dotnet
350
350
+
chmod -R +w .dotnet
340
351
341
341
-
${prepScript} $prepFlags
352
352
+
${prepScript} $prepFlags
342
353
343
343
-
runHook postConfigure
344
344
-
'';
354
354
+
runHook postConfigure
355
355
+
'';
345
356
346
357
postConfigure = lib.optionalString (lib.versionAtLeast version "9") ''
347
358
# see patch-npm-packages.proj
···
353
364
354
365
# https://github.com/NixOS/nixpkgs/issues/38991
355
366
# bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
356
356
-
LOCALE_ARCHIVE = lib.optionalString isLinux
357
357
-
"${glibcLocales}/lib/locale/locale-archive";
367
367
+
LOCALE_ARCHIVE = lib.optionalString isLinux "${glibcLocales}/lib/locale/locale-archive";
358
368
359
359
-
buildFlags = [
360
360
-
"--with-packages" dotnetSdk.artifacts
361
361
-
"--clean-while-building"
362
362
-
"--release-manifest" releaseManifestFile
363
363
-
]
364
364
-
++ lib.optionals (lib.versionAtLeast version "9") [
365
365
-
"--source-build"
366
366
-
]
367
367
-
++ [
368
368
-
"--"
369
369
-
"-p:PortableBuild=true"
370
370
-
] ++ lib.optional (targetRid != buildRid) "-p:TargetRid=${targetRid}";
369
369
+
buildFlags =
370
370
+
[
371
371
+
"--with-packages"
372
372
+
dotnetSdk.artifacts
373
373
+
"--clean-while-building"
374
374
+
"--release-manifest"
375
375
+
releaseManifestFile
376
376
+
]
377
377
+
++ lib.optionals (lib.versionAtLeast version "9") [
378
378
+
"--source-build"
379
379
+
]
380
380
+
++ [
381
381
+
"--"
382
382
+
"-p:PortableBuild=true"
383
383
+
]
384
384
+
++ lib.optional (targetRid != buildRid) "-p:TargetRid=${targetRid}";
371
385
372
386
buildPhase = ''
373
387
runHook preBuild
···
389
403
runHook postBuild
390
404
'';
391
405
392
392
-
installPhase = let
393
393
-
assets = if (lib.versionAtLeast version "9") then "assets" else targetArch;
394
394
-
in ''
395
395
-
runHook preInstall
406
406
+
installPhase =
407
407
+
let
408
408
+
assets = if (lib.versionAtLeast version "9") then "assets" else targetArch;
409
409
+
in
410
410
+
''
411
411
+
runHook preInstall
396
412
397
397
-
mkdir "$out"
413
413
+
mkdir "$out"
398
414
399
399
-
pushd "artifacts/${assets}/Release"
400
400
-
find . -name \*.tar.gz | while read archive; do
401
401
-
target=$out/$(basename "$archive" .tar.gz)
402
402
-
# dotnet 9 currently has two copies of the sdk tarball
403
403
-
[[ ! -e "$target" ]] || continue
404
404
-
mkdir "$target"
405
405
-
tar -C "$target" -xzf "$PWD/$archive"
406
406
-
done
407
407
-
popd
415
415
+
pushd "artifacts/${assets}/Release"
416
416
+
find . -name \*.tar.gz | while read archive; do
417
417
+
target=$out/$(basename "$archive" .tar.gz)
418
418
+
# dotnet 9 currently has two copies of the sdk tarball
419
419
+
[[ ! -e "$target" ]] || continue
420
420
+
mkdir "$target"
421
421
+
tar -C "$target" -xzf "$PWD/$archive"
422
422
+
done
423
423
+
popd
408
424
409
409
-
local -r unpacked="$PWD/.unpacked"
410
410
-
for nupkg in $out/Private.SourceBuilt.Artifacts.*.${targetRid}/{,SourceBuildReferencePackages/}*.nupkg; do
411
411
-
rm -rf "$unpacked"
412
412
-
unzip -qd "$unpacked" "$nupkg"
413
413
-
chmod -R +rw "$unpacked"
414
414
-
rm "$nupkg"
415
415
-
mv "$unpacked" "$nupkg"
416
416
-
# TODO: should we fix executable flags here? see dotnetInstallHook
417
417
-
done
425
425
+
local -r unpacked="$PWD/.unpacked"
426
426
+
for nupkg in $out/Private.SourceBuilt.Artifacts.*.${targetRid}/{,SourceBuildReferencePackages/}*.nupkg; do
427
427
+
rm -rf "$unpacked"
428
428
+
unzip -qd "$unpacked" "$nupkg"
429
429
+
chmod -R +rw "$unpacked"
430
430
+
rm "$nupkg"
431
431
+
mv "$unpacked" "$nupkg"
432
432
+
# TODO: should we fix executable flags here? see dotnetInstallHook
433
433
+
done
418
434
419
419
-
runHook postInstall
420
420
-
'';
435
435
+
runHook postInstall
436
436
+
'';
421
437
422
438
# dotnet cli is in the root, so we need to strip from there
423
439
# TODO: should we install in $out/share/dotnet?