diff --git a/pkgs/development/compilers/dotnet/build-dotnet.nix b/pkgs/development/compilers/dotnet/build-dotnet.nix
index bba31fe394ca..3e2a21d20c5f 100644
--- a/pkgs/development/compilers/dotnet/build-dotnet.nix
+++ b/pkgs/development/compilers/dotnet/build-dotnet.nix
@@ -1,33 +1,39 @@
-{ type
-, version
-, srcs
-, packages ? null
+{
+ type,
+ version,
+ srcs,
+ packages ? null,
}:
-assert builtins.elem type [ "aspnetcore" "runtime" "sdk" ];
+assert builtins.elem type [
+ "aspnetcore"
+ "runtime"
+ "sdk"
+];
assert if type == "sdk" then packages != null else true;
-{ lib
-, stdenv
-, fetchurl
-, writeText
-, autoPatchelfHook
-, makeWrapper
-, libunwind
-, icu
-, libuuid
-, zlib
-, libkrb5
-, openssl
-, curl
-, lttng-ust_2_12
-, testers
-, runCommand
-, writeShellScript
-, mkNugetDeps
-, callPackage
-, dotnetCorePackages
-, xmlstarlet
+{
+ lib,
+ stdenv,
+ fetchurl,
+ writeText,
+ autoPatchelfHook,
+ makeWrapper,
+ libunwind,
+ icu,
+ libuuid,
+ zlib,
+ libkrb5,
+ openssl,
+ curl,
+ lttng-ust_2_12,
+ testers,
+ runCommand,
+ writeShellScript,
+ mkNugetDeps,
+ callPackage,
+ dotnetCorePackages,
+ xmlstarlet,
}:
let
@@ -45,40 +51,52 @@ let
sdk = ".NET SDK ${version}";
};
- mkCommon = callPackage ./common.nix {};
+ mkCommon = callPackage ./common.nix { };
targetRid = dotnetCorePackages.systemToDotnetRid stdenv.targetPlatform.system;
- sigtool = callPackage ./sigtool.nix {};
- signAppHost = callPackage ./sign-apphost.nix {};
+ sigtool = callPackage ./sigtool.nix { };
+ signAppHost = callPackage ./sign-apphost.nix { };
- hasILCompiler =
- lib.versionAtLeast version (if targetRid == "osx-arm64" then "8" else "7");
+ hasILCompiler = lib.versionAtLeast version (if targetRid == "osx-arm64" then "8" else "7");
- extraTargets = writeText "extra.targets" (''
-
- '' + lib.optionalString hasILCompiler ''
+ extraTargets = writeText "extra.targets" (
+ ''
+
+ ''
+ + lib.optionalString hasILCompiler ''
-
+
- '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
+ ''
+ + lib.optionalString stdenv.hostPlatform.isDarwin ''
- '' + ''
-
- '');
+ ''
+ + ''
+
+ ''
+ );
in
mkCommon type rec {
inherit pname version;
# Some of these dependencies are `dlopen()`ed.
- nativeBuildInputs = [
- makeWrapper
- ] ++ lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook
- ++ lib.optionals (type == "sdk" && stdenv.hostPlatform.isDarwin) [
- xmlstarlet
- sigtool
- ];
+ nativeBuildInputs =
+ [
+ makeWrapper
+ ]
+ ++ lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook
+ ++ lib.optionals (type == "sdk" && stdenv.hostPlatform.isDarwin) [
+ xmlstarlet
+ sigtool
+ ];
buildInputs = [
stdenv.cc.cc
@@ -90,21 +108,28 @@ mkCommon type rec {
] ++ lib.optional stdenv.hostPlatform.isLinux lttng-ust_2_12;
src = fetchurl (
- srcs."${stdenv.hostPlatform.system}" or (throw
- "Missing source (url and hash) for host system: ${stdenv.hostPlatform.system}")
+ srcs."${stdenv.hostPlatform.system}"
+ or (throw "Missing source (url and hash) for host system: ${stdenv.hostPlatform.system}")
);
sourceRoot = ".";
- postPatch = if type == "sdk" then (''
- xmlstarlet ed \
- --inplace \
- -s //_:Project -t elem -n Import \
- -i \$prev -t attr -n Project -v "${extraTargets}" \
- sdk/*/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets
- '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
- codesign --remove-signature packs/Microsoft.NETCore.App.Host.osx-*/*/runtimes/osx-*/native/{apphost,singlefilehost}
- '') else null;
+ postPatch =
+ if type == "sdk" then
+ (
+ ''
+ xmlstarlet ed \
+ --inplace \
+ -s //_:Project -t elem -n Import \
+ -i \$prev -t attr -n Project -v "${extraTargets}" \
+ sdk/*/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets
+ ''
+ + lib.optionalString stdenv.hostPlatform.isDarwin ''
+ codesign --remove-signature packs/Microsoft.NETCore.App.Host.osx-*/*/runtimes/osx-*/native/{apphost,singlefilehost}
+ ''
+ )
+ else
+ null;
dontPatchELF = true;
noDumpEnvVars = true;
@@ -151,29 +176,34 @@ mkCommon type rec {
(global-name "com.apple.system.opendirectoryd.membership"))
'';
- passthru = {
- inherit icu hasILCompiler;
- } // lib.optionalAttrs (type == "sdk") {
- packages = mkNugetDeps {
- name = "${pname}-${version}-deps";
- nugetDeps = packages;
- };
+ passthru =
+ {
+ inherit icu hasILCompiler;
+ }
+ // lib.optionalAttrs (type == "sdk") {
+ packages = mkNugetDeps {
+ name = "${pname}-${version}-deps";
+ nugetDeps = packages;
+ };
- updateScript =
- let
- majorVersion = lib.concatStringsSep "." (lib.take 2 (lib.splitVersion version));
- in
- writeShellScript "update-dotnet-${majorVersion}" ''
- pushd pkgs/development/compilers/dotnet
- exec ${./update.sh} "${majorVersion}"
- '';
- };
+ updateScript =
+ let
+ majorVersion = lib.concatStringsSep "." (lib.take 2 (lib.splitVersion version));
+ in
+ writeShellScript "update-dotnet-${majorVersion}" ''
+ pushd pkgs/development/compilers/dotnet
+ exec ${./update.sh} "${majorVersion}"
+ '';
+ };
meta = with lib; {
description = builtins.getAttr type descriptions;
homepage = "https://dotnet.github.io/";
license = licenses.mit;
- maintainers = with maintainers; [ kuznero mdarocha ];
+ maintainers = with maintainers; [
+ kuznero
+ mdarocha
+ ];
mainProgram = "dotnet";
platforms = attrNames srcs;
};
diff --git a/pkgs/development/compilers/dotnet/combine-deps.nix b/pkgs/development/compilers/dotnet/combine-deps.nix
index af21c3aa248e..188c26cf27fa 100644
--- a/pkgs/development/compilers/dotnet/combine-deps.nix
+++ b/pkgs/development/compilers/dotnet/combine-deps.nix
@@ -2,7 +2,7 @@
list,
baseRid,
otherRids,
- pkgs ? import ../../../.. {}
+ pkgs ? import ../../../.. { },
}:
let
inherit (pkgs) writeText;
@@ -20,31 +20,36 @@ let
fns = map (file: import file) list;
- packages = unique
- (concatMap (fn: fn { fetchNuGet = package: package; }) fns);
+ packages = unique (concatMap (fn: fn { fetchNuGet = package: package; }) fns);
- changePackageRid = package: rid:
- let replace = replaceStrings [".${baseRid}"] [".${rid}"];
- in rec {
+ changePackageRid =
+ package: rid:
+ let
+ replace = replaceStrings [ ".${baseRid}" ] [ ".${rid}" ];
+ in
+ rec {
pname = replace package.pname;
inherit (package) version;
url = replace package.url;
sha256 = builtins.hashFile "sha256" (builtins.fetchurl url);
};
- expandPackage = package:
- [ package ] ++
- optionals (strings.match ".*\\.${baseRid}(\\..*|$)" package.pname != null)
- (map (changePackageRid package) otherRids);
+ expandPackage =
+ package:
+ [ package ]
+ ++ optionals (strings.match ".*\\.${baseRid}(\\..*|$)" package.pname != null) (
+ map (changePackageRid package) otherRids
+ );
- allPackages =
- sortOn (package: [ package.pname package.version ])
- (concatMap expandPackage packages);
+ allPackages = sortOn (package: [
+ package.pname
+ package.version
+ ]) (concatMap expandPackage packages);
- fetchExpr = package:
- " (fetchNuGet ${generators.toPretty { multiline = false; } package})";
+ fetchExpr = package: " (fetchNuGet ${generators.toPretty { multiline = false; } package})";
-in writeText "deps.nix" ''
+in
+writeText "deps.nix" ''
{ fetchNuGet }: [
${concatMapStringsSep "\n" fetchExpr allPackages}
]
diff --git a/pkgs/development/compilers/dotnet/combine-packages.nix b/pkgs/development/compilers/dotnet/combine-packages.nix
index 303e5eaba847..165b9fbef97c 100644
--- a/pkgs/development/compilers/dotnet/combine-packages.nix
+++ b/pkgs/development/compilers/dotnet/combine-packages.nix
@@ -1,37 +1,50 @@
dotnetPackages:
-{ buildEnv, makeWrapper, lib, symlinkJoin }:
+{
+ buildEnv,
+ makeWrapper,
+ lib,
+ symlinkJoin,
+}:
# TODO: Rethink how we determine and/or get the CLI.
# Possible options raised in #187118:
# 1. A separate argument for the CLI (as suggested by IvarWithoutBones
# 2. Use the highest version SDK for the CLI (as suggested by GGG)
# 3. Something else?
-let cli = builtins.head dotnetPackages;
+let
+ cli = builtins.head dotnetPackages;
in
-assert lib.assertMsg ((builtins.length dotnetPackages) > 0)
- ''You must include at least one package, e.g
- `with dotnetCorePackages; combinePackages [
- sdk_6_0 aspnetcore_7_0
- ];`'' ;
- buildEnv {
- name = "dotnet-core-combined";
- paths = dotnetPackages;
- pathsToLink = [ "/host" "/packs" "/sdk" "/sdk-manifests" "/shared" "/templates" ];
- ignoreCollisions = true;
- postBuild = ''
- cp -R ${cli}/{dotnet,share,nix-support} $out/
+assert lib.assertMsg ((builtins.length dotnetPackages) > 0) ''
+ You must include at least one package, e.g
+ `with dotnetCorePackages; combinePackages [
+ sdk_6_0 aspnetcore_7_0
+ ];`'';
+buildEnv {
+ name = "dotnet-core-combined";
+ paths = dotnetPackages;
+ pathsToLink = [
+ "/host"
+ "/packs"
+ "/sdk"
+ "/sdk-manifests"
+ "/shared"
+ "/templates"
+ ];
+ ignoreCollisions = true;
+ postBuild = ''
+ cp -R ${cli}/{dotnet,share,nix-support} $out/
- mkdir $out/bin
- ln -s $out/dotnet $out/bin/dotnet
- '';
- passthru = {
- inherit (cli) icu;
+ mkdir $out/bin
+ ln -s $out/dotnet $out/bin/dotnet
+ '';
+ passthru = {
+ inherit (cli) icu;
- versions = lib.catAttrs "version" dotnetPackages;
- packages = symlinkJoin {
- name = "combined-packages";
- paths = lib.remove null (lib.catAttrs "packages" dotnetPackages);
- };
+ versions = lib.catAttrs "version" dotnetPackages;
+ packages = symlinkJoin {
+ name = "combined-packages";
+ paths = lib.remove null (lib.catAttrs "packages" dotnetPackages);
};
+ };
- inherit (cli) meta;
- }
+ inherit (cli) meta;
+}
diff --git a/pkgs/development/compilers/dotnet/common.nix b/pkgs/development/compilers/dotnet/common.nix
index b4891a83e41f..4858e99eaa71 100644
--- a/pkgs/development/compilers/dotnet/common.nix
+++ b/pkgs/development/compilers/dotnet/common.nix
@@ -1,204 +1,241 @@
# TODO: switch to stdenvNoCC
-{ stdenv
-, stdenvNoCC
-, lib
-, writeText
-, testers
-, runCommand
-, runCommandWith
-, expect
-, curl
-, installShellFiles
-, callPackage
-, zlib
-, swiftPackages
-, darwin
-, icu
-, lndir
-, substituteAll
-, nugetPackageHook
-, xmlstarlet
-}: type: args: stdenv.mkDerivation (finalAttrs: args // {
- doInstallCheck = true;
+{
+ stdenv,
+ stdenvNoCC,
+ lib,
+ writeText,
+ testers,
+ runCommand,
+ runCommandWith,
+ expect,
+ curl,
+ installShellFiles,
+ callPackage,
+ zlib,
+ swiftPackages,
+ darwin,
+ icu,
+ lndir,
+ substituteAll,
+ nugetPackageHook,
+ xmlstarlet,
+}:
+type: args:
+stdenv.mkDerivation (
+ finalAttrs:
+ args
+ // {
+ doInstallCheck = true;
- # TODO: this should probably be postInstallCheck
- # TODO: send output to /dev/null
- installCheckPhase = args.installCheckPhase or "" + ''
- $out/bin/dotnet --info
- '';
-
- setupHooks = args.setupHooks or [] ++ [
- ./dotnet-setup-hook.sh
- ] ++ lib.optional (type == "sdk") (substituteAll {
- src = ./dotnet-sdk-setup-hook.sh;
- inherit lndir xmlstarlet;
- });
-
- propagatedBuildInputs =
- (args.propagatedBuildInputs or [ ])
- ++ lib.optional (type == "sdk") nugetPackageHook;
-
- nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ installShellFiles ];
-
- postInstall = ''
- # completions snippets taken from https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete
- installShellCompletion --cmd dotnet \
- --bash ${./completions/dotnet.bash} \
- --zsh ${./completions/dotnet.zsh} \
- --fish ${./completions/dotnet.fish}
- '';
-
- passthru = {
- tests = let
- mkDotnetTest =
- {
- name,
- stdenv ? stdenvNoCC,
- template,
- usePackageSource ? false,
- build,
- buildInputs ? [],
- # TODO: use correct runtimes instead of sdk
- runtime ? finalAttrs.finalPackage,
- runInputs ? [],
- run ? null,
- runAllowNetworking ? false,
- }:
- let
- sdk = finalAttrs.finalPackage;
- built = stdenv.mkDerivation {
- name = "dotnet-test-${name}";
- buildInputs =
- [ sdk ]
- ++ buildInputs
- ++ lib.optional (usePackageSource) sdk.packages;
- # make sure ICU works in a sandbox
- propagatedSandboxProfile = toString sdk.__propagatedSandboxProfile;
- unpackPhase = ''
- mkdir test
- cd test
- dotnet new ${template} -o .
- '';
- buildPhase = build;
- dontPatchELF = true;
- };
- in
- if run == null
- then built
- else
- runCommand "${built.name}-run" ({
- src = built;
- nativeBuildInputs = [ built ] ++ runInputs;
- passthru = { inherit built; };
- } // lib.optionalAttrs (stdenv.hostPlatform.isDarwin && runAllowNetworking) {
- sandboxProfile = ''
- (allow network-inbound (local ip))
- (allow mach-lookup (global-name "com.apple.FSEvents"))
- '';
- __darwinAllowLocalNetworking = true;
- }) (lib.optionalString (runtime != null) ''
- # TODO: use runtime here
- export DOTNET_ROOT=${runtime}
- '' + run);
-
- # Setting LANG to something other than 'C' forces the runtime to search
- # for ICU, which will be required in most user environments.
- checkConsoleOutput = command: ''
- output="$(LANG=C.UTF-8 ${command})"
- # yes, older SDKs omit the comma
- [[ "$output" =~ Hello,?\ World! ]] && touch "$out"
+ # TODO: this should probably be postInstallCheck
+ # TODO: send output to /dev/null
+ installCheckPhase =
+ args.installCheckPhase or ""
+ + ''
+ $out/bin/dotnet --info
'';
- in {
- version = testers.testVersion ({
- package = finalAttrs.finalPackage;
- } // lib.optionalAttrs (type != "sdk") {
- command = "dotnet --info";
+
+ setupHooks =
+ args.setupHooks or [ ]
+ ++ [
+ ./dotnet-setup-hook.sh
+ ]
+ ++ lib.optional (type == "sdk") (substituteAll {
+ src = ./dotnet-sdk-setup-hook.sh;
+ inherit lndir xmlstarlet;
});
- }
- // lib.optionalAttrs (type == "sdk") ({
- console = mkDotnetTest {
- name = "console";
- template = "console";
- build = checkConsoleOutput "dotnet run";
- };
- publish = mkDotnetTest {
- name = "publish";
- template = "console";
- build = "dotnet publish -o $out/bin";
- run = checkConsoleOutput "$src/bin/test";
- };
+ propagatedBuildInputs =
+ (args.propagatedBuildInputs or [ ])
+ ++ lib.optional (type == "sdk") nugetPackageHook;
- self-contained = mkDotnetTest {
- name = "self-contained";
- template = "console";
- usePackageSource = true;
- build = "dotnet publish --use-current-runtime --sc -o $out";
- runtime = null;
- run = checkConsoleOutput "$src/test";
- };
+ nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ installShellFiles ];
- single-file = mkDotnetTest {
- name = "single-file";
- template = "console";
- usePackageSource = true;
- build = "dotnet publish --use-current-runtime -p:PublishSingleFile=true -o $out/bin";
- runtime = null;
- run = checkConsoleOutput "$src/bin/test";
- };
+ postInstall = ''
+ # completions snippets taken from https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete
+ installShellCompletion --cmd dotnet \
+ --bash ${./completions/dotnet.bash} \
+ --zsh ${./completions/dotnet.zsh} \
+ --fish ${./completions/dotnet.fish}
+ '';
- web = mkDotnetTest {
- name = "web";
- template = "web";
- build = "dotnet publish -o $out/bin";
- runInputs = [ expect curl ];
- run = ''
- expect <<"EOF"
- set status 1
- spawn $env(src)/bin/test
- proc abort { } { exit 2 }
- expect_before default abort
- expect -re {Now listening on: ([^\r]+)\r} {
- set url $expect_out(1,string)
+ passthru = {
+ tests =
+ let
+ mkDotnetTest =
+ {
+ name,
+ stdenv ? stdenvNoCC,
+ template,
+ usePackageSource ? false,
+ build,
+ buildInputs ? [ ],
+ # TODO: use correct runtimes instead of sdk
+ runtime ? finalAttrs.finalPackage,
+ runInputs ? [ ],
+ run ? null,
+ runAllowNetworking ? false,
+ }:
+ let
+ sdk = finalAttrs.finalPackage;
+ built = stdenv.mkDerivation {
+ name = "dotnet-test-${name}";
+ buildInputs = [ sdk ] ++ buildInputs ++ lib.optional (usePackageSource) sdk.packages;
+ # make sure ICU works in a sandbox
+ propagatedSandboxProfile = toString sdk.__propagatedSandboxProfile;
+ unpackPhase = ''
+ mkdir test
+ cd test
+ dotnet new ${template} -o .
+ '';
+ buildPhase = build;
+ dontPatchELF = true;
+ };
+ in
+ if run == null then
+ built
+ else
+ runCommand "${built.name}-run"
+ (
+ {
+ src = built;
+ nativeBuildInputs = [ built ] ++ runInputs;
+ passthru = {
+ inherit built;
+ };
+ }
+ // lib.optionalAttrs (stdenv.hostPlatform.isDarwin && runAllowNetworking) {
+ sandboxProfile = ''
+ (allow network-inbound (local ip))
+ (allow mach-lookup (global-name "com.apple.FSEvents"))
+ '';
+ __darwinAllowLocalNetworking = true;
+ }
+ )
+ (
+ lib.optionalString (runtime != null) ''
+ # TODO: use runtime here
+ export DOTNET_ROOT=${runtime}
+ ''
+ + run
+ );
+
+ # Setting LANG to something other than 'C' forces the runtime to search
+ # for ICU, which will be required in most user environments.
+ checkConsoleOutput = command: ''
+ output="$(LANG=C.UTF-8 ${command})"
+ # yes, older SDKs omit the comma
+ [[ "$output" =~ Hello,?\ World! ]] && touch "$out"
+ '';
+ in
+ {
+ version = testers.testVersion (
+ {
+ package = finalAttrs.finalPackage;
}
- expect "Application started. Press Ctrl+C to shut down."
- set output [exec curl -sSf $url]
- if {$output != "Hello World!"} {
- send_error "Unexpected output: $output\n"
- exit 1
+ // lib.optionalAttrs (type != "sdk") {
+ command = "dotnet --info";
}
- send \x03
- expect_before timeout abort
- expect eof
- catch wait result
- exit [lindex $result 3]
- EOF
- touch $out
- '';
- runAllowNetworking = true;
- };
- } // lib.optionalAttrs finalAttrs.finalPackage.hasILCompiler {
- aot = mkDotnetTest {
- name = "aot";
- stdenv = if stdenv.hostPlatform.isDarwin then swiftPackages.stdenv else stdenv;
- template = "console";
- usePackageSource = true;
- buildInputs =
- [ zlib
- ] ++ lib.optional stdenv.hostPlatform.isDarwin (with darwin; with apple_sdk.frameworks; [
- swiftPackages.swift
- Foundation
- CryptoKit
- GSS
- ICU
- ]);
- build = ''
- dotnet restore -p:PublishAot=true
- dotnet publish -p:PublishAot=true -o $out/bin
- '';
- runtime = null;
- run = checkConsoleOutput "$src/bin/test";
- };
- }) // args.passthru.tests or {};
- } // args.passthru or {};
-})
+ );
+ }
+ // lib.optionalAttrs (type == "sdk") (
+ {
+ console = mkDotnetTest {
+ name = "console";
+ template = "console";
+ build = checkConsoleOutput "dotnet run";
+ };
+
+ publish = mkDotnetTest {
+ name = "publish";
+ template = "console";
+ build = "dotnet publish -o $out/bin";
+ run = checkConsoleOutput "$src/bin/test";
+ };
+
+ self-contained = mkDotnetTest {
+ name = "self-contained";
+ template = "console";
+ usePackageSource = true;
+ build = "dotnet publish --use-current-runtime --sc -o $out";
+ runtime = null;
+ run = checkConsoleOutput "$src/test";
+ };
+
+ single-file = mkDotnetTest {
+ name = "single-file";
+ template = "console";
+ usePackageSource = true;
+ build = "dotnet publish --use-current-runtime -p:PublishSingleFile=true -o $out/bin";
+ runtime = null;
+ run = checkConsoleOutput "$src/bin/test";
+ };
+
+ web = mkDotnetTest {
+ name = "web";
+ template = "web";
+ build = "dotnet publish -o $out/bin";
+ runInputs = [
+ expect
+ curl
+ ];
+ run = ''
+ expect <<"EOF"
+ set status 1
+ spawn $env(src)/bin/test
+ proc abort { } { exit 2 }
+ expect_before default abort
+ expect -re {Now listening on: ([^\r]+)\r} {
+ set url $expect_out(1,string)
+ }
+ expect "Application started. Press Ctrl+C to shut down."
+ set output [exec curl -sSf $url]
+ if {$output != "Hello World!"} {
+ send_error "Unexpected output: $output\n"
+ exit 1
+ }
+ send \x03
+ expect_before timeout abort
+ expect eof
+ catch wait result
+ exit [lindex $result 3]
+ EOF
+ touch $out
+ '';
+ runAllowNetworking = true;
+ };
+ }
+ // lib.optionalAttrs finalAttrs.finalPackage.hasILCompiler {
+ aot = mkDotnetTest {
+ name = "aot";
+ stdenv = if stdenv.hostPlatform.isDarwin then swiftPackages.stdenv else stdenv;
+ template = "console";
+ usePackageSource = true;
+ buildInputs =
+ [
+ zlib
+ ]
+ ++ lib.optional stdenv.hostPlatform.isDarwin (
+ with darwin;
+ with apple_sdk.frameworks;
+ [
+ swiftPackages.swift
+ Foundation
+ CryptoKit
+ GSS
+ ICU
+ ]
+ );
+ build = ''
+ dotnet restore -p:PublishAot=true
+ dotnet publish -p:PublishAot=true -o $out/bin
+ '';
+ runtime = null;
+ run = checkConsoleOutput "$src/bin/test";
+ };
+ }
+ )
+ // args.passthru.tests or { };
+ } // args.passthru or { };
+ }
+)
diff --git a/pkgs/development/compilers/dotnet/default.nix b/pkgs/development/compilers/dotnet/default.nix
index 0c6999471c48..91854ea02b81 100644
--- a/pkgs/development/compilers/dotnet/default.nix
+++ b/pkgs/development/compilers/dotnet/default.nix
@@ -1,24 +1,26 @@
/*
-How to combine packages for use in development:
-dotnetCombined = with dotnetCorePackages; combinePackages [ sdk_6_0 aspnetcore_7_0 ];
+ How to combine packages for use in development:
+ dotnetCombined = with dotnetCorePackages; combinePackages [ sdk_6_0 aspnetcore_7_0 ];
-Hashes and urls are retrieved from:
-https://dotnet.microsoft.com/download/dotnet
+ Hashes and urls are retrieved from:
+ https://dotnet.microsoft.com/download/dotnet
*/
-{ lib
-, config
-, recurseIntoAttrs
-, generateSplicesForMkScope
-, makeScopeWithSplicing'
+{
+ lib,
+ config,
+ recurseIntoAttrs,
+ generateSplicesForMkScope,
+ makeScopeWithSplicing',
}:
makeScopeWithSplicing' {
otherSplices = generateSplicesForMkScope "dotnetCorePackages";
- f = (self:
+ f = (
+ self:
let
callPackage = self.callPackage;
- buildDotnet = attrs: callPackage (import ./build-dotnet.nix attrs) {};
+ buildDotnet = attrs: callPackage (import ./build-dotnet.nix attrs) { };
buildAttrs = {
buildAspNetCore = attrs: buildDotnet (attrs // { type = "aspnetcore"; });
buildNetRuntime = attrs: buildDotnet (attrs // { type = "runtime"; });
@@ -40,16 +42,18 @@ makeScopeWithSplicing' {
"i686-windows" = "win-x86";
};
- in {
+ in
+ {
inherit callPackage;
# Convert a "stdenv.hostPlatform.system" to a dotnet RID
- systemToDotnetRid = system: runtimeIdentifierMap.${system} or (throw "unsupported platform ${system}");
+ systemToDotnetRid =
+ system: runtimeIdentifierMap.${system} or (throw "unsupported platform ${system}");
- combinePackages = attrs: callPackage (import ./combine-packages.nix attrs) {};
+ combinePackages = attrs: callPackage (import ./combine-packages.nix attrs) { };
- patchNupkgs = callPackage ./patch-nupkgs.nix {};
- nugetPackageHook = callPackage ./nuget-package-hook.nix {};
+ patchNupkgs = callPackage ./patch-nupkgs.nix { };
+ nugetPackageHook = callPackage ./nuget-package-hook.nix { };
buildDotnetModule = callPackage ../../../build-support/dotnet/build-dotnet-module { };
buildDotnetGlobalTool = callPackage ../../../build-support/dotnet/build-dotnet-global-tool { };
@@ -60,13 +64,19 @@ makeScopeWithSplicing' {
fetchNupkg = callPackage ../../../build-support/dotnet/fetch-nupkg { };
dotnet_8 = recurseIntoAttrs (callPackage ./8 { bootstrapSdk = dotnet_8_0.sdk_8_0_1xx; });
- dotnet_9 = recurseIntoAttrs (callPackage ./9 {});
- } // lib.optionalAttrs config.allowAliases {
+ dotnet_9 = recurseIntoAttrs (callPackage ./9 { });
+ }
+ // lib.optionalAttrs config.allowAliases {
# EOL
sdk_2_1 = throw "Dotnet SDK 2.1 is EOL, please use 6.0 (LTS) or 7.0 (Current)";
sdk_2_2 = throw "Dotnet SDK 2.2 is EOL, please use 6.0 (LTS) or 7.0 (Current)";
sdk_3_0 = throw "Dotnet SDK 3.0 is EOL, please use 6.0 (LTS) or 7.0 (Current)";
sdk_3_1 = throw "Dotnet SDK 3.1 is EOL, please use 6.0 (LTS) or 7.0 (Current)";
sdk_5_0 = throw "Dotnet SDK 5.0 is EOL, please use 6.0 (LTS) or 7.0 (Current)";
- } // dotnet_6_0 // dotnet_7_0 // dotnet_8_0 // dotnet_9_0);
+ }
+ // dotnet_6_0
+ // dotnet_7_0
+ // dotnet_8_0
+ // dotnet_9_0
+ );
}
diff --git a/pkgs/development/compilers/dotnet/dotnet.nix b/pkgs/development/compilers/dotnet/dotnet.nix
index 7e629383ab37..f353d51a4a37 100644
--- a/pkgs/development/compilers/dotnet/dotnet.nix
+++ b/pkgs/development/compilers/dotnet/dotnet.nix
@@ -1,11 +1,12 @@
-{ callPackage
-, lib
-, releaseManifestFile
-, releaseInfoFile
-, allowPrerelease ? false
-, depsFile
-, bootstrapSdk
-, pkgsBuildHost
+{
+ callPackage,
+ lib,
+ releaseManifestFile,
+ releaseInfoFile,
+ allowPrerelease ? false,
+ depsFile,
+ bootstrapSdk,
+ pkgsBuildHost,
}:
let
@@ -14,11 +15,13 @@ let
pkgs = callPackage ./stage1.nix {
inherit releaseManifestFile tarballHash depsFile;
bootstrapSdk =
- { stdenvNoCC
- , dotnetCorePackages
- , fetchurl
- }: bootstrapSdk.overrideAttrs (old: {
- passthru = old.passthru or {} // {
+ {
+ stdenvNoCC,
+ dotnetCorePackages,
+ fetchurl,
+ }:
+ bootstrapSdk.overrideAttrs (old: {
+ passthru = old.passthru or { } // {
artifacts = stdenvNoCC.mkDerivation rec {
name = lib.nameFromURL artifactsUrl ".tar.gz";
@@ -38,8 +41,10 @@ let
});
};
-in pkgs // {
- vmr = pkgs.vmr.overrideAttrs(old: {
+in
+pkgs
+// {
+ vmr = pkgs.vmr.overrideAttrs (old: {
passthru = old.passthru // {
updateScript = pkgsBuildHost.callPackage ./update.nix {
inherit releaseManifestFile releaseInfoFile allowPrerelease;
diff --git a/pkgs/development/compilers/dotnet/packages.nix b/pkgs/development/compilers/dotnet/packages.nix
index 801896f38625..7976223ab994 100644
--- a/pkgs/development/compilers/dotnet/packages.nix
+++ b/pkgs/development/compilers/dotnet/packages.nix
@@ -1,16 +1,18 @@
-{ stdenv
-, callPackage
-, vmr
-, xmlstarlet
-, strip-nondeterminism
-, zip
+{
+ stdenv,
+ callPackage,
+ vmr,
+ xmlstarlet,
+ strip-nondeterminism,
+ zip,
}:
let
- mkCommon = callPackage ./common.nix {};
+ mkCommon = callPackage ./common.nix { };
inherit (vmr) targetRid releaseManifest;
-in {
+in
+{
inherit vmr;
sdk = mkCommon "sdk" rec {
pname = "dotnet-sdk";
@@ -25,7 +27,11 @@ in {
zip
];
- outputs = [ "out" "packages" "artifacts" ];
+ outputs = [
+ "out"
+ "packages"
+ "artifacts"
+ ];
installPhase = ''
runHook preInstall
diff --git a/pkgs/development/compilers/dotnet/patch-nupkgs.nix b/pkgs/development/compilers/dotnet/patch-nupkgs.nix
index 528b236239e4..6885d8df71f3 100644
--- a/pkgs/development/compilers/dotnet/patch-nupkgs.nix
+++ b/pkgs/development/compilers/dotnet/patch-nupkgs.nix
@@ -1,83 +1,92 @@
-{ stdenv
-, lib
-, zlib
-, curl
-, icu
-, libunwind
-, libuuid
-, openssl
-, lttng-ust_2_12
-, patchelf
-, writeShellScriptBin
+{
+ stdenv,
+ lib,
+ zlib,
+ curl,
+ icu,
+ libunwind,
+ libuuid,
+ openssl,
+ lttng-ust_2_12,
+ patchelf,
+ writeShellScriptBin,
}:
let
- binaryRPath = lib.makeLibraryPath ([
- stdenv.cc.cc
- zlib
- curl
- icu
- libunwind
- libuuid
- openssl
- ] ++ lib.optional stdenv.hostPlatform.isLinux lttng-ust_2_12);
+ binaryRPath = lib.makeLibraryPath (
+ [
+ stdenv.cc.cc
+ zlib
+ curl
+ icu
+ libunwind
+ libuuid
+ openssl
+ ]
+ ++ lib.optional stdenv.hostPlatform.isLinux lttng-ust_2_12
+ );
-in writeShellScriptBin "patch-nupkgs" (''
- set -euo pipefail
- shopt -s nullglob
- isELF() {
- local fn="$1"
- local fd
- local magic
- exec {fd}< "$fn"
- read -r -n 4 -u "$fd" magic
- exec {fd}<&-
- if [ "$magic" = $'\177ELF' ]; then return 0; else return 1; fi
- }
- cd "$1"
-'' + lib.optionalString stdenv.hostPlatform.isLinux ''
- for x in */* */*; do
- # .nupkg.metadata is written last, so we know the packages is complete
- [[ -d "$x" ]] && [[ -f "$x"/.nupkg.metadata ]] \
- && [[ ! -f "$x"/.nix-patched ]] || continue
- echo "Patching package $x"
- find "$x" -type f -print0 | while IFS= read -rd "" p; do
- if [[ "$p" != *.nix-patched ]] \
- && isELF "$p" \
- && ${patchelf}/bin/patchelf --print-interpreter "$p" &>/dev/null; then
- tmp="$p".$$.nix-patched
- # if this fails to copy then another process must have patched it
- cp --reflink=auto "$p" "$tmp" || continue
- echo "Patchelfing $p as $tmp"
- ${patchelf}/bin/patchelf \
- --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" \
- "$tmp" ||:
- # This makes sure that if the binary requires some specific runtime dependencies, it can find it.
- # This fixes dotnet-built binaries like crossgen2
- ${patchelf}/bin/patchelf \
- --add-needed libicui18n.so \
- --add-needed libicuuc.so \
- --add-needed libz.so \
- --add-needed libssl.so \
- "$tmp"
- ${patchelf}/bin/patchelf \
- --add-rpath "${binaryRPath}" \
- "$tmp" ||:
- mv "$tmp" "$p"
- fi
+in
+writeShellScriptBin "patch-nupkgs" (
+ ''
+ set -euo pipefail
+ shopt -s nullglob
+ isELF() {
+ local fn="$1"
+ local fd
+ local magic
+ exec {fd}< "$fn"
+ read -r -n 4 -u "$fd" magic
+ exec {fd}<&-
+ if [ "$magic" = $'\177ELF' ]; then return 0; else return 1; fi
+ }
+ cd "$1"
+ ''
+ + lib.optionalString stdenv.hostPlatform.isLinux ''
+ for x in */* */*; do
+ # .nupkg.metadata is written last, so we know the packages is complete
+ [[ -d "$x" ]] && [[ -f "$x"/.nupkg.metadata ]] \
+ && [[ ! -f "$x"/.nix-patched ]] || continue
+ echo "Patching package $x"
+ find "$x" -type f -print0 | while IFS= read -rd "" p; do
+ if [[ "$p" != *.nix-patched ]] \
+ && isELF "$p" \
+ && ${patchelf}/bin/patchelf --print-interpreter "$p" &>/dev/null; then
+ tmp="$p".$$.nix-patched
+ # if this fails to copy then another process must have patched it
+ cp --reflink=auto "$p" "$tmp" || continue
+ echo "Patchelfing $p as $tmp"
+ ${patchelf}/bin/patchelf \
+ --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" \
+ "$tmp" ||:
+ # This makes sure that if the binary requires some specific runtime dependencies, it can find it.
+ # This fixes dotnet-built binaries like crossgen2
+ ${patchelf}/bin/patchelf \
+ --add-needed libicui18n.so \
+ --add-needed libicuuc.so \
+ --add-needed libz.so \
+ --add-needed libssl.so \
+ "$tmp"
+ ${patchelf}/bin/patchelf \
+ --add-rpath "${binaryRPath}" \
+ "$tmp" ||:
+ mv "$tmp" "$p"
+ fi
+ done
+ touch "$x"/.nix-patched
done
- touch "$x"/.nix-patched
- done
-'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
- for x in microsoft.dotnet.ilcompiler/*; do
- # .nupkg.metadata is written last, so we know the packages is complete
- [[ -d "$x" ]] && [[ -f "$x"/.nupkg.metadata ]] \
- && [[ ! -f "$x"/.nix-patched-ilcompiler ]] || continue
- echo "Patching package $x"
- pushd "$x"
- sed -i 's: -no_code_signature_warning::g' build/Microsoft.NETCore.Native.targets
- sed -i 's:Include="-ld_classic"::g' build/Microsoft.NETCore.Native.Unix.targets
- touch .nix-patched-ilcompiler
- popd
- done
-'')
+ ''
+ + lib.optionalString stdenv.hostPlatform.isDarwin ''
+ for x in microsoft.dotnet.ilcompiler/*; do
+ # .nupkg.metadata is written last, so we know the packages is complete
+ [[ -d "$x" ]] && [[ -f "$x"/.nupkg.metadata ]] \
+ && [[ ! -f "$x"/.nix-patched-ilcompiler ]] || continue
+ echo "Patching package $x"
+ pushd "$x"
+ sed -i 's: -no_code_signature_warning::g' build/Microsoft.NETCore.Native.targets
+ sed -i 's:Include="-ld_classic"::g' build/Microsoft.NETCore.Native.Unix.targets
+ touch .nix-patched-ilcompiler
+ popd
+ done
+ ''
+)
diff --git a/pkgs/development/compilers/dotnet/sign-apphost.nix b/pkgs/development/compilers/dotnet/sign-apphost.nix
index f804ab79d332..021d9ef61a90 100644
--- a/pkgs/development/compilers/dotnet/sign-apphost.nix
+++ b/pkgs/development/compilers/dotnet/sign-apphost.nix
@@ -1,10 +1,12 @@
-{ substituteAll
-, callPackage
+{
+ substituteAll,
+ callPackage,
}:
let
- sigtool = callPackage ./sigtool.nix {};
+ sigtool = callPackage ./sigtool.nix { };
-in substituteAll {
+in
+substituteAll {
src = ./sign-apphost.proj;
codesign = "${sigtool}/bin/codesign";
}
diff --git a/pkgs/development/compilers/dotnet/sigtool.nix b/pkgs/development/compilers/dotnet/sigtool.nix
index fe5d1ebc6879..04e0d5215098 100644
--- a/pkgs/development/compilers/dotnet/sigtool.nix
+++ b/pkgs/development/compilers/dotnet/sigtool.nix
@@ -1,7 +1,8 @@
-{ cctools
-, darwin
-, fetchFromGitHub
-, makeWrapper
+{
+ cctools,
+ darwin,
+ fetchFromGitHub,
+ makeWrapper,
}:
darwin.sigtool.overrideAttrs (old: {
@@ -14,13 +15,15 @@ darwin.sigtool.overrideAttrs (old: {
sha256 = "sha256-EVM5ZG3sAHrIXuWrnqA9/4pDkJOpWCeBUl5fh0mkK4k=";
};
- nativeBuildInputs = old.nativeBuildInputs or [] ++ [
+ nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
makeWrapper
];
- postInstall = old.postInstall or "" + ''
- wrapProgram $out/bin/codesign \
- --set-default CODESIGN_ALLOCATE \
- "${cctools}/bin/${cctools.targetPrefix}codesign_allocate"
- '';
+ postInstall =
+ old.postInstall or ""
+ + ''
+ wrapProgram $out/bin/codesign \
+ --set-default CODESIGN_ALLOCATE \
+ "${cctools}/bin/${cctools.targetPrefix}codesign_allocate"
+ '';
})
diff --git a/pkgs/development/compilers/dotnet/stage0.nix b/pkgs/development/compilers/dotnet/stage0.nix
index 7e2717aba1a1..17de17a71bc3 100644
--- a/pkgs/development/compilers/dotnet/stage0.nix
+++ b/pkgs/development/compilers/dotnet/stage0.nix
@@ -1,26 +1,27 @@
-{ stdenv
-, callPackage
-, lib
-, writeShellScript
-, mkNugetDeps
-, nix
-, cacert
-, nuget-to-nix
-, dotnetCorePackages
-, xmlstarlet
-, patchNupkgs
+{
+ stdenv,
+ callPackage,
+ lib,
+ writeShellScript,
+ mkNugetDeps,
+ nix,
+ cacert,
+ nuget-to-nix,
+ dotnetCorePackages,
+ xmlstarlet,
+ patchNupkgs,
-, releaseManifestFile
-, tarballHash
-, depsFile
-, bootstrapSdk
+ releaseManifestFile,
+ tarballHash,
+ depsFile,
+ bootstrapSdk,
}:
let
mkPackages = callPackage ./packages.nix;
mkVMR = callPackage ./vmr.nix;
- dotnetSdk = callPackage bootstrapSdk {};
+ dotnetSdk = callPackage bootstrapSdk { };
deps = mkNugetDeps {
name = "dotnet-vmr-deps";
@@ -31,100 +32,110 @@ let
installable = true;
};
- vmr = (mkVMR {
- inherit releaseManifestFile tarballHash dotnetSdk;
- }).overrideAttrs (old: rec {
- prebuiltPackages = mkNugetDeps {
- name = "dotnet-vmr-deps";
- sourceFile = depsFile;
- installable = true;
- };
+ vmr =
+ (mkVMR {
+ inherit releaseManifestFile tarballHash dotnetSdk;
+ }).overrideAttrs
+ (old: rec {
+ prebuiltPackages = mkNugetDeps {
+ name = "dotnet-vmr-deps";
+ sourceFile = depsFile;
+ installable = true;
+ };
- nativeBuildInputs =
- old.nativeBuildInputs or []
- ++ [ xmlstarlet patchNupkgs ];
+ nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
+ xmlstarlet
+ patchNupkgs
+ ];
- postPatch = old.postPatch or "" + ''
- xmlstarlet ed \
- --inplace \
- -s //Project -t elem -n Import \
- -i \$prev -t attr -n Project -v "${./patch-restored-packages.proj}" \
- src/*/Directory.Build.targets
- '';
-
- postConfigure = old.postConfigure or "" + ''
- [[ ! -v prebuiltPackages ]] || \
- ln -sf "$prebuiltPackages"/share/nuget/source/*/*/*.nupkg prereqs/packages/prebuilt/
- ln -sf "${sdkPackages}"/share/nuget/source/*/*/*.nupkg prereqs/packages/prebuilt/
- '';
-
- buildFlags =
- old.buildFlags
- ++ lib.optionals (lib.versionAtLeast old.version "9") [
- # We need to set this as long as we have something in deps.nix. Currently
- # that's the portable ilasm/ildasm which aren't in the centos sourcebuilt
- # artifacts.
- "-p:SkipErrorOnPrebuilts=true"
- ];
-
- passthru = old.passthru or {} // { fetch-deps =
- let
- inherit (vmr) targetRid updateScript;
- otherRids =
- lib.remove targetRid (
- map (system: dotnetCorePackages.systemToDotnetRid system)
- vmr.meta.platforms);
-
- pkg = vmr.overrideAttrs (old: {
- nativeBuildInputs = old.nativeBuildInputs ++ [
- nix
- cacert
- nuget-to-nix
- ];
- postPatch = old.postPatch or "" + ''
+ postPatch =
+ old.postPatch or ""
+ + ''
xmlstarlet ed \
--inplace \
-s //Project -t elem -n Import \
- -i \$prev -t attr -n Project -v "${./record-downloaded-packages.proj}" \
- repo-projects/Directory.Build.targets
- # make nuget-client use the standard arcade package-cache dir, which
- # is where we scan for dependencies
- xmlstarlet ed \
- --inplace \
- -s //Project -t elem -n ItemGroup \
- -s \$prev -t elem -n EnvironmentVariables \
- -i \$prev -t attr -n Include -v 'NUGET_PACKAGES=$(ProjectDirectory)artifacts/sb/package-cache/' \
- repo-projects/nuget-client.proj
+ -i \$prev -t attr -n Project -v "${./patch-restored-packages.proj}" \
+ src/*/Directory.Build.targets
'';
- buildFlags = [ "--online" ] ++ old.buildFlags;
- prebuiltPackages = null;
- });
- drv = builtins.unsafeDiscardOutputDependency pkg.drvPath;
- in
- writeShellScript "fetch-dotnet-sdk-deps" ''
- ${nix}/bin/nix-shell --pure --run 'source /dev/stdin' "${drv}" << 'EOF'
- set -e
+ postConfigure =
+ old.postConfigure or ""
+ + ''
+ [[ ! -v prebuiltPackages ]] || \
+ ln -sf "$prebuiltPackages"/share/nuget/source/*/*/*.nupkg prereqs/packages/prebuilt/
+ ln -sf "${sdkPackages}"/share/nuget/source/*/*/*.nupkg prereqs/packages/prebuilt/
+ '';
- tmp=$(mktemp -d)
- trap 'rm -fr "$tmp"' EXIT
+ buildFlags =
+ old.buildFlags
+ ++ lib.optionals (lib.versionAtLeast old.version "9") [
+ # We need to set this as long as we have something in deps.nix. Currently
+ # that's the portable ilasm/ildasm which aren't in the centos sourcebuilt
+ # artifacts.
+ "-p:SkipErrorOnPrebuilts=true"
+ ];
- HOME=$tmp/.home
- cd "$tmp"
+ passthru = old.passthru or { } // {
+ fetch-deps =
+ let
+ inherit (vmr) targetRid updateScript;
+ otherRids = lib.remove targetRid (
+ map (system: dotnetCorePackages.systemToDotnetRid system) vmr.meta.platforms
+ );
- phases="''${prePhases[*]:-} unpackPhase patchPhase ''${preConfigurePhases[*]:-} \
- configurePhase ''${preBuildPhases[*]:-} buildPhase checkPhase" \
- genericBuild
+ pkg = vmr.overrideAttrs (old: {
+ nativeBuildInputs = old.nativeBuildInputs ++ [
+ nix
+ cacert
+ nuget-to-nix
+ ];
+ postPatch =
+ old.postPatch or ""
+ + ''
+ xmlstarlet ed \
+ --inplace \
+ -s //Project -t elem -n Import \
+ -i \$prev -t attr -n Project -v "${./record-downloaded-packages.proj}" \
+ repo-projects/Directory.Build.targets
+ # make nuget-client use the standard arcade package-cache dir, which
+ # is where we scan for dependencies
+ xmlstarlet ed \
+ --inplace \
+ -s //Project -t elem -n ItemGroup \
+ -s \$prev -t elem -n EnvironmentVariables \
+ -i \$prev -t attr -n Include -v 'NUGET_PACKAGES=$(ProjectDirectory)artifacts/sb/package-cache/' \
+ repo-projects/nuget-client.proj
+ '';
+ buildFlags = [ "--online" ] ++ old.buildFlags;
+ prebuiltPackages = null;
+ });
- depsFiles=(./src/*/deps.nix)
+ drv = builtins.unsafeDiscardOutputDependency pkg.drvPath;
+ in
+ writeShellScript "fetch-dotnet-sdk-deps" ''
+ ${nix}/bin/nix-shell --pure --run 'source /dev/stdin' "${drv}" << 'EOF'
+ set -e
- cat $(nix-build ${toString ./combine-deps.nix} \
- --arg list "[ ''${depsFiles[*]} ]" \
- --argstr baseRid ${targetRid} \
- --arg otherRids '${lib.generators.toPretty { multiline = false; } otherRids}' \
- ) > "${toString prebuiltPackages.sourceFile}"
- EOF
- '';
- };
- });
-in mkPackages { inherit vmr; }
+ tmp=$(mktemp -d)
+ trap 'rm -fr "$tmp"' EXIT
+
+ HOME=$tmp/.home
+ cd "$tmp"
+
+ phases="''${prePhases[*]:-} unpackPhase patchPhase ''${preConfigurePhases[*]:-} \
+ configurePhase ''${preBuildPhases[*]:-} buildPhase checkPhase" \
+ genericBuild
+
+ depsFiles=(./src/*/deps.nix)
+
+ cat $(nix-build ${toString ./combine-deps.nix} \
+ --arg list "[ ''${depsFiles[*]} ]" \
+ --argstr baseRid ${targetRid} \
+ --arg otherRids '${lib.generators.toPretty { multiline = false; } otherRids}' \
+ ) > "${toString prebuiltPackages.sourceFile}"
+ EOF
+ '';
+ };
+ });
+in
+mkPackages { inherit vmr; }
diff --git a/pkgs/development/compilers/dotnet/stage1.nix b/pkgs/development/compilers/dotnet/stage1.nix
index 9014e60b4e90..bf1273c56cb2 100644
--- a/pkgs/development/compilers/dotnet/stage1.nix
+++ b/pkgs/development/compilers/dotnet/stage1.nix
@@ -1,11 +1,12 @@
-{ stdenv
-, lib
-, callPackage
+{
+ stdenv,
+ lib,
+ callPackage,
-, releaseManifestFile
-, tarballHash
-, depsFile
-, bootstrapSdk
+ releaseManifestFile,
+ tarballHash,
+ depsFile,
+ bootstrapSdk,
}@args:
let
@@ -14,13 +15,16 @@ let
stage0 = callPackage ./stage0.nix args;
- vmr = (mkVMR {
- inherit releaseManifestFile tarballHash;
- dotnetSdk = stage0.sdk;
- }).overrideAttrs (old: {
- passthru = old.passthru or {} // {
- inherit (stage0.vmr) fetch-deps;
- };
- });
+ vmr =
+ (mkVMR {
+ inherit releaseManifestFile tarballHash;
+ dotnetSdk = stage0.sdk;
+ }).overrideAttrs
+ (old: {
+ passthru = old.passthru or { } // {
+ inherit (stage0.vmr) fetch-deps;
+ };
+ });
-in mkPackages { inherit vmr; } // { stage0 = lib.dontRecurseIntoAttrs stage0; }
+in
+mkPackages { inherit vmr; } // { stage0 = lib.dontRecurseIntoAttrs stage0; }
diff --git a/pkgs/development/compilers/dotnet/update.nix b/pkgs/development/compilers/dotnet/update.nix
index 58304188afa8..cb482d7658cf 100644
--- a/pkgs/development/compilers/dotnet/update.nix
+++ b/pkgs/development/compilers/dotnet/update.nix
@@ -1,18 +1,19 @@
-{ stdenvNoCC
-, lib
-, fetchurl
-, writeScript
-, nix
-, runtimeShell
-, curl
-, cacert
-, jq
-, yq
-, gnupg
+{
+ stdenvNoCC,
+ lib,
+ fetchurl,
+ writeScript,
+ nix,
+ runtimeShell,
+ curl,
+ cacert,
+ jq,
+ yq,
+ gnupg,
-, releaseManifestFile
-, releaseInfoFile
-, allowPrerelease
+ releaseManifestFile,
+ releaseInfoFile,
+ allowPrerelease,
}:
let
@@ -38,7 +39,8 @@ let
drv = builtins.unsafeDiscardOutputDependency pkg.drvPath;
-in writeScript "update-dotnet-vmr.sh" ''
+in
+writeScript "update-dotnet-vmr.sh" ''
#! ${nix}/bin/nix-shell
#! nix-shell -i ${runtimeShell} --pure ${drv}
set -euo pipefail
diff --git a/pkgs/development/compilers/dotnet/vmr.nix b/pkgs/development/compilers/dotnet/vmr.nix
index 41b0eac15734..e9124e115f98 100644
--- a/pkgs/development/compilers/dotnet/vmr.nix
+++ b/pkgs/development/compilers/dotnet/vmr.nix
@@ -1,46 +1,46 @@
-{ clangStdenv
-, lib
-, fetchurl
-, dotnetCorePackages
-, jq
-, curl
-, git
-, cmake
-, pkg-config
-, llvm
-, zlib
-, icu
-, lttng-ust_2_12
-, krb5
-, glibcLocales
-, ensureNewerSourcesForZipFilesHook
-, darwin
-, xcbuild
-, swiftPackages
-, openssl
-, getconf
-, python3
-, xmlstarlet
-, nodejs
-, callPackage
-, unzip
-, yq
+{
+ clangStdenv,
+ lib,
+ fetchurl,
+ dotnetCorePackages,
+ jq,
+ curl,
+ git,
+ cmake,
+ pkg-config,
+ llvm,
+ zlib,
+ icu,
+ lttng-ust_2_12,
+ krb5,
+ glibcLocales,
+ ensureNewerSourcesForZipFilesHook,
+ darwin,
+ xcbuild,
+ swiftPackages,
+ openssl,
+ getconf,
+ python3,
+ xmlstarlet,
+ nodejs,
+ callPackage,
+ unzip,
+ yq,
-, dotnetSdk
-, releaseManifestFile
-, tarballHash
+ dotnetSdk,
+ releaseManifestFile,
+ tarballHash,
}:
let
- stdenv = if clangStdenv.hostPlatform.isDarwin
- then swiftPackages.stdenv
- else clangStdenv;
+ stdenv = if clangStdenv.hostPlatform.isDarwin then swiftPackages.stdenv else clangStdenv;
inherit (stdenv)
isLinux
isDarwin
buildPlatform
- targetPlatform;
+ targetPlatform
+ ;
inherit (swiftPackages) apple_sdk swift;
releaseManifest = lib.importJSON releaseManifestFile;
@@ -50,11 +50,12 @@ let
targetRid = dotnetCorePackages.systemToDotnetRid targetPlatform.system;
targetArch = lib.elemAt (lib.splitString "-" targetRid) 1;
- sigtool = callPackage ./sigtool.nix {};
+ sigtool = callPackage ./sigtool.nix { };
_icu = if isDarwin then darwin.ICU else icu;
-in stdenv.mkDerivation rec {
+in
+stdenv.mkDerivation rec {
pname = "dotnet-vmr";
version = release;
@@ -69,53 +70,58 @@ in stdenv.mkDerivation rec {
hash = tarballHash;
};
- nativeBuildInputs = [
- ensureNewerSourcesForZipFilesHook
- jq
- curl.bin
- git
- cmake
- pkg-config
- python3
- xmlstarlet
- unzip
- yq
- ]
- ++ lib.optionals (lib.versionAtLeast version "9") [
- nodejs
- ]
- ++ lib.optionals isDarwin [
- getconf
- ];
+ nativeBuildInputs =
+ [
+ ensureNewerSourcesForZipFilesHook
+ jq
+ curl.bin
+ git
+ cmake
+ pkg-config
+ python3
+ xmlstarlet
+ unzip
+ yq
+ ]
+ ++ lib.optionals (lib.versionAtLeast version "9") [
+ nodejs
+ ]
+ ++ lib.optionals isDarwin [
+ getconf
+ ];
- buildInputs = [
- # this gets copied into the tree, but we still want the hooks to run
- dotnetSdk
- # the propagated build inputs in llvm.dev break swift compilation
- llvm.out
- zlib
- _icu
- openssl
- ]
- ++ lib.optionals isLinux [
- krb5
- lttng-ust_2_12
- ]
- ++ lib.optionals isDarwin (with apple_sdk.frameworks; [
- xcbuild
- swift
- (krb5.overrideAttrs (old: {
- # the propagated build inputs break swift compilation
- buildInputs = old.buildInputs ++ old.propagatedBuildInputs;
- propagatedBuildInputs = [];
- }))
- sigtool
- Foundation
- CoreFoundation
- CryptoKit
- System
- ]
- ++ lib.optional (lib.versionAtLeast version "9") GSS);
+ buildInputs =
+ [
+ # this gets copied into the tree, but we still want the hooks to run
+ dotnetSdk
+ # the propagated build inputs in llvm.dev break swift compilation
+ llvm.out
+ zlib
+ _icu
+ openssl
+ ]
+ ++ lib.optionals isLinux [
+ krb5
+ lttng-ust_2_12
+ ]
+ ++ lib.optionals isDarwin (
+ with apple_sdk.frameworks;
+ [
+ xcbuild
+ swift
+ (krb5.overrideAttrs (old: {
+ # the propagated build inputs break swift compilation
+ buildInputs = old.buildInputs ++ old.propagatedBuildInputs;
+ propagatedBuildInputs = [ ];
+ }))
+ sigtool
+ Foundation
+ CoreFoundation
+ CryptoKit
+ System
+ ]
+ ++ lib.optional (lib.versionAtLeast version "9") GSS
+ );
# This is required to fix the error:
# > CSSM_ModuleLoad(): One or more parameters passed to a function were not valid.
@@ -136,212 +142,217 @@ in stdenv.mkDerivation rec {
./fix-aspnetcore-portable-build.patch
];
- postPatch = ''
- # set the sdk version in global.json to match the bootstrap sdk
- jq '(.tools.dotnet=$dotnet)' global.json --arg dotnet "$(${dotnetSdk}/bin/dotnet --version)" > global.json~
- mv global.json{~,}
+ postPatch =
+ ''
+ # set the sdk version in global.json to match the bootstrap sdk
+ jq '(.tools.dotnet=$dotnet)' global.json --arg dotnet "$(${dotnetSdk}/bin/dotnet --version)" > global.json~
+ mv global.json{~,}
- patchShebangs $(find -name \*.sh -type f -executable)
+ patchShebangs $(find -name \*.sh -type f -executable)
- # I'm not sure why this is required, but these files seem to use the wrong
- # property name.
- # TODO: not needed in 9.0?
- [[ ! -f src/xliff-tasks/eng/Versions.props ]] || \
- sed -i 's:\bVersionBase\b:VersionPrefix:g' \
- src/xliff-tasks/eng/Versions.props
+ # I'm not sure why this is required, but these files seem to use the wrong
+ # property name.
+ # TODO: not needed in 9.0?
+ [[ ! -f src/xliff-tasks/eng/Versions.props ]] || \
+ sed -i 's:\bVersionBase\b:VersionPrefix:g' \
+ src/xliff-tasks/eng/Versions.props
- # at least in 9.0 preview 1, this package depends on a specific beta build
- # of System.CommandLine
- xmlstarlet ed \
- --inplace \
- -s //Project -t elem -n PropertyGroup \
- -s \$prev -t elem -n NoWarn -v '$(NoWarn);NU1603' \
- src/nuget-client/src/NuGet.Core/NuGet.CommandLine.XPlat/NuGet.CommandLine.XPlat.csproj
+ # at least in 9.0 preview 1, this package depends on a specific beta build
+ # of System.CommandLine
+ xmlstarlet ed \
+ --inplace \
+ -s //Project -t elem -n PropertyGroup \
+ -s \$prev -t elem -n NoWarn -v '$(NoWarn);NU1603' \
+ src/nuget-client/src/NuGet.Core/NuGet.CommandLine.XPlat/NuGet.CommandLine.XPlat.csproj
- # AD0001 crashes intermittently in source-build-reference-packages with
- # 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.'.
- # possibly related to https://github.com/dotnet/runtime/issues/90356
- xmlstarlet ed \
- --inplace \
- -s //Project -t elem -n PropertyGroup \
- -s \$prev -t elem -n NoWarn -v '$(NoWarn);AD0001' \
- src/source-build-reference-packages/src/referencePackages/Directory.Build.props
+ # AD0001 crashes intermittently in source-build-reference-packages with
+ # 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.'.
+ # possibly related to https://github.com/dotnet/runtime/issues/90356
+ xmlstarlet ed \
+ --inplace \
+ -s //Project -t elem -n PropertyGroup \
+ -s \$prev -t elem -n NoWarn -v '$(NoWarn);AD0001' \
+ src/source-build-reference-packages/src/referencePackages/Directory.Build.props
- # https://github.com/microsoft/ApplicationInsights-dotnet/issues/2848
- xmlstarlet ed \
- --inplace \
- -u //_:Project/_:PropertyGroup/_:BuildNumber -v 0 \
- src/source-build-externals/src/application-insights/.props/_GlobalStaticVersion.props
+ # https://github.com/microsoft/ApplicationInsights-dotnet/issues/2848
+ xmlstarlet ed \
+ --inplace \
+ -u //_:Project/_:PropertyGroup/_:BuildNumber -v 0 \
+ src/source-build-externals/src/application-insights/.props/_GlobalStaticVersion.props
- # this fixes compile errors with clang 15 (e.g. darwin)
- substituteInPlace \
- src/runtime/src/native/libs/CMakeLists.txt \
- --replace-fail 'add_compile_options(-Weverything)' 'add_compile_options(-Wall)'
+ # this fixes compile errors with clang 15 (e.g. darwin)
+ substituteInPlace \
+ src/runtime/src/native/libs/CMakeLists.txt \
+ --replace-fail 'add_compile_options(-Weverything)' 'add_compile_options(-Wall)'
- # strip native symbols in runtime
- # see: https://github.com/dotnet/source-build/issues/2543
- xmlstarlet ed \
- --inplace \
- -s //Project -t elem -n PropertyGroup \
- -s \$prev -t elem -n KeepNativeSymbols -v false \
- src/runtime/Directory.Build.props
- ''
- + lib.optionalString (lib.versionAtLeast version "9") ''
- # repro.csproj fails to restore due to missing freebsd packages
- xmlstarlet ed \
- --inplace \
- -s //Project -t elem -n PropertyGroup \
- -s \$prev -t elem -n RuntimeIdentifiers -v ${targetRid} \
- src/runtime/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj
+ # strip native symbols in runtime
+ # see: https://github.com/dotnet/source-build/issues/2543
+ xmlstarlet ed \
+ --inplace \
+ -s //Project -t elem -n PropertyGroup \
+ -s \$prev -t elem -n KeepNativeSymbols -v false \
+ src/runtime/Directory.Build.props
+ ''
+ + lib.optionalString (lib.versionAtLeast version "9") ''
+ # repro.csproj fails to restore due to missing freebsd packages
+ xmlstarlet ed \
+ --inplace \
+ -s //Project -t elem -n PropertyGroup \
+ -s \$prev -t elem -n RuntimeIdentifiers -v ${targetRid} \
+ src/runtime/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj
- # https://github.com/dotnet/runtime/pull/98559#issuecomment-1965338627
- xmlstarlet ed \
- --inplace \
- -s //Project -t elem -n PropertyGroup \
- -s \$prev -t elem -n NoWarn -v '$(NoWarn);CS9216' \
- src/runtime/Directory.Build.props
+ # https://github.com/dotnet/runtime/pull/98559#issuecomment-1965338627
+ xmlstarlet ed \
+ --inplace \
+ -s //Project -t elem -n PropertyGroup \
+ -s \$prev -t elem -n NoWarn -v '$(NoWarn);CS9216' \
+ src/runtime/Directory.Build.props
- # patch packages installed from npm cache
- xmlstarlet ed \
- --inplace \
- -s //Project -t elem -n Import \
- -i \$prev -t attr -n Project -v "${./patch-npm-packages.proj}" \
- src/aspnetcore/eng/DotNetBuild.props
- ''
- + lib.optionalString (lib.versionAtLeast version "9") ''
- # https://github.com/dotnet/source-build/issues/3131#issuecomment-2030215805
- substituteInPlace \
- src/aspnetcore/eng/Dependencies.props \
- --replace-fail \
- "'\$(DotNetBuildSourceOnly)' == 'true'" \
- "'\$(DotNetBuildSourceOnly)' == 'true' and \$(PortableBuild) == 'false'"
+ # patch packages installed from npm cache
+ xmlstarlet ed \
+ --inplace \
+ -s //Project -t elem -n Import \
+ -i \$prev -t attr -n Project -v "${./patch-npm-packages.proj}" \
+ src/aspnetcore/eng/DotNetBuild.props
+ ''
+ + lib.optionalString (lib.versionAtLeast version "9") ''
+ # https://github.com/dotnet/source-build/issues/3131#issuecomment-2030215805
+ substituteInPlace \
+ src/aspnetcore/eng/Dependencies.props \
+ --replace-fail \
+ "'\$(DotNetBuildSourceOnly)' == 'true'" \
+ "'\$(DotNetBuildSourceOnly)' == 'true' and \$(PortableBuild) == 'false'"
- # https://github.com/dotnet/source-build/issues/4325
- xmlstarlet ed \
- --inplace \
- -r '//Target[@Name="UnpackTarballs"]/Move' -v Copy \
- eng/init-source-only.proj
+ # https://github.com/dotnet/source-build/issues/4325
+ xmlstarlet ed \
+ --inplace \
+ -r '//Target[@Name="UnpackTarballs"]/Move' -v Copy \
+ eng/init-source-only.proj
- # error: _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror,-W#warnings]
- substituteInPlace \
- src/runtime/src/coreclr/ilasm/CMakeLists.txt \
- --replace-fail 'set_source_files_properties( prebuilt/asmparse.cpp PROPERTIES COMPILE_FLAGS "-O0" )' ""
+ # error: _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror,-W#warnings]
+ substituteInPlace \
+ src/runtime/src/coreclr/ilasm/CMakeLists.txt \
+ --replace-fail 'set_source_files_properties( prebuilt/asmparse.cpp PROPERTIES COMPILE_FLAGS "-O0" )' ""
- # https://github.com/dotnet/source-build/issues/4444
- xmlstarlet ed \
- --inplace \
- -s '//Project/Target/MSBuild[@Targets="Restore"]' \
- -t attr -n Properties -v "NUGET_PACKAGES='\$(CurrentRepoSourceBuildPackageCache)'" \
- src/aspnetcore/eng/Tools.props
- ''
- + lib.optionalString isLinux (''
- substituteInPlace \
- src/runtime/src/native/libs/System.Security.Cryptography.Native/opensslshim.c \
- --replace-fail '"libssl.so"' '"${openssl.out}/lib/libssl.so"'
+ # https://github.com/dotnet/source-build/issues/4444
+ xmlstarlet ed \
+ --inplace \
+ -s '//Project/Target/MSBuild[@Targets="Restore"]' \
+ -t attr -n Properties -v "NUGET_PACKAGES='\$(CurrentRepoSourceBuildPackageCache)'" \
+ src/aspnetcore/eng/Tools.props
+ ''
+ + lib.optionalString isLinux (
+ ''
+ substituteInPlace \
+ src/runtime/src/native/libs/System.Security.Cryptography.Native/opensslshim.c \
+ --replace-fail '"libssl.so"' '"${openssl.out}/lib/libssl.so"'
- substituteInPlace \
- src/runtime/src/native/libs/System.Net.Security.Native/pal_gssapi.c \
- --replace-fail '"libgssapi_krb5.so.2"' '"${lib.getLib krb5}/lib/libgssapi_krb5.so.2"'
+ substituteInPlace \
+ src/runtime/src/native/libs/System.Net.Security.Native/pal_gssapi.c \
+ --replace-fail '"libgssapi_krb5.so.2"' '"${lib.getLib krb5}/lib/libgssapi_krb5.so.2"'
- substituteInPlace \
- src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \
- --replace-fail '"libicui18n.so"' '"${icu}/lib/libicui18n.so"' \
- --replace-fail '"libicuuc.so"' '"${icu}/lib/libicuuc.so"'
- ''
- + lib.optionalString (lib.versionAtLeast version "9") ''
- substituteInPlace \
- src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \
- --replace-fail '#define VERSIONED_LIB_NAME_LEN 64' '#define VERSIONED_LIB_NAME_LEN 256'
- ''
- + lib.optionalString (lib.versionOlder version "9") ''
- substituteInPlace \
- src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \
- --replace-warn 'libicuucName[64]' 'libicuucName[256]' \
- --replace-warn 'libicui18nName[64]' 'libicui18nName[256]'
- '')
- + lib.optionalString isDarwin (''
- substituteInPlace \
- src/runtime/src/native/libs/System.Globalization.Native/CMakeLists.txt \
- --replace-fail '/usr/lib/libicucore.dylib' '${darwin.ICU}/lib/libicucore.dylib'
+ substituteInPlace \
+ src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \
+ --replace-fail '"libicui18n.so"' '"${icu}/lib/libicui18n.so"' \
+ --replace-fail '"libicuuc.so"' '"${icu}/lib/libicuuc.so"'
+ ''
+ + lib.optionalString (lib.versionAtLeast version "9") ''
+ substituteInPlace \
+ src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \
+ --replace-fail '#define VERSIONED_LIB_NAME_LEN 64' '#define VERSIONED_LIB_NAME_LEN 256'
+ ''
+ + lib.optionalString (lib.versionOlder version "9") ''
+ substituteInPlace \
+ src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \
+ --replace-warn 'libicuucName[64]' 'libicuucName[256]' \
+ --replace-warn 'libicui18nName[64]' 'libicui18nName[256]'
+ ''
+ )
+ + lib.optionalString isDarwin (
+ ''
+ substituteInPlace \
+ src/runtime/src/native/libs/System.Globalization.Native/CMakeLists.txt \
+ --replace-fail '/usr/lib/libicucore.dylib' '${darwin.ICU}/lib/libicucore.dylib'
- substituteInPlace \
- src/runtime/src/installer/managed/Microsoft.NET.HostModel/HostModelUtils.cs \
- src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets \
- --replace-fail '/usr/bin/codesign' '${sigtool}/bin/codesign'
+ substituteInPlace \
+ src/runtime/src/installer/managed/Microsoft.NET.HostModel/HostModelUtils.cs \
+ src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets \
+ --replace-fail '/usr/bin/codesign' '${sigtool}/bin/codesign'
- # fix: strip: error: unknown argument '-n'
- substituteInPlace \
- src/runtime/eng/native/functions.cmake \
- --replace-fail ' -no_code_signature_warning' ""
+ # fix: strip: error: unknown argument '-n'
+ substituteInPlace \
+ src/runtime/eng/native/functions.cmake \
+ --replace-fail ' -no_code_signature_warning' ""
- # [...]/installer.singlerid.targets(434,5): error MSB3073: The command "pkgbuild [...]" exited with code 127
- xmlstarlet ed \
- --inplace \
- -s //Project -t elem -n PropertyGroup \
- -s \$prev -t elem -n SkipInstallerBuild -v true \
- src/runtime/Directory.Build.props
+ # [...]/installer.singlerid.targets(434,5): error MSB3073: The command "pkgbuild [...]" exited with code 127
+ xmlstarlet ed \
+ --inplace \
+ -s //Project -t elem -n PropertyGroup \
+ -s \$prev -t elem -n SkipInstallerBuild -v true \
+ src/runtime/Directory.Build.props
- # stop passing -sdk without a path
- # stop using xcrun
- # add -module-cache-path to fix swift errors, see sandboxProfile
- # :0: error: unable to open output file '/var/folders/[...]/C/clang/ModuleCache/[...]/SwiftShims-[...].pcm': 'Operation not permitted'
- # :0: error: could not build Objective-C module 'SwiftShims'
- substituteInPlace \
- src/runtime/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt \
- --replace-fail ' -sdk ''${CMAKE_OSX_SYSROOT}' "" \
- --replace-fail 'xcrun swiftc' 'swiftc -module-cache-path "$ENV{HOME}/.cache/module-cache"'
- ''
- + lib.optionalString (lib.versionAtLeast version "9") ''
- # fix: strip: error: unknown argument '-n'
- substituteInPlace \
- src/runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets \
- src/runtime/src/native/managed/native-library.targets \
- --replace-fail ' -no_code_signature_warning' ""
+ # stop passing -sdk without a path
+ # stop using xcrun
+ # add -module-cache-path to fix swift errors, see sandboxProfile
+ # :0: error: unable to open output file '/var/folders/[...]/C/clang/ModuleCache/[...]/SwiftShims-[...].pcm': 'Operation not permitted'
+ # :0: error: could not build Objective-C module 'SwiftShims'
+ substituteInPlace \
+ src/runtime/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt \
+ --replace-fail ' -sdk ''${CMAKE_OSX_SYSROOT}' "" \
+ --replace-fail 'xcrun swiftc' 'swiftc -module-cache-path "$ENV{HOME}/.cache/module-cache"'
+ ''
+ + lib.optionalString (lib.versionAtLeast version "9") ''
+ # fix: strip: error: unknown argument '-n'
+ substituteInPlace \
+ src/runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets \
+ src/runtime/src/native/managed/native-library.targets \
+ --replace-fail ' -no_code_signature_warning' ""
- # ld: library not found for -ld_classic
- substituteInPlace \
- src/runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets \
- src/runtime/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj \
- --replace-fail 'Include="-ld_classic"' ""
- ''
- + lib.optionalString (lib.versionOlder version "9") ''
- # [...]/build.proj(123,5): error : Did not find PDBs for the following SDK files:
- # [...]/build.proj(123,5): error : sdk/8.0.102/System.Resources.Extensions.dll
- # [...]/build.proj(123,5): error : sdk/8.0.102/System.CodeDom.dll
- # [...]/build.proj(123,5): error : sdk/8.0.102/FSharp/System.Resources.Extensions.dll
- # [...]/build.proj(123,5): error : sdk/8.0.102/FSharp/System.CodeDom.dll
- substituteInPlace \
- build.proj \
- --replace-fail 'FailOnMissingPDBs="true"' 'FailOnMissingPDBs="false"'
+ # ld: library not found for -ld_classic
+ substituteInPlace \
+ src/runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets \
+ src/runtime/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj \
+ --replace-fail 'Include="-ld_classic"' ""
+ ''
+ + lib.optionalString (lib.versionOlder version "9") ''
+ # [...]/build.proj(123,5): error : Did not find PDBs for the following SDK files:
+ # [...]/build.proj(123,5): error : sdk/8.0.102/System.Resources.Extensions.dll
+ # [...]/build.proj(123,5): error : sdk/8.0.102/System.CodeDom.dll
+ # [...]/build.proj(123,5): error : sdk/8.0.102/FSharp/System.Resources.Extensions.dll
+ # [...]/build.proj(123,5): error : sdk/8.0.102/FSharp/System.CodeDom.dll
+ substituteInPlace \
+ build.proj \
+ --replace-fail 'FailOnMissingPDBs="true"' 'FailOnMissingPDBs="false"'
- substituteInPlace \
- src/runtime/src/mono/CMakeLists.txt \
- --replace-fail '/usr/lib/libicucore.dylib' '${darwin.ICU}/lib/libicucore.dylib'
- '');
+ substituteInPlace \
+ src/runtime/src/mono/CMakeLists.txt \
+ --replace-fail '/usr/lib/libicucore.dylib' '${darwin.ICU}/lib/libicucore.dylib'
+ ''
+ );
prepFlags = [
"--no-artifacts"
"--no-prebuilts"
- "--with-packages" dotnetSdk.artifacts
+ "--with-packages"
+ dotnetSdk.artifacts
];
- configurePhase = let
- prepScript =
- if (lib.versionAtLeast version "9")
- then "./prep-source-build.sh"
- else "./prep.sh";
- in ''
- runHook preConfigure
+ configurePhase =
+ let
+ prepScript = if (lib.versionAtLeast version "9") then "./prep-source-build.sh" else "./prep.sh";
+ in
+ ''
+ runHook preConfigure
- # The build process tries to overwrite some things in the sdk (e.g.
- # SourceBuild.MSBuildSdkResolver.dll), so it needs to be mutable.
- cp -Tr ${dotnetSdk} .dotnet
- chmod -R +w .dotnet
+ # The build process tries to overwrite some things in the sdk (e.g.
+ # SourceBuild.MSBuildSdkResolver.dll), so it needs to be mutable.
+ cp -Tr ${dotnetSdk} .dotnet
+ chmod -R +w .dotnet
- ${prepScript} $prepFlags
+ ${prepScript} $prepFlags
- runHook postConfigure
- '';
+ runHook postConfigure
+ '';
postConfigure = lib.optionalString (lib.versionAtLeast version "9") ''
# see patch-npm-packages.proj
@@ -353,21 +364,24 @@ in stdenv.mkDerivation rec {
# https://github.com/NixOS/nixpkgs/issues/38991
# bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
- LOCALE_ARCHIVE = lib.optionalString isLinux
- "${glibcLocales}/lib/locale/locale-archive";
+ LOCALE_ARCHIVE = lib.optionalString isLinux "${glibcLocales}/lib/locale/locale-archive";
- buildFlags = [
- "--with-packages" dotnetSdk.artifacts
- "--clean-while-building"
- "--release-manifest" releaseManifestFile
- ]
- ++ lib.optionals (lib.versionAtLeast version "9") [
- "--source-build"
- ]
- ++ [
- "--"
- "-p:PortableBuild=true"
- ] ++ lib.optional (targetRid != buildRid) "-p:TargetRid=${targetRid}";
+ buildFlags =
+ [
+ "--with-packages"
+ dotnetSdk.artifacts
+ "--clean-while-building"
+ "--release-manifest"
+ releaseManifestFile
+ ]
+ ++ lib.optionals (lib.versionAtLeast version "9") [
+ "--source-build"
+ ]
+ ++ [
+ "--"
+ "-p:PortableBuild=true"
+ ]
+ ++ lib.optional (targetRid != buildRid) "-p:TargetRid=${targetRid}";
buildPhase = ''
runHook preBuild
@@ -389,35 +403,37 @@ in stdenv.mkDerivation rec {
runHook postBuild
'';
- installPhase = let
- assets = if (lib.versionAtLeast version "9") then "assets" else targetArch;
- in ''
- runHook preInstall
+ installPhase =
+ let
+ assets = if (lib.versionAtLeast version "9") then "assets" else targetArch;
+ in
+ ''
+ runHook preInstall
- mkdir "$out"
+ mkdir "$out"
- pushd "artifacts/${assets}/Release"
- find . -name \*.tar.gz | while read archive; do
- target=$out/$(basename "$archive" .tar.gz)
- # dotnet 9 currently has two copies of the sdk tarball
- [[ ! -e "$target" ]] || continue
- mkdir "$target"
- tar -C "$target" -xzf "$PWD/$archive"
- done
- popd
+ pushd "artifacts/${assets}/Release"
+ find . -name \*.tar.gz | while read archive; do
+ target=$out/$(basename "$archive" .tar.gz)
+ # dotnet 9 currently has two copies of the sdk tarball
+ [[ ! -e "$target" ]] || continue
+ mkdir "$target"
+ tar -C "$target" -xzf "$PWD/$archive"
+ done
+ popd
- local -r unpacked="$PWD/.unpacked"
- for nupkg in $out/Private.SourceBuilt.Artifacts.*.${targetRid}/{,SourceBuildReferencePackages/}*.nupkg; do
- rm -rf "$unpacked"
- unzip -qd "$unpacked" "$nupkg"
- chmod -R +rw "$unpacked"
- rm "$nupkg"
- mv "$unpacked" "$nupkg"
- # TODO: should we fix executable flags here? see dotnetInstallHook
- done
+ local -r unpacked="$PWD/.unpacked"
+ for nupkg in $out/Private.SourceBuilt.Artifacts.*.${targetRid}/{,SourceBuildReferencePackages/}*.nupkg; do
+ rm -rf "$unpacked"
+ unzip -qd "$unpacked" "$nupkg"
+ chmod -R +rw "$unpacked"
+ rm "$nupkg"
+ mv "$unpacked" "$nupkg"
+ # TODO: should we fix executable flags here? see dotnetInstallHook
+ done
- runHook postInstall
- '';
+ runHook postInstall
+ '';
# dotnet cli is in the root, so we need to strip from there
# TODO: should we install in $out/share/dotnet?