Skip to content

build: honor SOURCE_DATE_EPOCH for reproducible build timestamp - #826

Merged
HalFrgrd merged 1 commit into
HalFrgrd:masterfrom
kcajf:reproducible-build-time
Jul 25, 2026
Merged

build: honor SOURCE_DATE_EPOCH for reproducible build timestamp#826
HalFrgrd merged 1 commit into
HalFrgrd:masterfrom
kcajf:reproducible-build-time

Conversation

@kcajf

@kcajf kcajf commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

What

build.rs currently stamps BUILD_TIME with chrono::Utc::now(), so every
build embeds the wall-clock time. This makes the compiled artifact differ on
each build — the last remaining source of non-determinism when packaging
flyline (e.g. for Nix, where builds are checked for bit-for-bit
reproducibility).

This change honors SOURCE_DATE_EPOCH:
when the env var is set, BUILD_TIME is derived from it; otherwise the
behavior is unchanged (falls back to the current wall-clock time). A
rerun-if-env-changed=SOURCE_DATE_EPOCH line ensures the build script re-runs
when the value changes.

Why

SOURCE_DATE_EPOCH is the cross-ecosystem standard for reproducible builds and
is set automatically by Nix, most distro build systems, and cargo tooling. No
behavior changes for normal cargo build/cargo install — the wall clock is
still used when the var is absent.

Testing

  • cargo build with no env var: BUILD_TIME is the current time (unchanged).
  • SOURCE_DATE_EPOCH=1700000000 cargo build: BUILD_TIME is derived from the
    epoch, and repeated builds produce byte-identical output.

This is the flyline-side counterpart to HalFrgrd/flycomp#6, which applied the
same fix to flycomp's build script.

The build script baked chrono::Utc::now() into the binary (surfaced by
`flyline --version`), making builds non-reproducible. Honor
SOURCE_DATE_EPOCH when set, falling back to the wall clock otherwise.
@HalFrgrd
HalFrgrd merged commit 685957c into HalFrgrd:master Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants