From 6b296fbcf2fed22c85aaf555e81a21c3399f75f4 Mon Sep 17 00:00:00 2001 From: figsoda Date: Fri, 19 May 2023 11:09:09 -0400 Subject: [PATCH 1/2] ast-grep: fix build on aarch64-linux --- pkgs/development/tools/misc/ast-grep/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/development/tools/misc/ast-grep/default.nix b/pkgs/development/tools/misc/ast-grep/default.nix index 2cad8d017d7a..caed883531d1 100644 --- a/pkgs/development/tools/misc/ast-grep/default.nix +++ b/pkgs/development/tools/misc/ast-grep/default.nix @@ -15,6 +15,11 @@ rustPlatform.buildRustPackage rec { cargoHash = "sha256-ed6hc7MIo/Hu1JY7yy6dYHbaTZ9S+T0dh/2H3sTT52Y="; + # error: linker `aarch64-linux-gnu-gcc` not found + postPatch = '' + rm .cargo/config.toml + ''; + meta = with lib; { mainProgram = "sg"; description = "A fast and polyglot tool for code searching, linting, rewriting at large scale"; From 99079728ab0a3f398d05177c188faad21cfc4237 Mon Sep 17 00:00:00 2001 From: figsoda Date: Fri, 19 May 2023 11:11:51 -0400 Subject: [PATCH 2/2] ast-grep: fix build on x86_64-darwin --- pkgs/development/tools/misc/ast-grep/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/tools/misc/ast-grep/default.nix b/pkgs/development/tools/misc/ast-grep/default.nix index caed883531d1..fc23e9e3d2ea 100644 --- a/pkgs/development/tools/misc/ast-grep/default.nix +++ b/pkgs/development/tools/misc/ast-grep/default.nix @@ -1,7 +1,9 @@ { lib , rustPlatform , fetchFromGitHub +, stdenv }: + rustPlatform.buildRustPackage rec { pname = "ast-grep"; version = "0.5.2"; @@ -20,6 +22,12 @@ rustPlatform.buildRustPackage rec { rm .cargo/config.toml ''; + checkFlags = lib.optionals (stdenv.isx86_64 && stdenv.isDarwin) [ + # fails on emulated x86_64-darwin + # mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64') + "--skip=test::test_load_parser" + ]; + meta = with lib; { mainProgram = "sg"; description = "A fast and polyglot tool for code searching, linting, rewriting at large scale";