Don't use binary cache for specific package when running nixos-rebuild

Hi, I’m having a problem with the binary cache for a specific package. Is it possible to tell nixos-rebuild to specifically build that package from source while using the binary cache for the rest?

1 Like

I don’t think there’s anything built into Nix for this. But you can do it manually by building all its dependencies normally and then building it with --no-substitute. For an easy hack to get the dependencies, use nix eval to get the drvPath attribute of the derivation, then use nix-store --query --references on that path to get the build inputs that you need to build. Then you can build normally with --no-substitute to build the derivation without any binary caches.

I’m not sure about this but using the following attrs might make it build locally.

      preferLocalBuild = true;
      allowSubstitutes = false;
1 Like