Consider the following flake:
# flake.nix
{
outputs = { self, nixpkgs }: {
packages.x86_64-linux.default = with nixpkgs.legacyPackages.x86_64-linux; dockerTools.buildImage {
name = "nonreproducible-image";
copyToRoot = (runCommand "not-reproducible" {} ''
mkdir -p $out
head -c 100 /dev/urandom > $out/random
'');
};
};
}
That is "pure" in the sense that "nix build" will let you build that in pure mode (i.e. in a flake).It will produce a store path with the same hash on any machine you 'nix build' it on, but the contents of 'random' will be different each time.
Flakes do not make nix reproducible since flakes do not prevent derivations from running arbitrary commands and producing their own impurities.