zls icon indicating copy to clipboard operation
zls copied to clipboard

Zls from nixpkgs panics on NixOs, works fine on Ubuntu [also: cannot build from source]

Open allgreed opened this issue 3 years ago • 4 comments

I have an environment that uses zls. Since the nipkgs are pinned it should be reproducible. The environment: https://github.com/allgreed/aoc-2021/blob/master/default.nix

I'm using it across 2 machines. On the one with Ubuntu it works fine (zls produces sensible JsonRPC response, server works with nvim), on NixOs it panics with the following message:

[λ] ~/Desktop/aoc-2021 (master) >_ zls
thread 1042826 panic: exact division produced remainder
Aborted (core dumped)

The exact binary is: /nix/store/5b8347aln8rnmjfmw01qb8cxm6iadkxw-zls-unstable-2021-06-06/bin/zls

As you can see the version featured in nixpkgs is quite dated, I've tried rebuilding it from source to verify that the issue is still present in the latest version, however a build attempt on NixOs failed:

/tmp/zls (master) >_ nix build
builder for '/nix/store/cj3kajzqkc8pvjvj2pyzmlncax0jjnk0-zig-linux-x86_64-0.8.0-dev.2748+5d94e754f.tar.xz.drv' failed with exit code 1; last 7 log lines:
  
  trying https://ziglang.org/builds/zig-linux-x86_64-0.8.0-dev.2748+5d94e754f.tar.xz
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
    0   303    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  curl: (22) The requested URL returned error: 403
  error: cannot download zig-linux-x86_64-0.8.0-dev.2748+5d94e754f.tar.xz from any mirror
cannot build derivation '/nix/store/45xnbbd7cnjwafszzisn889s89jllzwd-zig-0.8.0-dev.2748+5d94e754f.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/9nbmg3dy22baj4vdpz125c7vrrbzz20r-zls.drv': 1 dependencies couldn't be built
[0 built (1 failed)]
error: build of '/nix/store/9nbmg3dy22baj4vdpz125c7vrrbzz20r-zls.drv' failed

allgreed avatar Dec 11 '21 01:12 allgreed

its using zig 0.8.0 which is not supported. you need to use zig master

nektro avatar Dec 16 '21 23:12 nektro

The Nix derivation in this PR is a little outdated as it depends on an older unstable version of Zig (v0.8.0), while master is required. Because Zig is still actively changing, and the Nix derivation gets outdated pretty quickly, I think it might be a good idea to either add a CI test to build the derivation (so the derivation is always working), or perhaps just remove default.nix and let Nix users package it themselves (or use another repository) instead of having a broken derivation most of the time.

bnjmnt4n avatar Dec 20 '21 11:12 bnjmnt4n

Addressing the most pressing concern:

  • the 0.9.0 release binaries are working on NixOs as is
  • there is a PR to bump the zls on nixpkgs https://github.com/NixOS/nixpkgs/pull/151880

allgreed avatar Jan 01 '22 14:01 allgreed

@allgreed The linked pr is closed, is this still an issue?

leecannon avatar Aug 23 '22 20:08 leecannon

I think this has gone stale, please bump this if it's still an issue :)

SuperAuguste avatar Oct 26 '22 03:10 SuperAuguste