Cannot write a flake overlay for rust-analyzer

I have read how to add an overlay for rustBuildPackage, however I am struggling to change github source of rust-analyzer.

          overlays = [ (import rust-overlay) (final: prev: {
              rust-analyzer-unwrapped = prev.rust-analyzer-unwrapped.overrideAttrs (old: rec {
                src = prev.fetchFromGitHub {
                      owner = "tomasol";
                      repo = "rust-analyzer";
                      rev = "ab849d87a1ef4a48a5ad121f1059a0b7a15af485";
                      sha256 = "sha256-KhukRUCbveChS1SNRs3N+DGOchTv+Ch+eVlxbJIc/rw=";
                };
                cargoDeps = old.cargoDeps.overrideAttrs (pkgs.lib.const {
                  name = "rust-analyzer-unwrapped-vendor.tar.gz";
                  inherit src;
                  outputHash = "sha256-ItyXdLHrpgEMz1BHQk49w37D8Y15L7vg0jyWurrIZLs=";
                });
              });
              cargo-component = prev.cargo-component.overrideAttrs (old: rec {
                version = "0.5.0";
                src = prev.fetchFromGitHub { 
                      owner = "bytecodealliance";
                      repo = "cargo-component";
                      rev = "v0.5.0";
                      sha256 = "sha256-P7gXfACPK63f38KzV6UVQa8MZmxEaMNxl1GZYCDM54M=";
                };
                cargoDeps = old.cargoDeps.overrideAttrs (pkgs.lib.const {
                  inherit src;
                  outputHash = "sha256-JEkupF7RhHqnxbA3DdJKGGznTzoAsPIcvYGjOfqdP4M=";
                });
              }); 
            })
          ];

The issue: I see that nix is downloading the right revision, but I am convinced it builds something else. rust-analyzer --version returns rust-analyzer 2024-01-01, which is the current version in unstable. I have added string fork! to the version in my fork.
How can I see the actual build steps, like

  1. downloading form url …
  2. unpacking to folder …
  3. executing build with arguments …
  4. moving binaries from … to …

?

Note that cargo-component below works as expected, and they both seem to be set up very similarly. default.nix for rust-analyzer , cargo-component

Full source of my flake.nix

Just double-checking – are you confident the sha256 given is for the version you want?

I first used pkgs.lib.fakeSha256 on both src.sha256 and cargoDeps.outputHash so yes.

Fenix offers an overlay with nightly releases of rust-analyzer that are auto-updated by CI, and a bunch more goodies too. You may wish to study its implementation code or even just use it directly in your flake(s).

1 Like

Is there a way to debug the build step by step as mentioned in my first post?