rust + nix home-manager + vscode

In a previous post I shared how I set up the nix home-manager on linux. Now I had the problem that I wanted to make the rust-analyzer work properly in VSCode. Yes, for some reason, just adding the packages to home.nix packages like { lib, pkgs, ... }: { ... nix = { package = pkgs.nix; settings.experimental-features = [ "nix-command" "flakes" ]; }; home = { packages = with pkgs; [ cargo rustc rustfmt ]; }; } as one may think reading the NixOS rust wiki page does not actually work. I mean, not that they have a home-manager flakes example, but that was my best guess based on what I’ve read there. So using this guess, you can successfully run home-manager switch ... and develop rust code, but then VSCode’s rust extension with rust-analyzer gives you a lovely ...

January 30, 2025 · 2 min · ericschmidt