about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2024-06-07 00:02:15 +0000
committerGitHub <noreply@github.com>2024-06-07 00:02:15 +0000
commit4ace29447c3c16fd661acaa2f0a1841b839e7baf (patch)
tree8a2c944dc6c7b7d5ab243c607ed5b82fb0d553b3 /pkgs/build-support
parent9f1130c9a6a782e5ceff5d8555a074eac3ae88bc (diff)
parentdd443d2d10ff7f7f7451f5bd04268f21daceb74d (diff)
Merge master into staging-next
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/deterministic-uname/default.nix20
1 files changed, 11 insertions, 9 deletions
diff --git a/pkgs/build-support/deterministic-uname/default.nix b/pkgs/build-support/deterministic-uname/default.nix
index a39ff4c206c7e..9efaa2558bfb6 100644
--- a/pkgs/build-support/deterministic-uname/default.nix
+++ b/pkgs/build-support/deterministic-uname/default.nix
@@ -5,6 +5,7 @@
 , coreutils
 , getopt
 , modDirVersion ? ""
+, forPlatform ? stdenv.buildPlatform
 }:
 
 substituteAll {
@@ -17,8 +18,8 @@ substituteAll {
 
   inherit coreutils getopt;
 
-  uSystem = if stdenv.buildPlatform.uname.system != null then stdenv.buildPlatform.uname.system else "unknown";
-  inherit (stdenv.buildPlatform.uname) processor;
+  uSystem = if forPlatform.uname.system != null then forPlatform.uname.system else "unknown";
+  inherit (forPlatform.uname) processor;
 
   # uname -o
   # maybe add to lib/systems/default.nix uname attrset
@@ -26,9 +27,9 @@ substituteAll {
   # https://stackoverflow.com/questions/61711186/where-does-host-operating-system-in-uname-c-comes-from
   # https://github.com/coreutils/gnulib/blob/master/m4/host-os.m4
   operatingSystem =
-    if stdenv.buildPlatform.isLinux
+    if forPlatform.isLinux
     then "GNU/Linux"
-    else if stdenv.buildPlatform.isDarwin
+    else if forPlatform.isDarwin
     then "Darwin" # darwin isn't in host-os.m4 so where does this come from?
     else if stdenv.buildPlatform.isFreeBSD
     then "FreeBSD"
@@ -44,11 +45,12 @@ substituteAll {
     mainProgram = "uname";
     longDescription = ''
       This package provides a replacement for `uname` whose output depends only
-      on `stdenv.buildPlatform`.  It is meant to be used from within derivations.
-      Many packages' build processes run `uname` at compile time and embed its
-      output into the result of the build.  Since `uname` calls into the kernel,
-      and the Nix sandbox currently does not intercept these calls, builds made
-      on different kernels will produce different results.
+      on `stdenv.buildPlatform`, or a configurable `forPlatform`.  It is meant
+      to be used from within derivations. Many packages' build processes run
+      `uname` at compile time and embed its output into the result of the build.
+      Since `uname` calls into the kernel, and the Nix sandbox currently does
+      not intercept these calls, builds made on different kernels will produce
+      different results.
     '';
     license = [ licenses.mit ];
     maintainers = with maintainers; [ artturin ];