diff --git a/pkgs/by-name/as/ast-grep/package.nix b/pkgs/by-name/as/ast-grep/package.nix new file mode 100644 index 000000000000..d275939e87cc --- /dev/null +++ b/pkgs/by-name/as/ast-grep/package.nix @@ -0,0 +1,47 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, stdenv +}: + +rustPlatform.buildRustPackage rec { + pname = "ast-grep"; + version = "0.12.2"; + + src = fetchFromGitHub { + owner = "ast-grep"; + repo = "ast-grep"; + rev = version; + hash = "sha256-N9hfHgzqwV/G3/xNY2Vx1i2dW6BcABJ/4lkhnLuvIns="; + }; + + cargoHash = "sha256-3ntsPC6OWtSN3MH+3wN2BgOqH69jiW93/xfLY+niARI="; + + # error: linker `aarch64-linux-gnu-gcc` not found + postPatch = '' + rm .cargo/config.toml + ''; + + checkFlags = [ + # disable flaky test + "--skip=test::test_load_parser_mac" + + # BUG: Broke by 0.12.1 update (https://github.com/NixOS/nixpkgs/pull/257385) + # Please check if this is fixed in future updates of the package + "--skip=verify::test_case::tests::test_unmatching_id" + ] ++ lib.optionals (with stdenv.hostPlatform; (isDarwin && isx86_64) || (isLinux && isAarch64)) [ + # x86_64-darwin: source/benches/fixtures/json-mac.so\' (no such file), \'/private/tmp/nix-build-.../source/benches/fixtures/json-mac.so\' (mach-o file, but is an incompatible architecture (have \'arm64\', need \'x86_64h\' or \'x86_64\'))" }) + # aarch64-linux: /build/source/benches/fixtures/json-linux.so: cannot open shared object file: No such file or directory" + "--skip=test::test_load_parser" + "--skip=test::test_register_lang" + ]; + + meta = with lib; { + mainProgram = "sg"; + description = "A fast and polyglot tool for code searching, linting, rewriting at large scale"; + homepage = "https://ast-grep.github.io/"; + changelog = "https://github.com/ast-grep/ast-grep/blob/${src.rev}/CHANGELOG.md"; + license = licenses.mit; + maintainers = with maintainers; [ montchr lord-valen cafkafk ]; + }; +} diff --git a/pkgs/development/tools/misc/ast-grep/default.nix b/pkgs/development/tools/misc/ast-grep/default.nix deleted file mode 100644 index 0b0b7e47ba93..000000000000 --- a/pkgs/development/tools/misc/ast-grep/default.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ lib -, rustPlatform -, fetchFromGitHub -, stdenv -}: - -rustPlatform.buildRustPackage rec { - pname = "ast-grep"; - version = "0.11.1"; - - src = fetchFromGitHub { - owner = "ast-grep"; - repo = "ast-grep"; - rev = version; - hash = "sha256-1ThEJ8VEcXNScY4zmmXz7BVYs6irE1h9HDxkVvmVq1k="; - }; - - cargoHash = "sha256-3myUFgKktvD9S0Bp7ixsZb59p3iDwmiEKUFD7wB+7IM="; - - # error: linker `aarch64-linux-gnu-gcc` not found - postPatch = '' - rm .cargo/config.toml - ''; - - checkFlags = [ - # disable flaky test - "--skip=test::test_load_parser_mac" - ]; - - meta = with lib; { - mainProgram = "sg"; - description = "A fast and polyglot tool for code searching, linting, rewriting at large scale"; - homepage = "https://ast-grep.github.io/"; - changelog = "https://github.com/ast-grep/ast-grep/blob/${src.rev}/CHANGELOG.md"; - license = licenses.mit; - maintainers = with maintainers; [ montchr lord-valen cafkafk ]; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 53f76ae383ea..30e461377c1d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -281,8 +281,6 @@ with pkgs; asnmap = callPackage ../tools/security/asnmap { }; - ast-grep = callPackage ../development/tools/misc/ast-grep { }; - astrolog = callPackage ../applications/science/astronomy/astrolog { }; astronomer = callPackage ../tools/misc/astronomer { };