sandbox-nix-tz

Sample project to test and inspect how glibc inside Nix performs timezone resolution.

Nix timezone sandbox

Simple program to print system's timezone using C standard library API (tzset, tzname and timezone), to inspect glibc inside Nix.

Commands

nix develop

# Generates a binary file as zig-out/bin/main
zig build

# This emulates non-NixOS system without $TZDIR envvar
TZ=Europe/Paris ./zig-out/bin/main --unset-tzdir

# You can see glibc tries to open non-existent path
TZ=Europe/Paris strace ./zig-out/bin/main --unset-tzdir 2>&1 | grep zoneinfo/Europe

# This emulates NixOS
TZ=Europe/Paris strace ./zig-out/bin/main 2>&1 | grep zoneinfo/Europe

# Reading of `/etc/localtime` works fine for some reason
./zig-out/bin/main --unset-tz --unset-tzdir
strace ./zig-out/bin/main --unset-tz --unset-tzdir 2>&1 | grep localtime

License

Files are licensed under Zero-Clause BSD. Every file except flake.lock has REUSE compliant copyright and license header.