Unnecessary rebuilds of packages within flakes on unreletad changes

I have a single flake.nix which has multiple “packages” in the outputs.

One package, lets call it a lives in a subdirectory and does not need anything from outside of this folder.

The other package b depends on it.

I change flake.nix and add an environment variable to bs mkDerivation or even any file that only belongs to b.

a now gets rebuild.

Is there a way to not have a rebuild when unrelated files change?

I was thinking about moving a into its own flake, though that again would make development unnecessarily complex, as the dev-environment assumes that a resides within that particular subdir and does not follow symlinks…

Also it feels wrong to have a in its own flake, as it has no “worth” of it allone. It is just some websites assets.

1 Like

Can you share a minimal example of this?

Not minimal, though this is the project I have the problem with:

  1. Clone
  2. build assets
  3. make some whitespace changes in any file not in assets folder
  4. build assets again, target will be built from scratch

Expected => no rebuild in step 4

I can provide a more minimal example, though not before 2021 :smiley:

PS: It seems as if there are additional problems I have not yet checked into, nix flake show errors, I am aware of that, though as assets builds, I consider this unrelated.

1 Like

I didn’t immediately find the connection between your flake.nix and assets, but try using local paths such as ./assets instead of self for src.

On a quick glance that seems to work.