1{ lib
2, stdenv
3, fetchFromGitHub
4, buildDotnetModule
5, dotnetCorePackages
6, powershell
7, autoSignDarwinBinariesHook
8, glibcLocales
9}:
10buildDotnetModule rec {
11 pname = "ilspycmd";
12 version = "8.0";
13
14 src = fetchFromGitHub {
15 owner = "icsharpcode";
16 repo = "ILSpy";
17 rev = "v${version}";
18 hash = "sha256-ERBYXgpBRXISfqBSBEydEQuD/5T1dvJ+wNg2U5pKip4=";
19 };
20
21 nativeBuildInputs = [
22 powershell
23 ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ autoSignDarwinBinariesHook ];
24
25 # https://github.com/NixOS/nixpkgs/issues/38991
26 # bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
27 env.LOCALE_ARCHIVE = lib.optionalString stdenv.hostPlatform.isLinux "${glibcLocales}/lib/locale/locale-archive";
28
29 dotnet-sdk = dotnetCorePackages.sdk_6_0;
30 dotnet-runtime = dotnetCorePackages.runtime_6_0;
31
32 projectFile = "ICSharpCode.ILSpyCmd/ICSharpCode.ILSpyCmd.csproj";
33 nugetDeps = ./deps.nix;
34
35 meta = with lib; {
36 description = "Tool for decompiling .NET assemblies and generating portable PDBs";
37 mainProgram = "ilspycmd";
38 homepage = "https://github.com/icsharpcode/ILSpy";
39 changelog = "https://github.com/icsharpcode/ILSpy/releases/tag/${src.rev}";
40 license = with licenses; [
41 mit
42 # third party dependencies
43 mspl
44 asl20
45 ];
46 sourceProvenance = with sourceTypes; [ fromSource binaryBytecode ];
47 maintainers = with maintainers; [ emilytrau ];
48 };
49}