Skip to content
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

NixOS - Failed to load WASM extension nix: unexpected end-of-file #24

Open
Alfablos opened this issue Feb 18, 2025 · 0 comments
Open

NixOS - Failed to load WASM extension nix: unexpected end-of-file #24

Alfablos opened this issue Feb 18, 2025 · 0 comments

Comments

@Alfablos
Copy link

Hello,
first of all thanks for bringing Nix support in Zed.

I was initially trying to use nil as a language server but the error was [WARN] no language server found matching 'nil'.
Looking closely I realized that the actual problem may be:

[ERROR] failed to load wasm extension nix

Caused by:
0: error parsing wasm extension
1: unexpected end-of-file (at offset 0x366c1)

The no language server found error happens before and after these lines.

I'm on NixOS (nixpkgs-unstable) and this is the piece of configuration that handles Zed (via Home Manager):

{
  lib,
  config,
  pkgs,
  ...
}:
let
  cfg = config.components.dev.IDEs.zed;
in
{

  options.components.dev.IDEs.zed.enable = lib.mkEnableOption "Zed editor";

  config = lib.mkIf cfg.enable {
    home.packages = [ pkgs.nil ];
    programs.zed-editor = {
      enable = true;
      extensions = [
        # Languages
        "nix"
        "gosum"
        "cue"
        "rhai"
        "zig"
        "sql"
        # Templating
        "jsonnet"
        "jinja2"
        # Shells
        "basher"
        "nu"
        # Tools
        "proto"
        "log"
        "env"
        "live-server"
        # Build
        "make"
        "just"
        # DevOps
        "dockerfile"
        "docker-compose"
        "helm"
        "terraform"
        "kdl"
        # Formats
        "toml"
        "cargo-tom"
        "csv"
        "ini"
        "scheme"
        "asciidoc"
        "http"
        # Themes
        "catppuccin"
        "tokyo-night"
        "one-dark-pro"
        "catppuccin-blur"
      ];
      userSettings = {
        features = {
          inline_completion_provider = "none";
        };
        assistant.enabled = false;
        lsp = {
          nil = {
            initialization_options = {
              formatting.command = [ "nixfmt" ];
            };
          };
          nix = { 
            binary = { 
              path_lookup = true; 
            };
          };
          rust-analyzer = {
            binary.path_lookup = true;
          };
          zls.binary.path_lookup = true;
        };
        languages = {
          Nix = {
            tab_size = 2;
            language_servers = [
              "nil"
              "!nixd"
            ];
            # formatter.external.command = "nixfmt";
          };
        };
        autosave.after_delay.milliseconds = 1000;
        tab_size = 2;
        vim_mode = true;
        soft_wrap = "editor_width";
        terminal = {
          copy_on_select = true;
          env = {};
        };
        theme = {
          mode = "dark";
          light = "One Light";
          dark = "Tokyo Night Storm";
        };
        show_whitespaces = "all";
      };
    };
  };
}

which generates the following JSON config file:

{
  "assistant": {
    "enabled": false
  },
  "auto_install_extensions": {
    "asciidoc": true,
    "basher": true,
    "cargo-tom": true,
    "catppuccin": true,
    "catppuccin-blur": true,
    "csv": true,
    "cue": true,
    "docker-compose": true,
    "dockerfile": true,
    "env": true,
    "gosum": true,
    "helm": true,
    "http": true,
    "ini": true,
    "jinja2": true,
    "jsonnet": true,
    "just": true,
    "kdl": true,
    "live-server": true,
    "log": true,
    "make": true,
    "nix": true,
    "nu": true,
    "one-dark-pro": true,
    "proto": true,
    "rhai": true,
    "scheme": true,
    "sql": true,
    "terraform": true,
    "tokyo-night": true,
    "toml": true,
    "zig": true
  },
  "autosave": {
    "after_delay": {
      "milliseconds": 1000
    }
  },
  "features": {
    "inline_completion_provider": "none"
  },
  "languages": {
    "Nix": {
      "language_servers": [
        "nil",
        "!nixd"
      ],
      "tab_size": 2
    }
  },
  "lsp": {
    "nil": {
      "initialization_options": {
        "formatting": {
          "command": [
            "nixfmt"
          ]
        }
      }
    },
    "nix": {
      "binary": {
        "path_lookup": true
      }
    },
    "rust-analyzer": {
      "binary": {
        "path_lookup": true
      }
    },
    "zls": {
      "binary": {
        "path_lookup": true
      }
    }
  },
  "show_whitespaces": "all",
  "soft_wrap": "editor_width",
  "tab_size": 2,
  "terminal": {
    "copy_on_select": true,
    "env": {}
  },
  "theme": {
    "dark": "Tokyo Night Storm",
    "light": "One Light",
    "mode": "dark"
  },
  "vim_mode": true
}

After removing the LSP configuration (and some logs pollution) here's my logs for just one initialization:

Zed logs

2025-02-18T13:42:12.208317522+01:00 [INFO] ========== starting zed ==========
2025-02-18T13:42:12.221275777+01:00 [INFO] Compositor detection: _NET_WM_CM_S?=false, _NET_WM_CM_OWNER=false, _NET_SUPPORTING_WM_CHECK=true
2025-02-18T13:42:12.22130465+01:00 [INFO] x11: compositor present: true, gtk_frame_extents_supported: true
2025-02-18T13:42:12.250548707+01:00 [INFO] Presentation support: "VK_KHR_wayland_surface"
2025-02-18T13:42:12.250572079+01:00 [INFO] Presentation support: "VK_KHR_xcb_surface"
2025-02-18T13:42:12.250580093+01:00 [INFO] Presentation support: "VK_KHR_xlib_surface"
2025-02-18T13:42:12.250588862+01:00 [INFO] Enabling Vulkan Portability
2025-02-18T13:42:12.25059608+01:00 [INFO] Enabling color space support
2025-02-18T13:42:12.261205057+01:00 [INFO] Adapter: "NVIDIA GeForce RTX 3080 Laptop GPU"
2025-02-18T13:42:12.261249965+01:00 [INFO] Ray tracing is supported
2025-02-18T13:42:12.363435136+01:00 [INFO] perform;
2025-02-18T13:42:12.363455647+01:00 [INFO] authenticate;
2025-02-18T13:42:12.363478251+01:00 [INFO] read_command;
2025-02-18T13:42:12.363509225+01:00 [INFO] Opening main db
2025-02-18T13:42:12.363545144+01:00 [INFO] send_secondary_commands;
2025-02-18T13:42:12.363883283+01:00 [INFO] new;
2025-02-18T13:42:12.363898226+01:00 [INFO] socket reader;
2025-02-18T13:42:12.364249224+01:00 [INFO] Opening main db
2025-02-18T13:42:12.364476847+01:00 [INFO] keep_updated;
2025-02-18T13:42:12.36526627+01:00 [INFO] Using git binary path: None
2025-02-18T13:42:12.386787079+01:00 [ERROR] theme not found: Tokyo Night Storm
2025-02-18T13:42:12.387696451+01:00 [INFO] No prompt template overrides directory found at /home/antonio/.local/share/zed/prompt_overrides. Using built-in prompts.
2025-02-18T13:42:12.388524834+01:00 [INFO] extensions updated. loading 34, reloading 0, unloading 0
2025-02-18T13:42:12.39022743+01:00 [INFO] activate is not implemented on Linux, ignoring the call
2025-02-18T13:42:12.392055134+01:00 [WARN] Failed to watch: No such file or directory (os error 2) about ["/home/antonio/.config/github-copilot"]
2025-02-18T13:42:12.392178707+01:00 [INFO] perform;
2025-02-18T13:42:12.392202104+01:00 [INFO] authenticate;
2025-02-18T13:42:12.392247598+01:00 [ERROR] Failed to write settings to file "/nix/store/0yi8az1c52q92mnlgc7lc455pbd8sjdq-zed-user-settings"

Caused by:
Read-only file system (os error 30) at path "/nix/store/.tmpEZIhHk"
2025-02-18T13:42:12.392278616+01:00 [INFO] read_command;
2025-02-18T13:42:12.392403719+01:00 [INFO] Opening main db
2025-02-18T13:42:12.392716647+01:00 [INFO] socket reader;
2025-02-18T13:42:12.394828183+01:00 [ERROR] Failed to write settings to file "/nix/store/0yi8az1c52q92mnlgc7lc455pbd8sjdq-zed-user-settings"

Caused by:
Read-only file system (os error 30) at path "/nix/store/.tmpkcSLHz"
2025-02-18T13:42:12.395094955+01:00 [INFO] Using Visual { id: 35, colormap: 0, depth: 32 }
2025-02-18T13:42:12.395123067+01:00 [INFO] Creating colormap 52428803
2025-02-18T13:42:12.395551802+01:00 [INFO] building git repository, .git path in the worktree: ".git"
2025-02-18T13:42:12.396892691+01:00 [INFO] new;
2025-02-18T13:42:12.397354982+01:00 [INFO] keep_updated;
2025-02-18T13:42:12.399202039+01:00 [INFO] Using surface present mode FIFO_RELAXED
2025-02-18T13:42:12.405976404+01:00 [INFO] Creating a descriptor pool for at most 16 sets
2025-02-18T13:42:12.405992176+01:00 [INFO] Creating a descriptor pool for at most 16 sets
2025-02-18T13:42:12.406002086+01:00 [INFO] Initializing Blade pipelines for surface SurfaceInfo { format: Bgra8UnormSrgb, alpha: Ignored }
2025-02-18T13:42:12.481346747+01:00 [WARN] Theme "One Dark Pro" is using a deprecated style property: scrollbar_thumb.background. Use scrollbar.thumb.background instead.
2025-02-18T13:42:12.506592919+01:00 [INFO] Refreshing at 8332 micros
2025-02-18T13:42:12.507493607+01:00 [INFO] Using GPU: GpuSpecs { is_software_emulated: false, device_name: "NVIDIA GeForce RTX 3080 Laptop GPU", driver_name: "NVIDIA", driver_info: "550.142" }
2025-02-18T13:42:12.509267947+01:00 [INFO] set environment variables from shell:/run/current-system/sw/bin/zsh, path:/home/antonio/.cargo/bin:/home/antonio/.local/bin:/run/wrappers/bin:/home/antonio/.nix-profile/bin:/nix/profile/bin:/home/antonio/.local/state/nix/profile/bin:/etc/profiles/per-user/antonio/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/antonio/.local/share/JetBrains/Toolbox/scripts:/home/antonio/.zsh/plugins/fzf-tab:/home/antonio/.zsh/plugins/fzf-history-search
2025-02-18T13:42:12.519961289+01:00 [WARN] GPU frame is out of date
2025-02-18T13:42:12.520179393+01:00 [INFO] Using surface present mode FIFO_RELAXED
2025-02-18T13:42:12.520192744+01:00 [INFO] Retaining current format: Bgra8UnormSrgb
2025-02-18T13:42:12.522660359+01:00 [INFO] set status on client 0: Authenticating
2025-02-18T13:42:12.523007039+01:00 [INFO] perform;
2025-02-18T13:42:12.52302042+01:00 [INFO] authenticate;
2025-02-18T13:42:12.523038638+01:00 [INFO] read_command;
2025-02-18T13:42:12.523172507+01:00 [INFO] Opening main db
2025-02-18T13:42:12.523420506+01:00 [INFO] socket reader;
2025-02-18T13:42:12.527013766+01:00 [INFO] new;
2025-02-18T13:42:12.527575722+01:00 [INFO] keep_updated;
2025-02-18T13:42:12.527820711+01:00 [INFO] Opening main db
2025-02-18T13:42:12.530143268+01:00 [INFO] set status on client 283935: Connecting
2025-02-18T13:42:12.812122955+01:00 [INFO] connected to rpc endpoint https://collab.zed.dev/rpc
2025-02-18T13:42:13.252949846+01:00 [INFO] add_connection;
2025-02-18T13:42:13.269653171+01:00 [INFO] set status on client 283935: Connected { peer_id: PeerId { owner_id: 679, id: 6126055 }, connection_id: ConnectionId { owner_id: 0, id: 0 } }
2025-02-18T13:42:13.45528488+01:00 [INFO] using project environment variables from CLI. PATH="/nix/store/f04zhapn8n8w6yrd35s8sd9qmjp8g9ry-patchelf-0.15.0/bin:/nix/store/4ijy8jbsiqmj37avrk83gn2m903486mr-gcc-wrapper-14-20241116/bin:/nix/store/zs2gq6fkglrd28g1nxlb8waqq37cdc2z-gcc-14-20241116/bin:/nix/store/9lcg6rsqbmx6s35jzy86b86pkj0qhxjl-glibc-2.40-66-bin/bin:/nix/store/wdap4cr3bnm685f27y9bb6q5b6q18msl-coreutils-9.5/bin:/nix/store/vrkxj51s4a1awh7m4p4f1w29wad5s20m-binutils-wrapper-2.43.1/bin:/nix/store/5h5ghy2qf6l91l52j6m5vx473zi38vc3-binutils-2.43.1/bin:/nix/store/fhzw8ah6s37q2p9pak7d2alzhx0m137h-neovim-0.10.4/bin:/nix/store/3b0kiw6h7qzqgnx3kdl57m3qkzvh37j0-nil-2024-08-06/bin:/nix/store/wdap4cr3bnm685f27y9bb6q5b6q18msl-coreutils-9.5/bin:/nix/store/032xw8dchwjipwqh6b3h70yc3mcmsqld-findutils-4.10.0/bin:/nix/store/dd7xqz1qwl0di4zb8rzj7r1ds8np9xqs-diffutils-3.10/bin:/nix/store/bffnm1211li6y431irplzbjbccr0k884-gnused-4.9/bin:/nix/store/4lbfasv335vpk8rbcf3pgkag4rhg8jx8-gnugrep-3.11/bin:/nix/store/xpzl2sf58fqfpl64b1fy1ihxay7k71li-gawk-5.3.1/bin:/nix/store/zlmk040fc3jax9s3gldwp5rfwc1hhajc-gnutar-1.35/bin:/nix/store/chwdy9qaxd13q8zvl0zd5r7ql2q116di-gzip-1.13/bin:/nix/store/hpppxlcfvjzrvvcvhcm47divp65gbwq1-bzip2-1.0.8-bin/bin:/nix/store/y0akgyz13jgxwm968bs8kay47zbxx638-gnumake-4.4.1/bin:/nix/store/fd118hwh7d1ncib4mdw56ylv3g9k0iyj-bash-5.2p37/bin:/nix/store/apqwjgbjj646wk2jkzr67l26djamn481-patch-2.7.6/bin:/nix/store/rrv4bd5i7rp2m7j8ix4kl8bzijhh8gd3-xz-5.6.3-bin/bin:/nix/store/qraqns84wjffzd8d3dgbdcyxg41czbd6-file-5.46/bin:/etc/nixos/.direnv/bin:/home/antonio/.cargo/bin:/home/antonio/.local/bin:/run/wrappers/bin:/home/antonio/.nix-profile/bin:/nix/profile/bin:/home/antonio/.local/state/nix/profile/bin:/etc/profiles/per-user/antonio/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/antonio/.local/share/JetBrains/Toolbox/scripts:/home/antonio/.zsh/plugins/fzf-tab:/home/antonio/.zsh/plugins/fzf-history-search"
2025-02-18T13:42:13.472814051+01:00 [INFO] perform;
2025-02-18T13:42:13.472845778+01:00 [INFO] authenticate;
2025-02-18T13:42:13.472876618+01:00 [INFO] read_command;
2025-02-18T13:42:13.473309331+01:00 [INFO] socket reader;
2025-02-18T13:42:13.792795304+01:00 [ERROR] failed to load wasm extension nix

Caused by:
0: error parsing wasm extension
1: unexpected end-of-file (at offset 0x366c1)
2025-02-18T13:42:14.421346268+01:00 [INFO] perform;
2025-02-18T13:42:14.421401219+01:00 [INFO] authenticate;
2025-02-18T13:42:14.421427201+01:00 [INFO] read_command;
2025-02-18T13:42:14.422104497+01:00 [INFO] socket reader;
2025-02-18T13:42:27.183889064+01:00 [ERROR] window not found
2025-02-18T13:42:27.183940227+01:00 [ERROR] window not found

What seems most significant is:

[ERROR] failed to load wasm extension nix

Caused by:
    0: error parsing wasm extension
    1: unexpected end-of-file (at offset 0x366c1)

which maybe causes the LSP issues?

Right now I get syntax highlighting but nothing more. Am I misconfiguring anything or could this be a bug?

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant