about summary refs log tree commit diff
path: root/pkgs/tools/misc/coreutils
diff options
context:
space:
mode:
authorBen Wolsieffer <benwolsieffer@gmail.com>2022-07-04 13:08:53 -0400
committerBen Wolsieffer <benwolsieffer@gmail.com>2022-07-05 19:53:50 -0400
commit03d159b493e7d3d08bd06d2a816f5c68567f2c20 (patch)
treefd56568edcdfc1b43dbf1205d5943864ff97c466 /pkgs/tools/misc/coreutils
parent0c564ffe7876338179c32ff9a6b63c36eb0c6a25 (diff)
coreutils: enable /proc/uptime support when cross-compiling
/proc/uptime support can't be detected automatically when cross-compiling, so
it is disabled by default. This causes extremely large uptime values (e.g.
19167 days) on systems without RTCs because the boot time is set to the
epoch.
Diffstat (limited to 'pkgs/tools/misc/coreutils')
-rw-r--r--pkgs/tools/misc/coreutils/default.nix7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkgs/tools/misc/coreutils/default.nix b/pkgs/tools/misc/coreutils/default.nix
index f6d2591716e17..da6df52214109 100644
--- a/pkgs/tools/misc/coreutils/default.nix
+++ b/pkgs/tools/misc/coreutils/default.nix
@@ -118,7 +118,12 @@ stdenv.mkDerivation rec {
       # TODO(19b98110126fde7cbb1127af7e3fe1568eacad3d): Needed for fstatfs() I
       # don't know why it is not properly detected cross building with glibc.
       "fu_cv_sys_stat_statfs2_bsize=yes"
-    ];
+    ]
+    # /proc/uptime is available on Linux and produces accurate results even if
+    # the boot time is set to the epoch because the system has no RTC. We
+    # explicitly enable it for cases where it can't be detected automatically,
+    # such as when cross-compiling.
+    ++ optional stdenv.hostPlatform.isLinux "gl_cv_have_proc_uptime=yes";
 
   # The tests are known broken on Cygwin
   # (http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/19025),