Skip to content

Nix: FIleNotFound error when compiling ZLS with Zig patched with BSP patches #3271

Closed as not planned

Description

@Nanotwerp

Zig Version

0.18.0-dev.1+a6c6412a8

ZLS Version

0.17.0-dev+c248ca1

Client / Code Editor / Extensions

No response

Steps to Reproduce and Observed Behavior

  1. Use a flake.nix that creates a development shell environment which installs ZLS (build-runner-process branch) and the latest revision of Zig (patched with BSP patches):
{
  description = "Zig development environment";

  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable-small";

    zig-flake = {
      url = "github:silversquirl/zig-flake";
      inputs = {
        nixpkgs.follows = "nixpkgs";
      };
    };

    zig2nix = {
      url = "github:Cloudef/zig2nix";
      inputs = {
        nixpkgs.follows = "nixpkgs";
      };
    };

    zls = {
      url = "github:zigtools/zls/techatrix/build-runner-process";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        zig-flake.follows = "zig-flake";
      };
    };
  };

  outputs =
    {
      self,
      nixpkgs,
      zig-flake,
      zig2nix,
      zls-flake,
    }:
    let
      forAllSystems =
        f:
        nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system: f nixpkgs.legacyPackages.${system});
    in
    {
      devShell = forAllSystems (
        { pkgs, ... }:
        let
          zig =
            (zig2nix.outputs.packages.${pkgs.stdenv.hostPlatform.system}.zig-src-master).overrideAttrs
              (oldAttrs: {
                patches = oldAttrs.patches or [ ] ++ [
                  ./patches/bsp.patch
                ];
              });
          zls = (
            zls-flake.packages.${pkgs.stdenv.hostPlatform.system}.zls.overrideAttrs (oldAttrs: {
              nativeBuildInputs = [ zig ];
              doCheck = false;
            })
          );
        in
        pkgs.mkShell {
          packages = [
            zig
            zls
            pkgs.lldb_22 # NOTE: Always match lldb with LLVM version of Zig.
          ];
        }
      );
    };
}
  1. Observe that the following error occurs during the buildPhase of ZLS:
zls> error: failed to open "/build/source/nix/store/ak8nghi0r2ai7dkqsz79bh763bmnm11b-zig-packages/diffz-0.0.1-G2tlISvOAQDORzPTSxDgiKwlHuADKeJMdJrw4kRfLufj": FileNotFound
zls> error: configure command exited with code 1: .zig-cache/o/68eb8637f161993d966e6fc90ee2176b/configurer --zig /nix/store/lh9qi18mxdq4pgbj53dyvipcghw0ma0h-zig-0.18.0-dev.1+a6c6412a8/bin/zig --build-root /build/source --system -Dtarget=x86_64-linux -Doptimize=ReleaseSafe -Dversion-string=0.17.0-dev+c248ca1 --color=off

Expected Behavior

ZLS compiles successfully with Nix and correctly sets the build root to the Nix store path.

Attach ZLS log output

zls.log
info  ( main ): Starting ZLS      VERSION @ '/path/to/zls'
...

Activity

  1. techatrix commented on Oct 13, 2026

    @techatrix
    Member

    The build-runner-process branch in ZLS is no longer meant to be used with the forked bsp branch for Zig. It is currently targeting stock Zig 0.17.0. The used patches are still experimental so it's also too early for bug reports. Once #3270 is merged, you and others are welcome to test and report back any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions