nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildDotnetModule,
6 dotnetCorePackages,
7 libX11,
8 libICE,
9 libSM,
10 libXi,
11 libXcursor,
12 libXext,
13 libXrandr,
14 fontconfig,
15 glew,
16 makeDesktopItem,
17 copyDesktopItems,
18 icoutils,
19 bintools,
20 fixDarwinDylibNames,
21 autoSignDarwinBinariesHook,
22}:
23
24buildDotnetModule rec {
25 pname = "avalonia-ilspy";
26 version = "7.2-rc";
27
28 src = fetchFromGitHub {
29 owner = "icsharpcode";
30 repo = "AvaloniaILSpy";
31 rev = "v${version}";
32 hash = "sha256-cCQy5cSpJNiVZqgphURcnraEM0ZyXGhzJLb5AThNfPQ=";
33 };
34
35 patches = [
36 # Remove dead nuget package source
37 ./remove-broken-sources.patch
38 # Upgrade project to .NET 8.0
39 ./dotnet-8-upgrade.patch
40 ];
41
42 nativeBuildInputs = [
43 copyDesktopItems
44 icoutils
45 ]
46 ++ lib.optionals stdenv.hostPlatform.isDarwin [
47 bintools
48 fixDarwinDylibNames
49 ]
50 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
51 autoSignDarwinBinariesHook
52 ];
53
54 buildInputs = [
55 # Dependencies of nuget packages w/ native binaries
56 (lib.getLib stdenv.cc.cc)
57 fontconfig
58 ];
59
60 runtimeDeps = [
61 # Avalonia UI
62 libX11
63 libICE
64 libSM
65 libXi
66 libXcursor
67 libXext
68 libXrandr
69 fontconfig
70 glew
71 ];
72
73 postInstall = ''
74 icotool --icon -x ILSpy/ILSpy.ico
75 for i in 16 32 48 256; do
76 size=''${i}x''${i}
77 install -Dm444 *_''${size}x32.png $out/share/icons/hicolor/$size/apps/ILSpy.png
78 done
79 ''
80 + lib.optionalString stdenv.hostPlatform.isDarwin ''
81 install -Dm444 ILSpy/Info.plist $out/Applications/ILSpy.app/Contents/Info.plist
82 install -Dm444 ILSpy/ILSpy.icns $out/Applications/ILSpy.app/Contents/Resources/ILSpy.icns
83 mkdir -p $out/Applications/ILSpy.app/Contents/MacOS
84 ln -s $out/bin/ILSpy $out/Applications/ILSpy.app/Contents/MacOS/ILSpy
85 '';
86
87 dotnet-sdk = dotnetCorePackages.sdk_8_0;
88
89 projectFile = "ILSpy/ILSpy.csproj";
90 nugetDeps = ./deps.json;
91 executables = [ "ILSpy" ];
92
93 desktopItems = [
94 (makeDesktopItem {
95 name = "ILSpy";
96 desktopName = "ILSpy";
97 exec = "ILSpy";
98 icon = "ILSpy";
99 comment = ".NET assembly browser and decompiler";
100 categories = [
101 "Development"
102 ];
103 keywords = [
104 ".net"
105 "il"
106 "assembly"
107 ];
108 })
109 ];
110
111 meta = with lib; {
112 description = ".NET assembly browser and decompiler";
113 homepage = "https://github.com/icsharpcode/AvaloniaILSpy";
114 license = with licenses; [
115 mit
116 # third party dependencies
117 lgpl21Only
118 mspl
119 ];
120 sourceProvenance = with sourceTypes; [
121 fromSource
122 binaryBytecode
123 binaryNativeCode
124 ];
125 maintainers = with maintainers; [
126 AngryAnt
127 emilytrau
128 ];
129 mainProgram = "ILSpy";
130 };
131}