-
Notifications
You must be signed in to change notification settings - Fork 19
Update Zig toolchain #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Update Zig toolchain #105
Conversation
|
Hi, thank you for giving this a try. The removal of usingnamespace is quite unfortunate and we essentially end up with The project also uses nix to provide a stable development environment. See |
|
@urso thanks for your feedback, I will try it out. |
urso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. The move to TranslateC is a great improvement. There are still a few things we can improve on, though. I still wonder if we can reduce the amount of breaking code.
src/pgzx.zig
Outdated
| // Export common set of postgres headers. | ||
| pub const c = @import("pgzx_pgsys"); // keep for backwards compatibility | ||
| pub const pg = c; | ||
| pub const pg = @import("pgzx_pgsys"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if it is possible to use pg = @import("c_translated") here. the pgzx_pgsys module basically was c.zig that is now replaced by headers.h. The goal of pgzx_pgsys was to have a base-module just doing the C header translation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works!
|
The Zig changes look good, but something seems to be wrong with the nix setup :( Will take me some time to figure this out, unless you want to give that a go as well. |
| }; | ||
| zls = { | ||
| url = "github:zigtools/zls"; | ||
| url = "github:zigtools/zls/0.15.0"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. ZLS normally follow the development version. This bit me as well a few times in the past. Normally I'm updating the dependency like so:
nix flake update zls --override-input github:zigtools/zls/0.15.0
With ZLS I kinda agree updating the URL here. It is quite clear what to update when upgrading to new zig version. Let's leave it here as is.
I wonder about the pre-commit-hooks-nix dependency though. Why did we need to pin it? A breaking change? For that dependency I would prefer to pin it in the flake.lock file only via --override-input. If there is a breaking change we eventually have to address that in the future.
Edit: good news, CI now succeeds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the pin, it throws this error:
error: evaluation aborted with the following error message:
'lib.customisation.callPackageWith: Function called without required argument "zizmor"
at /nix/store/r1wrhwj8m29ni4j36dxha1pkzpjdg3jy-source/nix/tools.nix:105'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we try to upgrade nixpkgs? (to try to avoid the pinning, but it might be a good idea even for its own sake)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, good point. We still use 2405. Current is already 2511. Yeah, I think we should try to update this instead.
|
Updating nixpkgs also updates the linters who seem to be more strict 🤦 The linters are correct. In The deadnix linter is also correct. in nixpkgs.nix the You can run the linters locally via: |
|
Probably was already considered on your side. I was thinking if the following would be a good idea. Set up a pipeline that runs let's say weekly. Downloads the latest Zig and tries to build the project and the example extensions and other such checks. Fails if there's any issues with that. |
Yeah, we initially considered that. On the other hand Zig language and standard library is still changing quite a bit between releases. Plus some breaking changes only become apparent when functions are actually used to to Zig 'lazy' nature of compiling code. For this reason we decided to pin to a stable release and even keep to a stable release a little longer in case of critical bugs being discovered. It is still a balance. The ZLS dependency is also a pain to track as this project normally builds against main. A few times we got caught up in incompatibilities because Zig and ZLS overlays/releases were not well in sync. I think this level of automation still make sense for patch releases. |
|
Oh no, looks like postgres headers can't be found after updating nixpkgs: |
|
I think it's due to this change: Source: https://nixos.org/manual/nixpkgs/stable/release-notes?#sec-nixpkgs-release-25.05-incompatibilities |
|
I think it is now confused about where to find files due to the presence of both |
|
Good news: tests compile now. See: |
|
Happy new year. This is a lot of back and forth creating a commit for every change. While I appreciate the effort I can imagine this being quite frustrating on your side. If you check the In case you don't have nix installed on your dev machine you can do everything via docker as well. User I hope this helps a little. |
|
Happy new year! With Docker I managed to create a local setup and with the latest commit the |
That's great. But we still have some tests commented out. Can you reenable and see if they run through? |
|
Good catch, if I uncomment the |
|
Still passes here.. one option would be to revert to commit |
|
@urso shall I revert this PR to commit |
|
Hi, Thank you for all the effort you've put into it. I understand it was quite time consuming and maybe a little frustrating at times. The more I appreciate the dedication and time you spend on this PR. I'm sure we're this close to get it merged. |
PR to close #104