# Flakes and filterSource

I have flake structured like this

``````#flake.nix
{
outputs={self,nixpkgs}:{
overlay=final: prev:{
a=final.Package calling b;
b=final.stdenv.mkDerivation{
src=./.;
....
};
};
}
``````

I’m modifying a package such that only flake.nix get changed,not the other source files,creating spurious rebuilding of b.I’ve tried to replace `b.src` with a filterSource that excludes flake.nix (on the reasoning that if the changes to it would need a rebuild,itwould already change the drv) but apparently filterSource is not supported in restricted mode.Why?

Could you try `src = self;`? That seemed to work for me, but I haven’t looked into the details to verify what it is doing.

No,the problem is that I’m editing the a expression in `flake.nix` but b keeps recompiling as it depends on the source flake itself

Also I’ve tried to replace `src=self` with

``````src = with builtins;filterSource(path: type:
null!=match "flake.*" path
)self;
``````

But I’ve still got error

``````error: string '/nix/store/cw25vzzrmlhn16alzi5dgvadjkpfhb0p-source' cannot refer to other paths, at /nix/store/cw25vzzrmlhn16alzi5dgvadjkpfhb0p-source/flake.nix:65:29
``````

Ah, you are right. I have `src = self;` and I tried making a trivial change to my flake.nix file, a newline, and it rebuilds my package.