Nix-shell -p vs configuration.nix: dependencies cache vs build

When I use ffmpeg using nix-shell -p ffmpeg I get a version from the NixOS cache, however if I create a service that depends on ffmpeg (using pkgs.ffmpeg) it needs to build a whole lot of dependencies from scratch, which is painfully slow on a Atom based NAS.

Any idea why?

Thanks,
Nathan

One possibility is that you are pulling from two different channels, once for the user and one for the system. Do you get outputs for both of these commands?

nix-channel --list
sudo nix-channel --list

Both are using root

Did you define any overrides or overlays in configuration.nix?

@nathan.gs did you ever figure this out? I have the inverted problem with pytorch–have it in home-manager home.nix but nix-shell has to rebuild.