lol

dotnet: format with nixfmt

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