about summary refs log tree commit diff
path: root/pkgs/top-level/unix-tools.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/top-level/unix-tools.nix')
-rw-r--r--pkgs/top-level/unix-tools.nix21
1 files changed, 17 insertions, 4 deletions
diff --git a/pkgs/top-level/unix-tools.nix b/pkgs/top-level/unix-tools.nix
index 36fba3fbd479..c057aa45be6f 100644
--- a/pkgs/top-level/unix-tools.nix
+++ b/pkgs/top-level/unix-tools.nix
@@ -1,4 +1,5 @@
-{ pkgs, buildEnv, runCommand, hostPlatform, lib }:
+{ pkgs, buildEnv, runCommand, hostPlatform, lib
+, stdenv }:
 
 # These are some unix tools that are commonly included in the /usr/bin
 # and /usr/sbin directory under more normal distributions. Along with
@@ -11,9 +12,11 @@
 # input, not "procps" which requires Linux.
 
 let
+  version = "1003.1-2008";
+
   singleBinary = cmd: providers: let
       provider = "${lib.getBin providers.${hostPlatform.parsed.kernel.name}}/bin/${cmd}";
-    in runCommand cmd {
+    in runCommand "${cmd}-${version}" {
       meta.platforms = map (n: { kernel.name = n; }) (pkgs.lib.attrNames providers);
     } ''
       mkdir -p $out/bin
@@ -28,7 +31,7 @@ let
 
   # more is unavailable in darwin
   # just use less
-  more_compat = runCommand "more" {} ''
+  more_compat = runCommand "more-${version}" {} ''
     mkdir -p $out/bin
     ln -s ${pkgs.less}/bin/less $out/bin/more
   '';
@@ -46,6 +49,16 @@ let
     eject = {
       linux = pkgs.utillinux;
     };
+    getconf = {
+      linux = if hostPlatform.isMusl then pkgs.musl-getconf
+              else lib.getBin stdenv.cc.libc;
+      darwin = pkgs.darwin.system_cmds;
+    };
+    getent = {
+      linux = if hostPlatform.isMusl then pkgs.musl-getent
+              # This may not be right on other platforms, but preserves existing behavior
+              else /* if hostPlatform.libc == "glibc" then */ pkgs.glibc.bin;
+    };
     getopt = {
       linux = pkgs.utillinux;
       darwin = pkgs.getopt;
@@ -131,7 +144,7 @@ let
   };
 
   makeCompat = name': value: buildEnv {
-    name = name' + "-compat";
+    name = name' + "-compat-${version}";
     paths = value;
   };