8

go: use tzdata from Nix on Darwin by arcz · Pull Request #142494 · NixOS/nixpkgs...

 2 years ago
source link: https://github.com/NixOS/nixpkgs/pull/142494
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Member

arcz commented on Oct 21, 2021

Motivation for this change

The time package from go standard library depends on timezone database which is searched on a few common paths (https://cs.opensource.google/go/go/+/refs/tags/go1.17.2:src/time/zoneinfo_unix.go;l=20-27). Currently, the go derivation patches this file and adds another path to tzinfo in Nix store. This happens only on Linux and go binaries built on Darwin are using only the default system paths.

I did some research and the reason why patching is disabled on Darwin remains unknown to me. It seems like this condition was introduced years ago and was copied over to new derivations when new go releases came out. Is there any reason to keep this behavior? The same question was raised by @kalbasit in this comment https://github.com/NixOS/nixpkgs/pull/75013/files#r355208482 without any answer.

Apart from being an impure dependency on Darwin there is another case where this surfaces. Because tzinfo derivation is not recognised as a dependency on Darwin, cross-compiling a go program for musl64 and placing it in a Docker image with dockerTools.buildImage will result in a broken program due to missing tzinfo dependency (found by my friend @patryk4815).

This PR removes the condition and binaries built on Darwin will have the same dependency on tzinfo from Nix as those built on Linux.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK