Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 clangStdenv,
4 stdenv,
5 cmake,
6 autoPatchelfHook,
7 fetchFromGitHub,
8 dotnetCorePackages,
9 buildDotnetModule,
10 netcoredbg,
11 testers,
12}:
13let
14 pname = "netcoredbg";
15 build = "1054";
16 release = "3.1.2";
17 version = "${release}-${build}";
18 hash = "sha256-WORGZXbq6d3sxGqyG8oZSwcBoVaD3D56t9K6PJoKFsM=";
19
20 coreclr-version = "v8.0.16";
21 coreclr-src = fetchFromGitHub {
22 owner = "dotnet";
23 repo = "runtime";
24 rev = coreclr-version;
25 hash = "sha256-/fSKCIugR3UhqxBxtQRw+Bw+UpaSjB4xj0iBiXJaiR4=";
26 };
27
28 dotnet-sdk = dotnetCorePackages.sdk_8_0;
29
30 src = fetchFromGitHub {
31 owner = "Samsung";
32 repo = "netcoredbg";
33 rev = version;
34 inherit hash;
35 };
36
37 unmanaged = clangStdenv.mkDerivation {
38 inherit src pname version;
39
40 nativeBuildInputs = [
41 cmake
42 dotnet-sdk
43 ];
44
45 hardeningDisable = [ "strictoverflow" ];
46
47 preConfigure = ''
48 export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
49 '';
50
51 cmakeFlags = [
52 "-DCORECLR_DIR=${coreclr-src}/src/coreclr"
53 "-DDOTNET_DIR=${dotnet-sdk}/share/dotnet"
54 "-DBUILD_MANAGED=0"
55 ];
56 };
57
58 managed = buildDotnetModule {
59 inherit
60 pname
61 version
62 src
63 dotnet-sdk
64 ;
65 dotnet-runtime = null;
66
67 projectFile = "src/managed/ManagedPart.csproj";
68 nugetDeps = ./deps.json;
69
70 # include platform-specific dbgshim binary in nugetDeps
71 dotnetFlags = [ "-p:UseDbgShimDependency=true" ];
72 executables = [ ];
73
74 # this passes RID down to dotnet build command
75 # and forces dotnet to include binary dependencies in the output (libdbgshim)
76 selfContainedBuild = true;
77 };
78in
79stdenv.mkDerivation {
80 inherit pname version;
81 # managed brings external binaries (libdbgshim.*)
82 # include source here so that autoPatchelfHook can do it's job
83 src = managed;
84
85 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
86 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ (lib.getLib stdenv.cc.cc) ];
87 installPhase = ''
88 mkdir -p $out/share/netcoredbg $out/bin
89 cp ${unmanaged}/* $out/share/netcoredbg
90 cp ./lib/netcoredbg/* $out/share/netcoredbg
91 # darwin won't work unless we link all files
92 ln -s $out/share/netcoredbg/* "$out/bin/"
93 '';
94
95 passthru = {
96 inherit (managed) fetch-deps;
97 tests.version = testers.testVersion {
98 package = netcoredbg;
99 command = "netcoredbg --version";
100 version = "NET Core debugger ${release}";
101 };
102 };
103
104 meta = with lib; {
105 description = "Managed code debugger with MI interface for CoreCLR";
106 homepage = "https://github.com/Samsung/netcoredbg";
107 license = licenses.mit;
108 platforms = platforms.unix;
109 mainProgram = "netcoredbg";
110 maintainers = with maintainers; [
111 leo60228
112 konradmalik
113 ];
114 };
115}