does fetchFromGitHub in NixOS download an archive and then unpacks it
Private research annotation
Sign in to add a private research label or note.
- User
does fetchFromGitHub in NixOS download an archive and then unpacks it
- Assistant
Yes, in Nixpkgs, the
fetchFromGitHubfunction is designed to download a source archive from GitHub and then unpack it. This function is commonly used in Nix expressions to fetch the source code of software hosted on GitHub.Here's a brief overview of how
fetchFromGitHubworks:-
Download: It constructs a URL to the tarball of the repository and the specific revision (commit, tag, or branch) you specify. This URL points to a compressed archive file containing the source code.
-
Unpack: After downloading the tarball, the function unpacks it into a directory, making the contents available for further processing or building.
Here is a typical usage of
fetchFromGitHubin a Nix expression: -
- User
how can I make sure that the date of the unpacked files is 1980 rather than 1970
- Assistant
To ensure that the dates of the unpacked files in Nix build processes are set to a specific time (such as January 1, 1980), you need to override the default behavior of
taror the command used for unpacking files. By default,tarmay set the file modification times to the Unix epoch (January 1, 1970) when it can't preserve the original timestamps.A common way to achieve this is to use the
--clamp-mtimeand--mtimeoptions withtaror specify a custom unpacking phase in a Nix derivation.