4 ms·
GCC respects SOURCE_DATE_EPOCH, and Nixpkgs has specific support for setting that environment variable: https://github.com/NixOS/nixpkgs/blob/92fdbd284c262f3e47
by Smaug123 3y ago
GCC respects SOURCE_DATE_EPOCH, and Nixpkgs has specific support for setting that environment variable: https://github.com/NixOS/nixpkgs/blob/92fdbd284c262f3e478033e4b41029dc160b7812/pkgs/build-support/setup-hooks/set-source-date-epoch-to-latest.sh#L12 https://github.com/NixOS/nixpkgs/blob/92fdbd284c262f3e478033... (although I haven't proved that this is actually how it works for cpython's build).
Irrelevant spelunking details follow:
That string is output by cpython to contain the contents of the __DATE__ C macro (https://github.com/python/cpython/blob/fa35b9e89b2e207fc8bae9eb0284260d0d922e7a/Modules/main.c#L192 https://github.com/python/cpython/blob/fa35b9e89b2e207fc8bae... which calls to https://github.com/python/cpython/blob/fa35b9e89b2e207fc8bae9eb0284260d0d922e7a/Modules/getbuildinfo.c#L45 https://github.com/python/cpython/blob/fa35b9e89b2e207fc8bae... which uses the __DATE__ macro at https://github.com/python/cpython/blob/fa35b9e89b2e207fc8bae9eb0284260d0d922e7a/Modules/getbuildinfo.c#L14 https://github.com/python/cpython/blob/fa35b9e89b2e207fc8bae... ).
Cpython is defined in nixpkgs at https://github.com/NixOS/nixpkgs/blob/92fdbd284c262f3e478033e4b41029dc160b7812/pkgs/development/interpreters/python/cpython/default.nix https://github.com/NixOS/nixpkgs/blob/92fdbd284c262f3e478033... which I imagine (but haven't proved) uses GCC.
- mbakke 3y agoThank you! Setting SOURCE_DATE_EPOCH to the most recent file timestamp found in the source input is a clever hack.