From 4a9fddc59863c3c2077e35bff913dd664c8b6e1a Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 26 Mar 2018 22:37:49 -0500 Subject: [PATCH] unixtools: cleanup --- pkgs/os-specific/linux/autofs/default.nix | 8 ++--- pkgs/servers/apcupsd/default.nix | 7 ++-- pkgs/top-level/all-packages.nix | 15 +++----- pkgs/top-level/perl-packages.nix | 2 +- pkgs/top-level/unix-tools.nix | 42 +++++++++++++++++++++++ 5 files changed, 55 insertions(+), 19 deletions(-) diff --git a/pkgs/os-specific/linux/autofs/default.nix b/pkgs/os-specific/linux/autofs/default.nix index 79e12dd0f437..a7472de1d025 100644 --- a/pkgs/os-specific/linux/autofs/default.nix +++ b/pkgs/os-specific/linux/autofs/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchurl, flex, bison, linuxHeaders, libtirpc, utillinux, nfs-utils, e2fsprogs +{ stdenv, lib, fetchurl, flex, bison, linuxHeaders, libtirpc, mount, umount, modprobe, nfs-utils, e2fsprogs , libxml2, kerberos, kmod, openldap, sssd, cyrus_sasl, openssl }: let @@ -17,10 +17,10 @@ in stdenv.mkDerivation { export sssldir="${sssd}/lib/sssd/modules" export HAVE_SSS_AUTOFS=1 - export MOUNT=${utillinux}/bin/mount + export MOUNT=${mount}/bin/mount export MOUNT_NFS=${nfs-utils}/bin/mount.nfs - export UMOUNT=${utillinux}/bin/umount - export MODPROBE=${utillinux}/bin/modprobe + export UMOUNT=${umount}/bin/umount + export MODPROBE=${modprobe}/bin/modprobe export E2FSCK=${e2fsprogs}/bin/fsck.ext2 export E3FSCK=${e2fsprogs}/bin/fsck.ext3 export E4FSCK=${e2fsprogs}/bin/fsck.ext4 diff --git a/pkgs/servers/apcupsd/default.nix b/pkgs/servers/apcupsd/default.nix index 3b67171a474e..5f0440fc6913 100644 --- a/pkgs/servers/apcupsd/default.nix +++ b/pkgs/servers/apcupsd/default.nix @@ -1,4 +1,5 @@ -{ stdenv, fetchurl, pkgconfig, systemd, utillinux, coreutils, nettools, man +{ stdenv, fetchurl, pkgconfig, systemd, utillinux, coreutils, wall, hostname, man +, utillinux , enableCgiScripts ? true, gd }: @@ -46,8 +47,8 @@ stdenv.mkDerivation rec { postInstall = '' for file in "$out"/etc/apcupsd/*; do - sed -i -e 's|^WALL=.*|WALL="${utillinux}/bin/wall"|g' \ - -e 's|^HOSTNAME=.*|HOSTNAME=`${nettools}/bin/hostname`|g' \ + sed -i -e 's|^WALL=.*|WALL="${wall}/bin/wall"|g' \ + -e 's|^HOSTNAME=.*|HOSTNAME=`${hostname}/bin/hostname`|g' \ "$file" done ''; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 860d049e8650..c1f9e198aafa 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4608,11 +4608,7 @@ with pkgs; v8 = v8_static; }; - rsnapshot = callPackage ../tools/backup/rsnapshot { - # For the `logger' command, we can use either `utillinux' or - # GNU Inetutils. The latter is more portable. - logger = if stdenv.isLinux then utillinux else inetutils; - }; + rsnapshot = callPackage ../tools/backup/rsnapshot { }; rlwrap = callPackage ../tools/misc/rlwrap { }; @@ -7659,7 +7655,6 @@ with pkgs; inherit (perlPackages) perl ExporterLite FileWhich GetoptTabular RegexpCommon TermReadKey; inherit (llvmPackages_4) llvm clang-unwrapped; - utillinux = if stdenv.isLinux then utillinuxMinimal else null; }; cscope = callPackage ../development/tools/misc/cscope { }; @@ -13091,7 +13086,7 @@ with pkgs; }) else if stdenv.isLinux then utillinuxMinimal - else null; + else libossp_uuid; light = callPackage ../os-specific/linux/light { }; @@ -13099,8 +13094,6 @@ with pkgs; ebtables = callPackage ../os-specific/linux/ebtables { }; - eject = utillinux; - facetimehd-firmware = callPackage ../os-specific/linux/firmware/facetimehd-firmware { }; fatrace = callPackage ../os-specific/linux/fatrace { }; @@ -14017,7 +14010,7 @@ with pkgs; ncurses = null; perl = null; systemd = null; - }) else throw "utillinux is unsupported on non-Linux"; + }) else utillinux; v4l_utils = qt5.callPackage ../os-specific/linux/v4l-utils { }; @@ -21142,5 +21135,5 @@ with pkgs; # Unix tools unixtools = recurseIntoAttrs (callPackages ./unix-tools.nix { }); - inherit (unixtools) hexdump ps sysctl; + inherit (unixtools) hexdump ps logger eject modprobe umount mount wall hostname more; } diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index 13554ff6ee68..91e3581b6835 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -7328,7 +7328,7 @@ let self = _self // overrides; _self = with self; { url = "mirror://cpan/authors/id/J/JP/JPIERCE/IO-Pager-${version}.tgz"; sha256 = "0ksldcw0hydfy9k70i6q6fm1wgbc54kx0lbwlkrszsbd7q72dlfg"; }; - propagatedBuildInputs = [pkgs.utillinux.bin]; # `more` used in tests + propagatedBuildInputs = [pkgs.more]; # `more` used in tests }; IOPrompt = buildPerlPackage { diff --git a/pkgs/top-level/unix-tools.nix b/pkgs/top-level/unix-tools.nix index 706cd061b591..0c6b9e261dd8 100644 --- a/pkgs/top-level/unix-tools.nix +++ b/pkgs/top-level/unix-tools.nix @@ -1,5 +1,15 @@ { pkgs, buildEnv, runCommand, hostPlatform }: +# These are some unix tools that are commonly included in the /usr/bin +# and /usr/sbin directory under more normal distributions. Along with +# coreutils, these are commonly assumed to be available by build +# systems, but we can't assume they are available. In Nix, we list +# each program by name directly through this unixtools attribute. + +# You should always try to use single binaries when available. For +# instance, if your program needs to use "ps", just list it as a build +# input, not "procps" which requires Linux. + let singleBinary = cmd: providers: @@ -17,10 +27,22 @@ let else throw "${hostPlatform.parsed.kernel.name} does not have ${cmd}"; in rec { + + # more is unavailable in darwin + # just use less + more_compat = runCommand "more" {} '' + mkdir -p $out/bin + ln -s ${pkgs.less}/bin/less $out/bin/more + ''; + + # singular binaries arp = singleBinary "arp" { linux = pkgs.nettools; darwin = pkgs.darwin.network_cmds; }; + eject = singleBinary "eject" { + linux = pkgs.utillinux; + }; getopt = singleBinary "getopt" { linux = pkgs.utillinux; darwin = pkgs.darwin.shell_cmds; @@ -37,6 +59,19 @@ in rec { linux = pkgs.nettools; darwin = pkgs.darwin.network_cmds; }; + logger = singleBinary "logger" { + linux = pkgs.utillinux; + }; + modprobe = singleBinary "modprobe" { + linux = pkgs.utillinux; + }; + more = singleBinary "more" { + linux = pkgs.utillinux; + darwin = pkgs.more_compat; + }; + mount = singleBinary "mount" { + linux = pkgs.utillinux; + }; netstat = singleBinary "netstat" { linux = pkgs.nettools; darwin = pkgs.darwin.network_cmds; @@ -61,16 +96,23 @@ in rec { linux = pkgs.procps; darwin = pkgs.darwin.system_cmds; }; + umount = singleBinary "umount" { + linux = pkgs.utillinux; + }; whereis = singleBinary "whereis" { linux = pkgs.utillinux; darwin = pkgs.darwin.shell_cmds; }; + wall = singleBinary "wall" { + linux = pkgs.utillinux; + }; write = singleBinary "write" { linux = pkgs.utillinux; darwin = pkgs.darwin.basic_cmds; }; # Compatibility derivations + # Provided for old usage of these commands. procps = buildEnv { name = "procps-compat";