Why my nixos-rebuild in flake doesn't use binary cache?

Hi, I’m just trying to figure out why my nixos-rebuild in flake is so slow.

I have pkgs.element-desktop, which is electron based application.

When I try nix-shell -p element-desktop, it finishes in seconds, and I’m able to use the app. But when I add it to my nix configurations and try nixos-rebuild it tries to build whole electron which takes forever.

I believe that nix uses some binary caches and skip building whole dependancies. Does it mean that nixpkgs in my flake.lock is differet from the one that is used by nix-shell? Which nixpkgs hash is applied to nix-shell?
Is there a way to check if binary cache exists on the pkg I want to install?

thanks.

What is your flake’s nixpkgs input URL?

I’m using github:nixos/nixpkgs/nixos-24.05

When’s the last time you ran nix flake update? And do you have any overlays?

I update it regularly. I use overlay for several packages but not this one. Tried with latest version of it but same.

λ sudo nixos-rebuild dry-build --flake .#home --impure
building the system configuration...
warning: Git tree '/home/rok/src/github.com/aca/nix-config' is dirty
these 20 derivations will be built:
  /nix/store/bvar64icmfhml5m2m2432g7rs4n6ay65-electron-unwrapped-31.4.0.drv
  /nix/store/qi0qdnlmjxi677ni0zv05x4ff2rxha13-electron-31.4.0.drv
  /nix/store/320mz8lgrij8w7llmx2qba6gpp1r1w5v-element-desktop-1.11.75.drv
  /nix/store/wi20mh1yqgjnhmxar8hzgykq73mwnddy-system-path.drv

λ nix path-info --store https://cache.nixos.org/ --json /nix/store/320mz8lgrij8w7llmx2qba6gpp1r1w5v-element-desktop-1.11.75.drv
  /nix/store/320mz8lgrij8w7llmx2qba6gpp1r1w5v-element-desktop-1.11.75.drv
[{"path":"/nix/store/320mz8lgrij8w7llmx2qba6gpp1r1w5v-element-desktop-1.11.75.drv","valid":false}]⏎ 
  ...

okay it seems to install different version

λ nix-shell -p element-desktop
these 3 paths will be fetched (137.92 MiB download, 654.37 MiB unpacked):
  /nix/store/rjdhcr1a28n8288m347pxfkgv5a78qzw-electron-31.4.0
  /nix/store/8zb1kn0n8wmbmigqbl173bb96fmafrnn-electron-unwrapped-31.4.0
  /nix/store/s3d5jvkwr4gvjd1d8z9l4l2afq2nm769-element-desktop-1.11.75
λ sudo nixos-rebuild dry-build --flake .#home --impure
building the system configuration...
warning: Git tree '/home/rok/src/github.com/aca/nix-config' is dirty
these 20 derivations will be built:
  /nix/store/bvar64icmfhml5m2m2432g7rs4n6ay65-electron-unwrapped-31.4.0.drv
  /nix/store/qi0qdnlmjxi677ni0zv05x4ff2rxha13-electron-31.4.0.drv

What flake.lock does nix-shell references?..

which ones do you use it for? What are the overlays?

It turned out to be issue of my overlay
I tried to use unstable chromium and it definitely affects other electron-based app.
Doesn’t feel right that it affects other applications…

Thanks @waffle8946 @Brisingr05