about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/avalonia-ilspy/default.nix
blob: 20914e1c90b3a28a02a41a96f7e82c6aa84dba31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
{ lib
, stdenv
, fetchzip
, unzip
, autoPatchelfHook
, makeWrapper
, makeDesktopItem
, copyDesktopItems
, lttng-ust
, libkrb5
, zlib
, fontconfig
, openssl
, libX11
, libICE
, libSM
, icu
}:

stdenv.mkDerivation rec {
  pname = "avalonia-ilspy";
  version = "7.2-rc";

  src = fetchzip {
    url = "https://github.com/icsharpcode/AvaloniaILSpy/releases/download/v${version}/Linux.x64.Release.zip";
    sha256 = "1crf0ng4l6x70wjlz3r6qw8l166gd52ys11j7ilb4nyy3mkjxk11";
  };

  nativeBuildInputs = [
    unzip
    autoPatchelfHook
    makeWrapper
    copyDesktopItems
  ];

  buildInputs = [
    stdenv.cc.cc.lib
    lttng-ust
    libkrb5
    zlib
    fontconfig
  ];

  libraryPath = lib.makeLibraryPath [
    openssl
    libX11
    libICE
    libSM
    icu
  ];

  unpackPhase = ''
    unzip -qq $src/ILSpy-linux-x64-Release.zip
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin $out/lib $out/share/icons/hicolor/scalable/apps
    cp -r artifacts/linux-x64/* $out/lib
    ln -s $out/lib/Images/ILSpy.png $out/share/icons/hicolor/scalable/apps/ILSpy.png

    chmod +x $out/lib/ILSpy
    wrapProgram $out/lib/ILSpy --prefix LD_LIBRARY_PATH : ${libraryPath}
    mv $out/lib/ILSpy $out/bin

    runHook postInstall
  '';

  # dotnet runtime requirements
  preFixup = ''
    patchelf --replace-needed liblttng-ust.so.0 liblttng-ust.so $out/lib/libcoreclrtraceptprovider.so
  '';
  dontStrip = true;

  desktopItems = [ (makeDesktopItem {
    name = "ILSpy";
    desktopName = "ILSpy";
    exec = "ILSpy";
    icon = "ILSpy";
    comment = ".NET assembly browser and decompiler";
    categories = [
      "Development"
    ];
    keywords = [
      ".net"
      "il"
      "assembly"
    ];
  }) ];

  meta = with lib; {
    description = ".NET assembly browser and decompiler";
    homepage = "https://github.com/icsharpcode/AvaloniaILSpy";
    license = licenses.mit;
    platforms = [ "x86_64-linux" ];
    maintainers = with lib.maintainers; [ AngryAnt ];
    mainProgram = "ILSpy";
  };
}