diff options
-rw-r--r-- | default.nix | 2 | ||||
-rw-r--r-- | pkgs/idafree/default.nix | 4 | ||||
-rw-r--r-- | pkgs/idafree/package.nix | 125 | ||||
-rw-r--r-- | pkgs/idafree/srcs.json | 14 | ||||
-rwxr-xr-x | pkgs/idafree/update.sh | 26 |
5 files changed, 171 insertions, 0 deletions
diff --git a/default.nix b/default.nix index e85b2c4..d537768 100644 --- a/default.nix +++ b/default.nix | |||
@@ -11,4 +11,6 @@ rec { | |||
11 | sddm-theme-sugar-light = pkgs.callPackage ./pkgs/sddm-theme-sugar-light/package.nix {}; | 11 | sddm-theme-sugar-light = pkgs.callPackage ./pkgs/sddm-theme-sugar-light/package.nix {}; |
12 | 12 | ||
13 | commit-mono = pkgs.callPackage ./pkgs/commit-mono/package.nix {}; | 13 | commit-mono = pkgs.callPackage ./pkgs/commit-mono/package.nix {}; |
14 | |||
15 | idafree = pkgs.callPackage ./pkgs/idafree/package.nix {}; | ||
14 | } | 16 | } |
diff --git a/pkgs/idafree/default.nix b/pkgs/idafree/default.nix new file mode 100644 index 0000000..28b6df8 --- /dev/null +++ b/pkgs/idafree/default.nix | |||
@@ -0,0 +1,4 @@ | |||
1 | let | ||
2 | pkgs = import <nixpkgs> {}; | ||
3 | in | ||
4 | pkgs.callPackage ./package.nix {} | ||
diff --git a/pkgs/idafree/package.nix b/pkgs/idafree/package.nix new file mode 100644 index 0000000..d29a54f --- /dev/null +++ b/pkgs/idafree/package.nix | |||
@@ -0,0 +1,125 @@ | |||
1 | # Copy from https://github.com/NixOS/nixpkgs/pull/217753 | ||
2 | { lib | ||
3 | , stdenv | ||
4 | , fetchurl | ||
5 | , libGL | ||
6 | , zlib | ||
7 | , libkrb5 | ||
8 | , libsecret | ||
9 | , libunwind | ||
10 | , libxkbcommon | ||
11 | , glib | ||
12 | , makeWrapper | ||
13 | , openssl | ||
14 | , xorg | ||
15 | , dbus | ||
16 | , fontconfig | ||
17 | , freetype | ||
18 | , makeDesktopItem | ||
19 | }: | ||
20 | |||
21 | |||
22 | let | ||
23 | srcs = builtins.fromJSON (builtins.readFile ./srcs.json); | ||
24 | in | ||
25 | |||
26 | stdenv.mkDerivation rec { | ||
27 | pname = "ida-free"; | ||
28 | version = "8.2.230124"; | ||
29 | |||
30 | src = fetchurl { | ||
31 | inherit (srcs.${stdenv.system}) url sha256; | ||
32 | }; | ||
33 | |||
34 | icon = fetchurl { | ||
35 | urls = [ | ||
36 | "https://www.hex-rays.com/products/ida/news/8_1/images/icon_free.png" | ||
37 | "https://web.archive.org/web/20221105181231if_/https://hex-rays.com/products/ida/news/8_1/images/icon_free.png" | ||
38 | ]; | ||
39 | sha256 = "sha256-widkv2VGh+eOauUK/6Sz/e2auCNFAsc8n9z0fdrSnW0="; | ||
40 | }; | ||
41 | |||
42 | desktopItem = makeDesktopItem { | ||
43 | name = pname; | ||
44 | exec = "ida64"; | ||
45 | icon = icon; | ||
46 | comment = "Freeware version of the world's smartest and most feature-full disassembler"; | ||
47 | desktopName = "IDA Free"; | ||
48 | genericName = "Interactive Disassembler"; | ||
49 | categories = [ "Development" ]; | ||
50 | }; | ||
51 | |||
52 | ldLibraryPath = lib.makeLibraryPath [ | ||
53 | stdenv.cc.cc | ||
54 | zlib | ||
55 | glib | ||
56 | xorg.libXi | ||
57 | xorg.libxcb | ||
58 | xorg.libXrender | ||
59 | xorg.libXau | ||
60 | xorg.libX11 | ||
61 | xorg.libSM | ||
62 | xorg.libICE | ||
63 | xorg.libXext | ||
64 | xorg.xcbutilwm | ||
65 | xorg.xcbutilimage | ||
66 | xorg.xcbutilkeysyms | ||
67 | xorg.xcbutilrenderutil | ||
68 | libkrb5 | ||
69 | libsecret | ||
70 | libunwind | ||
71 | libxkbcommon | ||
72 | openssl | ||
73 | dbus | ||
74 | fontconfig | ||
75 | freetype | ||
76 | libGL | ||
77 | ]; | ||
78 | |||
79 | nativeBuildInputs = [ makeWrapper ]; | ||
80 | |||
81 | dontUnpack = true; | ||
82 | dontStrip = true; | ||
83 | dontPatchELF = true; | ||
84 | |||
85 | installPhase = '' | ||
86 | runHook preInstall | ||
87 | |||
88 | IDADIR=$out/opt/${pname} | ||
89 | |||
90 | install -d $IDADIR $out/bin $out/share/applications | ||
91 | |||
92 | # Invoke the installer with the dynamic loader directly, avoiding the need | ||
93 | # to copy it to fix permissions and patch the executable. | ||
94 | $(cat $NIX_CC/nix-support/dynamic-linker) ${src} \ | ||
95 | --mode unattended --prefix $IDADIR --installpassword "" | ||
96 | |||
97 | rm $IDADIR/[Uu]ninstall* | ||
98 | |||
99 | for bb in ida64 assistant; do | ||
100 | patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $IDADIR/$bb | ||
101 | wrapProgram \ | ||
102 | $IDADIR/$bb \ | ||
103 | --set LD_LIBRARY_PATH "$IDADIR:${ldLibraryPath}" \ | ||
104 | --set QT_PLUGIN_PATH "$IDADIR/plugins/platforms" | ||
105 | done | ||
106 | |||
107 | ln -s $IDADIR/ida64 $out/bin/ida64 | ||
108 | |||
109 | cp $desktopItem/share/applications/* $out/share/applications | ||
110 | |||
111 | runHook postInstall | ||
112 | ''; | ||
113 | |||
114 | passthru.updateScript = ./update.sh; | ||
115 | |||
116 | meta = with lib; { | ||
117 | description = "Freeware version of the world's smartest and most feature-full disassembler"; | ||
118 | homepage = "https://hex-rays.com/ida-free/"; | ||
119 | sourceProvenance = with sourceTypes; [ binaryNativeCode ]; | ||
120 | license = licenses.unfree; | ||
121 | maintainers = with maintainers; [ lourkeur ]; | ||
122 | platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]; | ||
123 | mainProgram = "ida64"; | ||
124 | }; | ||
125 | } | ||
diff --git a/pkgs/idafree/srcs.json b/pkgs/idafree/srcs.json new file mode 100644 index 0000000..73169bd --- /dev/null +++ b/pkgs/idafree/srcs.json | |||
@@ -0,0 +1,14 @@ | |||
1 | { | ||
2 | "x86_64-linux": { | ||
3 | "url": "https://out7.hex-rays.com/files/idafree83_linux.run", | ||
4 | "sha256": "10haw0nrsinr0aj77xcjzimmr7mwxdffwr5y48bg1m7j68adk4xb" | ||
5 | }, | ||
6 | "x86_64-darwin": { | ||
7 | "url": "https://out7.hex-rays.com/files/idafree83_mac.app.zip", | ||
8 | "sha256": "04gfq21ranm6zydbjqag3ll9ij8ml8m5g13dv0jlp32iyvdpkip1" | ||
9 | }, | ||
10 | "aarch64-darwin": { | ||
11 | "url": "https://out7.hex-rays.com/files/arm_idafree83_mac.app.zip", | ||
12 | "sha256": "14l9giafygxnkwrma6bq8rxsjiy1cgrp9l2pwsbmcgqgchk0gzaj" | ||
13 | } | ||
14 | } | ||
diff --git a/pkgs/idafree/update.sh b/pkgs/idafree/update.sh new file mode 100755 index 0000000..cf4068e --- /dev/null +++ b/pkgs/idafree/update.sh | |||
@@ -0,0 +1,26 @@ | |||
1 | #! /usr/bin/env nix-shell | ||
2 | #! nix-shell -i bash -p bash curl jq | ||
3 | |||
4 | set -e | ||
5 | |||
6 | urls=( | ||
7 | https://out7.hex-rays.com/files/idafree83_linux.run | ||
8 | https://out7.hex-rays.com/files/idafree83_mac.app.zip | ||
9 | https://out7.hex-rays.com/files/arm_idafree83_mac.app.zip | ||
10 | ) | ||
11 | |||
12 | archs=( | ||
13 | x86_64-linux | ||
14 | x86_64-darwin | ||
15 | aarch64-darwin | ||
16 | ) | ||
17 | |||
18 | hashes=() | ||
19 | for u in "${urls[@]}"; do | ||
20 | hash=$(nix-prefetch-url $u) | ||
21 | hashes=("${hashes[@]}" "$hash") | ||
22 | done | ||
23 | |||
24 | for ((i = 0; i < ${#urls[@]}; i++)); do | ||
25 | echo '{"key":"'${archs[i]}'", "value":{"url":"'${urls[i]}'", "sha256":"'${hashes[i]}'"}}' | ||
26 | done | jq -s from_entries >pkgs/development/tools/analysis/ida-free/srcs.json | ||