Faust bug in ''nix-shell'' and ''nix develop''

I’m working on some faust code that works just fine when I compile it using my nixos system-wide installed faust2jack, or the one in my profile, but has a subtle bug in the audio when I compile it using either a shell.nix or a flake.nix.
I’ve been using and contributing to nixos for 10 years now, but I know just enough for that.
I totally new to nix shells.

To reproduce, you need to have jack running:

services.jack.jackd.enable = true;

Then run:

git clone https://github.com/magnetophon/lamb
cd lamb
git checkout flake
nix develop
faust2jack -double  -time -t 0 lamb.dsp &&  x42-scope & ./lamb

Run some audio trough lamb and connect it’s outputs to x42-scope.
Turn up the input gain of lamb until you see the gain reduction meters move.
Output nr 3 and 4 will show the gain reduction on the scope.
The bug can be seen as jumps in these lines, like this:


Without the bug, these are smooth lines:

To compile without the bug, open a new terminal an do:

nix profile install nixpkgs#faust2jack
nix profile install nixpkgs#x42-pluins
faust2jack -double  -time -t 0 lamb.dsp &&  x42-scope & ./lamb

Faust is a transpiler that outputs C++.
It seems that the problem is not with faust itself, but with the way the C++ it outputs is compiled, since the C++ output is the same in both environments:

faust -time -t 0 -double -o lamb.cpp lamb.dsp

If there is a bug caused in the compilation process then it should be because of the used versions … did you try to set the nixpkgs version of the flake and the system to the same commit hash to see if there is still a difference?

The difference between your system and the shell/flake should be just the nixpkgs version.

The flake and the system have the same commit hash.

In the meantime I found out that If I force the indexes of some tables I have in my code to be in their range, I don’t get the bug in either environment.

That still doesn’t explain why the compilation is different in different environments though.

I still think that the problem is not in the compilation.
are the faust2jack the binaries the same?
use which to identify them.
if not how do they differ?
nix store diff-closures ...