-
-
Notifications
You must be signed in to change notification settings - Fork 268
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
Nix: Use callPackage pattern #1630
Conversation
I don't think this is going to work the way you are thinking. ZLS requires the master version of the compiler to be able to compile. They are constantly bumping the compiler version, making it incompatible with anything from last week, let alone old versions. If you checkout an older commit (and assuming the one you checked out actually compiles) it will have a |
This intentionally doesn't change anything about which version of Zig we're using; it just makes it possible to override the dependency. There might be multiple reasons for users to have a custom version of Zig, and it's very convenient to use There is a separate problem with the current way it's depending on Zig: Right now if you use I was able to workaround it by setting
Number 2 seems cleanest to me, but that can be done separately from this PR. |
My use case is that I'm using # Rough code:
overlays = [
(final: prev: { zls = zls.packages.${prev.system}.zls; })
];
home-manager = {
programs.vscode = {
userSettings = {
"zig.zls.path" = `${pkgs.zls}/bin/zls`;
};
};
}; This means that ZLS is never globally installed, but that VSCode refers directly to the binary in the store. |
That's weird, because I am actually using ZLS as an input for my home-manager config like this: zls.url = github:acristoffers/zls;
zls.inputs.nixpkgs.follows = "nixpkgs";
zls.inputs.flake-utils.follows = "flake-utils";
zls.inputs.zig-overlay.follows = "zig"; and when I have compilation errors due to Note however that I'm using my fork of ZLS. That's because the main branch of this repo is quite often broken, so it is not really reliable and it is meant for development only. The problem you may be encountering is that you are trying to compile the master branch of this repo in a point in time when it is not buildable. Right now is a good example: this branch will fail to build, but mine will work fine (we are in a state of broken nix dependencies, I have a pull-request up already for that). I'm not saying that your proposal is bad, only that it will probably not fix your problem. But I'm not a maintainer, so the decision is not mine anyway. I just wanted to point out that this repo is rather attached to the latest version of the zig compiler (and breaks often). |
Which proposal are you talking about, and what problem are you talking about? I mainly want to get this PR merged first. Hopefully this change is not very controversial as it doesn't change anything other than making it possible for other users to override attributes on the Then we can discuss other ways of improving how ZLS specifies its dependency on Zig later. |
Your proposal = this PR |
Well, this PR solves the problem that it's not possible to override the dependencies of the ZLS package, including |
a7ab843
to
aaac84f
Compare
aaac84f
to
dcdd1ce
Compare
This makes it possible for users of the flake to override the Zig version which this is built with.
dcdd1ce
to
e8b3be9
Compare
I don't see any reason why you would want to override the dependencies of the ZLS flake. It possible to accidentally not update the Zig flake when dealing with a breaking change. AFAIK this was the case when this PR has been opened. Since then, this has only occurred once in January and has been quickly resolved by #1699. This problem should not prompt the user of the flake to fix the issue by overriding the dependency but instead it should be fixed in ZLS directly. If there is a different use case that I don't know about for overriding the dependencies then please open a new Issue about this. |
I also used this branch to be able to set callPackage is very idiomatic Nix so I don’t really understand why to not use it though. |
This makes it possible for users of the flake to override the Zig version which this is built with.