By: Tom Sydney Kerckhove <syd@cs-syd.eu>
Take the mutation children's locale from a Haskell derivation The coverage and mutation phases are plain stdenv derivations, so they get none of the environment the Haskell builder establishes for the test executables they run. A locale is part of that environment and not something a test suite is expected to set up for itself. Without one, anything a test spawns that consults the locale is configured differently here than anywhere else that suite runs. PostgreSQL's initdb takes its database encoding from the locale: with LANG unset it makes an SQL_ASCII cluster, where SUBSTRING counts bytes rather than characters, so a query that abbreviates a multi-byte string hands back a half character and the connection fails with 'invalid byte sequence for encoding UTF8'. That reads as a flaky test, and it is reachable only through this check. Copied off the driver, which is a Haskell package already in scope, rather than restated here, so these follow whatever nixpkgs decides the Haskell locale is instead of drifting from it.