postgres-language-server icon indicating copy to clipboard operation
postgres-language-server copied to clipboard

publish on nixpks

Open psteinroe opened this issue 9 months ago • 8 comments

we should publish postgrestools on nixpks.

since our experience with nix is limited, we would love to accept a community contribution here. :)

psteinroe avatar Apr 06 '25 14:04 psteinroe

Looks like there's an existing PR for this, though under the name of postgres-lsp https://github.com/NixOS/nixpkgs/pull/395576

joshainglis avatar Apr 08 '25 04:04 joshainglis

Tried to package the latest 0.11.0 version, found that the custom build script for pgt_query makes it a bit non-trivial for nix packaging.

igor-ramazanov avatar Aug 20 '25 17:08 igor-ramazanov

Tried to package the latest 0.11.0 version, found that the custom build script for pgt_query makes it a bit non-trivial for nix packaging.

thanks for checking! would it make things easier if the build script wouldn't download anything, and libpg_query was a submodule instead?

psteinroe avatar Aug 20 '25 20:08 psteinroe

I can't answer the direct question, but probably?

libpg_query is in nixpkgs so it should be possible to use this, in the derivation. I was involved with a similar packaging situation a few years ago in https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/vk/vkdt/package.nix and they used to vendor the dependencies in the repo as submodules but use upstream for the nix build (they got rid of submodules).

dbaynard avatar Aug 20 '25 23:08 dbaynard

thanks for checking! would it make things easier if the build script wouldn't download anything, and libpg_query was a submodule instead?

libpg_query is in nixpkgs so it should be possible to use this, in the derivation. I was involved with a similar packaging situation a few years ago in NixOS/nixpkgs@nixos-unstable/pkgs/by-name/vk/vkdt/package.nix and they used to vendor the dependencies in the repo as submodules but use upstream for the nix build (they got rid of submodules).

Yeah, that's a good idea: to provide libpg_query as an argument to the postgres-lsp derivation. Maybe it's already possible without modification to this repo - for example, I can see that it skips cloning if <libpg_query>/.stamp file is present. Will need to dig deeper to see if it can skip building as well, since *.so files already provided by libpg_query:

ls /nix/store/m4nvncpy7n4qfbdzglj1bcnskpzv3yxh-libpg_query-17-6.1.0/lib/
#                                        name                                         type  size       modified      
0 /nix/store/m4nvncpy7n4qfbdzglj1bcnskpzv3yxh-libpg_query-17-6.1.0/lib/libpg_query.a  file 5.0 MB 1970-01-01 00:00:01
1 /nix/store/m4nvncpy7n4qfbdzglj1bcnskpzv3yxh-libpg_query-17-6.1.0/lib/libpg_query.so file 3.4 MB 1970-01-01 00:00:01

igor-ramazanov avatar Aug 21 '25 13:08 igor-ramazanov

hey everyone, I am removing the clone here: https://github.com/supabase-community/postgres-language-server/pull/486

we use a submodule instead - same as we already do with tree-sitter-sql. This should make this easier I hope? Let me know if I can provide further support here.

btw - we will rename the project to postgres-language-server soon. postgrestools will be dropped entirely since it was a mistake and caused a lot of confusion in the community. in case this is published - please use postgres-language-server :)

psteinroe avatar Aug 31 '25 18:08 psteinroe

The new branch seems to build fine.

myypo avatar Sep 02 '25 20:09 myypo

we made a few improvements to our build recently. this should now be possible without submodules at all if libpg_query can be provided as a dependency.

https://github.com/Homebrew/homebrew-core/blob/main/Formula/p/postgres-language-server.rb

psteinroe avatar Nov 03 '25 09:11 psteinroe