Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guix: SOURCE_DATE_EPOCH is already set in some environments #29935

Open
laanwj opened this issue Apr 22, 2024 · 5 comments
Open

guix: SOURCE_DATE_EPOCH is already set in some environments #29935

laanwj opened this issue Apr 22, 2024 · 5 comments

Comments

@laanwj
Copy link
Member

laanwj commented Apr 22, 2024

The environment variable SOURCE_DATE_EPOCH allows overriding the date that will be used inside the archives for guix-built binaries. This is an intentional feature, as documented in contrib/guix/README.md:

  • SOURCE_DATE_EPOCH

    Override the reference UNIX timestamp used for bit-for-bit reproducibility,
    the variable name conforms to [standard][r12e/source-date-epoch].

    (defaults to the output of $(git log --format=%at -1))

However, some environments, as apparently Nix, set SOURCE_DATE_EPOCH by default. This can be extremely confusing, as it results in mismatches. i see three options:

  • Show a big red warning when the Guix build scripts are called with an existing SOURCE_DATE_EPOCH. Most likely it's not what the user wanted, but they can continue if they wanted.
  • Disallow overriding SOURCE_DATE_EPOCH - unset it at start.
  • Rename our SOURCE_DATE_EPOCH to something non-standard that doesn't conflict with Nix.

The first one has my preference.

See bitcoin-core/guix.sigs#1201 which prompted this.

@hebasto
Copy link
Member

hebasto commented Apr 22, 2024

  • Rename our SOURCE_DATE_EPOCH to something non-standard that doesn't conflict with Nix.

As we run Guix shell in a container, it seems reasonable to rename SOURCE_DATE_EPOCH in the guix-build and guix-codesign scripts, and pass it to the container using its original name:

--env SOURCE_DATE_EPOCH="${BITCOIN_SOURCE_DATE_EPOCH:?unable to determine value}"

@laanwj
Copy link
Member Author

laanwj commented Apr 23, 2024

Sounds good to me. I think it's fine to rename it, I think there's really very few edge cases in which one would really want to pass in a custom epoch to the guix build?

@fanquake
Copy link
Member

fanquake commented Apr 24, 2024

As we run Guix shell in a container, it seems reasonable to rename SOURCE_DATE_EPOCH in the guix-build and guix-codesign scripts, and pass it to the container using its original name:

Not sure. We already have FORCE_DIRTY_WORKTREE. Seems fine to just make SOURCE_DATE_EPOCH function in the same way, rather than new variables / more build options / things being less-standard.

@laanwj
Copy link
Member Author

laanwj commented Apr 24, 2024

That sounds like a good approach to me too. So, fail when SOURCE_DATE_EPOCH is set, unless FORCE_SOURCE_DATE_EPOCH is also set?

@laanwj
Copy link
Member Author

laanwj commented Apr 29, 2024

Or could cover SOURCE_DATE_EPOCH being set under FORCE_DIRTY_WORKTREE, it's not strictly the same, but it's also an intentionally introduced mismatch, and would avoid adding another build option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants