fdb820602b
To reproduce:
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: nix-x86_64-darwin
language: nix
rule:
any:
- pattern: "\"x86_64-darwin\""
kind: list_expression > string_expression
- pattern:
context: "{ \"x86_64-darwin\" = $EXPR; }"
selector: binding
- pattern:
context: "{ x86_64-darwin = $EXPR; }"
selector: binding
fix:
template: ""
' pkgs
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: json-first-x86_64-darwin
language: json
rule:
kind: object > pair:nth-child(1)
has:
pattern: "\"x86_64-darwin\""
field: key
fix:
template: ""
expandEnd: { regex: "," }
' pkgs
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: json-x86_64-darwin
language: json
rule:
kind: object > pair
has:
pattern: "\"x86_64-darwin\""
field: key
fix:
template: ""
expandStart: { regex: "," }
' pkgs
$ git restore pkgs/by-name/om/omnix/package.nix
$ git diff --name-only -z \
| nix shell nixpkgs/3b32825de172d0bc85664f495edb096b10862524#gnused \
-c xargs -0 sed -i '/^$/N; /^\n\? \+$/d'
$ treefmt
66 lines
1.8 KiB
Nix
66 lines
1.8 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchurl,
|
|
autoPatchelfHook,
|
|
unzip,
|
|
libgcc,
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "caido-cli";
|
|
version = "0.57.0";
|
|
|
|
src = fetchurl (
|
|
{
|
|
x86_64-linux = {
|
|
url = "https://caido.download/releases/v${finalAttrs.version}/caido-cli-v${finalAttrs.version}-linux-x86_64.tar.gz";
|
|
hash = "sha256-ujpGYERNceUPartkgx4o38xUfPwWvnmiEnjkvmEbybA=";
|
|
};
|
|
aarch64-linux = {
|
|
url = "https://caido.download/releases/v${finalAttrs.version}/caido-cli-v${finalAttrs.version}-linux-aarch64.tar.gz";
|
|
hash = "sha256-d1xzF0N6emShCQpotFiQEj1wV3hdt1DK7R+6Smlxrmg=";
|
|
};
|
|
aarch64-darwin = {
|
|
url = "https://caido.download/releases/v${finalAttrs.version}/caido-cli-v${finalAttrs.version}-mac-aarch64.zip";
|
|
hash = "sha256-FwbKLEwjiFzZWdBS6RgsDtc/EkI9AT2CBGwdmgEdDnw=";
|
|
};
|
|
}
|
|
.${stdenv.hostPlatform.system}
|
|
or (throw "caido-cli: unsupported system ${stdenv.hostPlatform.system}")
|
|
);
|
|
|
|
nativeBuildInputs =
|
|
lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ unzip ];
|
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ libgcc ];
|
|
|
|
sourceRoot = ".";
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
install -m 755 -D caido-cli $out/bin/caido-cli
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = {
|
|
description = "Caido CLI — lightweight web security auditing toolkit";
|
|
homepage = "https://caido.io/";
|
|
changelog = "https://github.com/caido/caido/releases/tag/v${finalAttrs.version}";
|
|
license = lib.licenses.unfree;
|
|
mainProgram = "caido-cli";
|
|
maintainers = with lib.maintainers; [
|
|
blackzeshi
|
|
m0streng0
|
|
octodi
|
|
];
|
|
platforms = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"aarch64-darwin"
|
|
];
|
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
|
};
|
|
})
|