publish on nixpks
we should publish postgrestools on nixpks.
since our experience with nix is limited, we would love to accept a community contribution here. :)
Looks like there's an existing PR for this, though under the name of postgres-lsp
https://github.com/NixOS/nixpkgs/pull/395576
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.
Tried to package the latest 0.11.0 version, found that the custom build script for
pgt_querymakes it a bit non-trivial fornixpackaging.
thanks for checking! would it make things easier if the build script wouldn't download anything, and libpg_query was a submodule instead?
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).
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
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 :)
The new branch seems to build fine.
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