Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

caido: support for linux-aarch64 and Darwin platforms

+146 -32
+146 -32
pkgs/by-name/ca/caido/package.nix
··· 5 appimageTools, 6 makeWrapper, 7 autoPatchelfHook, 8 libgcc, 9 appVariants ? [ ], 10 }: 11 - 12 let 13 pname = "caido"; 14 appVariantList = [ ··· 16 "desktop" 17 ]; 18 version = "0.52.0"; 19 cli = fetchurl { 20 - url = "https://caido.download/releases/v${version}/caido-cli-v${version}-linux-x86_64.tar.gz"; 21 - hash = "sha256-gxB5GeJXTrPDGRXxKV3kdYQ0VgmmIeO8rggRPQlTDqw="; 22 }; 23 desktop = fetchurl { 24 - url = "https://caido.download/releases/v${version}/caido-desktop-v${version}-linux-x86_64.AppImage"; 25 - hash = "sha256-ANCMHJTeH0UyJvCpslbxc0I3BbfPfR7kr4UISWeo2ec="; 26 }; 27 appimageContents = appimageTools.extractType2 { 28 inherit pname version; 29 src = desktop; 30 }; 31 32 - wrappedDesktop = appimageTools.wrapType2 { 33 - src = desktop; 34 - inherit pname version; 35 36 - nativeBuildInputs = [ makeWrapper ]; 37 38 - extraPkgs = pkgs: [ pkgs.libthai ]; 39 40 - extraInstallCommands = '' 41 - install -m 444 -D ${appimageContents}/caido.desktop -t $out/share/applications 42 - install -m 444 -D ${appimageContents}/caido.png \ 43 - $out/share/icons/hicolor/512x512/apps/caido.png 44 - wrapProgram $out/bin/caido \ 45 - --set WEBKIT_DISABLE_COMPOSITING_MODE 1 \ 46 - --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" 47 - ''; 48 - }; 49 50 - wrappedCli = stdenv.mkDerivation { 51 - src = cli; 52 - inherit pname version; 53 54 - nativeBuildInputs = [ autoPatchelfHook ]; 55 56 - buildInputs = [ libgcc ]; 57 58 - sourceRoot = "."; 59 60 - installPhase = '' 61 - runHook preInstall 62 - install -m755 -D caido-cli $out/bin/caido-cli 63 - ''; 64 - }; 65 66 meta = { 67 description = "Lightweight web security auditing toolkit"; ··· 73 d3vil0p3r 74 blackzeshi 75 ]; 76 - platforms = [ "x86_64-linux" ]; 77 }; 78 - 79 in 80 lib.checkListOfEnum "${pname}: appVariants" appVariantList appVariants ( 81 if appVariants == [ "desktop" ] then
··· 5 appimageTools, 6 makeWrapper, 7 autoPatchelfHook, 8 + _7zz, 9 + unzip, 10 libgcc, 11 appVariants ? [ ], 12 }: 13 let 14 pname = "caido"; 15 appVariantList = [ ··· 17 "desktop" 18 ]; 19 version = "0.52.0"; 20 + 21 + system = stdenv.hostPlatform.system; 22 + isLinux = stdenv.isLinux; 23 + isDarwin = stdenv.isDarwin; 24 + 25 + # CLI sources 26 + cliSources = { 27 + x86_64-linux = { 28 + url = "https://caido.download/releases/v${version}/caido-cli-v${version}-linux-x86_64.tar.gz"; 29 + hash = "sha256-gxB5GeJXTrPDGRXxKV3kdYQ0VgmmIeO8rggRPQlTDqw="; 30 + }; 31 + aarch64-linux = { 32 + url = "https://caido.download/releases/v${version}/caido-cli-v${version}-linux-aarch64.tar.gz"; 33 + hash = "sha256-VaYy3OkAeuxZ0+UFENOvFYowa9jExQd3WO7VFJ6kPMg="; 34 + }; 35 + x86_64-darwin = { 36 + url = "https://caido.download/releases/v${version}/caido-cli-v${version}-mac-x86_64.zip"; 37 + hash = "sha256-GhPKxkCJjhwafmXOgaCePCn3g1Mls+ZFu4xWBzVXaQo="; 38 + }; 39 + aarch64-darwin = { 40 + url = "https://caido.download/releases/v${version}/caido-cli-v${version}-mac-aarch64.zip"; 41 + hash = "sha256-R394RFaYHm8zi4gKuaP0Ljhybq/80MGYlTlld3tACdQ="; 42 + }; 43 + }; 44 + 45 + # Desktop sources 46 + desktopSources = { 47 + x86_64-linux = { 48 + url = "https://caido.download/releases/v${version}/caido-desktop-v${version}-linux-x86_64.AppImage"; 49 + hash = "sha256-ANCMHJTeH0UyJvCpslbxc0I3BbfPfR7kr4UISWeo2ec="; 50 + }; 51 + aarch64-linux = { 52 + url = "https://caido.download/releases/v${version}/caido-desktop-v${version}-linux-aarch64.AppImage"; 53 + hash = "sha256-tlNcxc+eh/Y0HrkMXWJ2SP+Lr5xfXJUAhZAgk7s/WRE="; 54 + }; 55 + x86_64-darwin = { 56 + url = "https://caido.download/releases/v${version}/caido-desktop-v${version}-mac-x86_64.dmg"; 57 + hash = "sha256-c2Hc6KCwgebAa3rHAvV9FgVeiexSuwqYbe85PwNxV08="; 58 + }; 59 + aarch64-darwin = { 60 + url = "https://caido.download/releases/v${version}/caido-desktop-v${version}-mac-aarch64.dmg"; 61 + hash = "sha256-fbhQ4Q0TyRySd3k9h7CutnreVJj29+XvX/RM1cDTRSg="; 62 + }; 63 + }; 64 + 65 + cliSource = cliSources.${system} or (throw "Unsupported system for caido-cli: ${system}"); 66 + desktopSource = 67 + desktopSources.${system} or (throw "Unsupported system for caido-desktop: ${system}"); 68 + 69 cli = fetchurl { 70 + url = cliSource.url; 71 + hash = cliSource.hash; 72 }; 73 + 74 desktop = fetchurl { 75 + url = desktopSource.url; 76 + hash = desktopSource.hash; 77 }; 78 + 79 appimageContents = appimageTools.extractType2 { 80 inherit pname version; 81 src = desktop; 82 }; 83 84 + wrappedDesktop = 85 + if isLinux then 86 + appimageTools.wrapType2 { 87 + src = desktop; 88 + inherit pname version; 89 90 + nativeBuildInputs = [ makeWrapper ]; 91 92 + extraPkgs = pkgs: [ pkgs.libthai ]; 93 94 + extraInstallCommands = '' 95 + install -m 444 -D ${appimageContents}/caido.desktop -t $out/share/applications 96 + install -m 444 -D ${appimageContents}/caido.png \ 97 + $out/share/icons/hicolor/512x512/apps/caido.png 98 + wrapProgram $out/bin/caido \ 99 + --set WEBKIT_DISABLE_COMPOSITING_MODE 1 \ 100 + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" 101 + ''; 102 + } 103 + else if isDarwin then 104 + stdenv.mkDerivation { 105 + src = desktop; 106 + inherit pname version; 107 108 + nativeBuildInputs = [ _7zz ]; 109 + sourceRoot = "."; 110 + 111 + unpackPhase = '' 112 + runHook preUnpack 113 + ${_7zz}/bin/7zz x $src 114 + runHook postUnpack 115 + ''; 116 + 117 + installPhase = '' 118 + runHook preInstall 119 + mkdir -p $out/Applications 120 + cp -r Caido.app $out/Applications/ 121 + mkdir -p $out/bin 122 + ln -s $out/Applications/Caido.app/Contents/MacOS/Caido $out/bin/caido 123 + runHook postInstall 124 + ''; 125 + 126 + meta = { 127 + platforms = [ 128 + "x86_64-darwin" 129 + "aarch64-darwin" 130 + ]; 131 + }; 132 + } 133 + else 134 + throw "Desktop variant is not supported on ${stdenv.hostPlatform.system}"; 135 + 136 + wrappedCli = 137 + if isLinux then 138 + stdenv.mkDerivation { 139 + src = cli; 140 + inherit pname version; 141 + 142 + nativeBuildInputs = [ autoPatchelfHook ]; 143 + buildInputs = [ libgcc ]; 144 + sourceRoot = "."; 145 146 + installPhase = '' 147 + runHook preInstall 148 + install -m755 -D caido-cli $out/bin/caido-cli 149 + runHook postInstall 150 + ''; 151 + } 152 + else if isDarwin then 153 + stdenv.mkDerivation { 154 + src = cli; 155 + inherit pname version; 156 157 + nativeBuildInputs = [ unzip ]; 158 + sourceRoot = "."; 159 160 + installPhase = '' 161 + runHook preInstall 162 + install -m755 -D caido-cli $out/bin/caido-cli 163 + runHook postInstall 164 + ''; 165 166 + meta = { 167 + platforms = [ 168 + "x86_64-darwin" 169 + "aarch64-darwin" 170 + ]; 171 + }; 172 + } 173 + else 174 + throw "CLI variant is not supported on ${stdenv.hostPlatform.system}"; 175 176 meta = { 177 description = "Lightweight web security auditing toolkit"; ··· 183 d3vil0p3r 184 blackzeshi 185 ]; 186 + platforms = [ 187 + "x86_64-linux" 188 + "aarch64-linux" 189 + "x86_64-darwin" 190 + "aarch64-darwin" 191 + ]; 192 }; 193 in 194 lib.checkListOfEnum "${pname}: appVariants" appVariantList appVariants ( 195 if appVariants == [ "desktop" ] then