-
-
Notifications
You must be signed in to change notification settings - Fork 13k
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
$SOURCE_DATE_EPOCH is always 1 if src=
points to a local directory
#112595
Comments
and then
does the trick, although it is not nice |
|
Looks similar to #25485 |
In some sense, yes (web server headers used in example too). But that issues is about no timestamps in derivation output, while this is about timestamp losing in |
@kvtb It is not the |
I see, but "interpolation of path object" is not mandatory. The For example:
There is at least one alternative: to keep sources in tarballs, so they can transit via Nix Store or NAR without losing timestamps. I cannot accept arguments that erasing timestamps are inevitable just because
|
To summarize: the question is - should unpacked sources be a Nix derivation? The current answer is "sometimes" (depending on whether one uses
|
Behaviour of nixlang paths is design choice to ensure that the instantiations hash all inputs and the builds are reproducible. There is no special handling for the |
Not a showstopper at all: the whole tarballDir might be implemented in C++ as builtins.tarballDir (next to builtins.readDir). And it does not work in sandbox and in remote builds, simple because it works when nix-instantiate works, before nix-build with sandboxes and remote builds. But it is implementation details, even src=./dev/dir is just a special case, not the keypoint of the problem, and can be removed from consideration if it is so confusing per se. The problem can be shown without src=./dev/dir at all: the two cases (preserving and erasing timestamps) can be shown on fetchurl vs. fetchgit as examples. Both build types are reproducible, but they are different: in the first $SOURCE_DATE_EPOCH works and there are no problem with pre-1980 dates, in the second $SOURCE_DATE_EPOCH is always "1" and file timestamps are always in 1970 causing problems with Python, with browser caching etc. Do we really need both? I would keep only the first (postulating that filetimes are important part of the sources and thus unpacked sources should not be stored in Nix Store - (I also think that it would improve the Nix Store performance, as millions of small files are slow to chmod, chown, reset timestamps, calculate sha, deduplicate, delete ...)) |
The |
I guess you could do that. But then you would need your server to serve files from inside that tarball? |
Exactly! Do we need both (metadata-preserving and metadata-erasing) ways to work with the sources? |
This comment has been minimized.
This comment has been minimized.
My bad, used wrong buttons |
No, why? |
If you unpack them, move them to $out then Nix will just remove timestamps again. |
They moved not to Imagine the world like our, but |
So you run your server inside the build? |
What server? |
The one that allows you to experience the caching issues. Or what is the actual motivation for keeping the timestamps? |
The motivations is to make all I just see |
In one case |
Not for local directories, but if you're interested in |
I do not think it is a bug to fix. Better something to brainstorm.
When there is a derivation whose
src
points to a tarball (orfetchurl
a tarball), the source files have timestamps.But when there is something like
src = ./dev/directory
, the directory gets copied to Nix Store first, and on this step all timestamps are set to1970-01-01T00:00:01Z
It might looks a minor inconvenience, but it has some bad consequences.
For example
$SOURCE_DATE_EPOCH
is not set to the timestamp of the newest source file and remains the same ("1") while source is getting changed. That results in various caching issues (alwaysLast-Modified: Thu, 01 Jan 1970 00:00:01 GMT
on embedded web-servers, etc) whensrc=/dev/directory
, but the issues disappear withsrc=fetchurl{url="....../sources.tar.gz";}
It would be nice to find a way to skip copying src directory to the Nix Store.
Or, at least, copy it there in a form which preserves timestamps (tarball?).
The text was updated successfully, but these errors were encountered: