Skip to content

tree-sitter: 0.17.1 -> 0.17.3; run make install#102763

Merged
NickHu merged 4 commits intoNixOS:masterfrom
colemickens:tree-sitter
Nov 12, 2020
Merged

tree-sitter: 0.17.1 -> 0.17.3; run make install#102763
NickHu merged 4 commits intoNixOS:masterfrom
colemickens:tree-sitter

Conversation

@colemickens
Copy link
Copy Markdown
Member

Motivation for this change

Update tree-sitter to latest.

Also, this is necessary to actually install the lib/include/pkgconfig files. (neovim nightly now needs this and I know there are a number of us)

cc: @teto @mjlbach

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot requested a review from Profpatsch November 4, 2020 14:31
@ofborg ofborg bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Nov 4, 2020

postInstall = ''
export PREFIX=$out
make install
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that looks wrong. make install should be called by default. If you need to export PREFIX, it can be done via configureFlags.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind it uses buildRustPackage.

Copy link
Copy Markdown
Member

@teto teto Nov 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to install both static and shared libary. we should pick one. I think you (or another) could propose a patch for their Makefile to be more granular (and for now remove the extra files via rm). Since homebrew is packaging it too, would be interesting to see how they've done it.

Copy link
Copy Markdown
Contributor

@NickHu NickHu Nov 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the arch community repo they package the shared library https://www.archlinux.org/packages/community/x86_64/tree-sitter/files/ (I'm actually a little confounded as to why the static libraries do not appear in this file listing because the PKGBUILD seems to just run make install also https://github.com/archlinux/svntogit-community/blob/b7a0f60fa46355ee73ac42ddf4fb419832bfeafe/trunk/PKGBUILD#L30 Arch makepkg strips static libraries by default)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went to the liberty of addressing this in a follow-up commit; thanks for your contribution @colemickens!

@teto can you re-review and then I can merge?

@NickHu
Copy link
Copy Markdown
Contributor

NickHu commented Nov 4, 2020

Overlay for the impatient: ~/.config/nixpkgs/overlays/tree-sitter.nix

self: super:
{
  tree-sitter = super.tree-sitter.overrideAttrs (oldAttrs: {
    postInstall = "PREFIX=$out make install";
  });
}

@SuperSandro2000
Copy link
Copy Markdown
Member

Result of nixpkgs-review pr 102763 run on x86_64-darwin 1

1 package marked as broken and skipped:
  • tree-sitter

@ipetkov
Copy link
Copy Markdown
Contributor

ipetkov commented Nov 8, 2020

I noticed that the metadata sets broken = stdenv.isDarwin || stdenv.isAarch64;. I was able to build this successfully on macOS by adding buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];, so it may be worth doing that in this PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this should be darwin.apple_sdk.frameworks.Security or darwin.Security; I have no way to test.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do other packages do?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe: what prompted you to add it if you don’t have a MacOS machine?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can testify that the build process indeed fails without it on MacOS. This dependency seem to be typical for Rust packages, like bat or git-and-tools.delta.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NickHu sorry I didn't clarify earlier, this is how I've normally seen this accomplished:

  • add a parameter called Security at the top of tree-sitter/default.nix
  • set buildInputs = lib.optionals stdenv.isDarwin [ Security ]; in tree-sitter/default.nix
  • update top-level/all-packages.nix with:
tree-sitter = callPackage ../development/tools/parsing/tree-sitter {
   inherit (darwin.apple_sdk.frameworks) Security;
};

You can ping me when the change is made and I can test that it builds on macOS :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ipetkov ping

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NickHu 4d8adcc builds on macOS 👍

Comment on lines 6 to 7
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enableShared what? Not really clear what that means.

Do we need both options? Why is it configurable?

Copy link
Copy Markdown
Contributor

@NickHu NickHu Nov 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're building static, maybe you want to not have the shared libraries - configurable by this flag

I didn't make up this convention, if you grep for enableShared in nixpkgs you'll find plenty of occurrences

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had forgotten to set enableShared = false in static.nix; fixed now

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do other packages do?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe: what prompted you to add it if you don’t have a MacOS machine?

@NickHu
Copy link
Copy Markdown
Contributor

NickHu commented Nov 12, 2020

Seems like this has gone quiet. I think I addressed everyone's concerns, so I'll just go ahead and merge this. If any follow-ups are required they can come in a separate PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants