summary refs log tree commit diff
path: root/pkgs/tools/system
diff options
context:
space:
mode:
authorBen Siraphob <bensiraphob@gmail.com>2021-01-15 16:19:50 +0700
committerBen Siraphob <bensiraphob@gmail.com>2021-01-15 17:12:36 +0700
commit8c5d37129fc5097d9fb52e95fb07de75392d1c3c (patch)
tree40cfd341b87811008151e9ecf053cf7449574b98 /pkgs/tools/system
parent94f36839357387fd711d17d762d88c69767f265b (diff)
downloadnixpkgs-8c5d37129fc5097d9fb52e95fb07de75392d1c3c.tar
nixpkgs-8c5d37129fc5097d9fb52e95fb07de75392d1c3c.tar.gz
nixpkgs-8c5d37129fc5097d9fb52e95fb07de75392d1c3c.tar.bz2
nixpkgs-8c5d37129fc5097d9fb52e95fb07de75392d1c3c.tar.lz
nixpkgs-8c5d37129fc5097d9fb52e95fb07de75392d1c3c.tar.xz
nixpkgs-8c5d37129fc5097d9fb52e95fb07de75392d1c3c.tar.zst
nixpkgs-8c5d37129fc5097d9fb52e95fb07de75392d1c3c.zip
pkgs/tools: stdenv.lib -> lib
Diffstat (limited to 'pkgs/tools/system')
-rw-r--r--pkgs/tools/system/amtterm/default.nix4
-rw-r--r--pkgs/tools/system/at/default.nix6
-rw-r--r--pkgs/tools/system/bar/default.nix8
-rw-r--r--pkgs/tools/system/bfs/default.nix4
-rw-r--r--pkgs/tools/system/bottom/default.nix2
-rw-r--r--pkgs/tools/system/chase/default.nix4
-rw-r--r--pkgs/tools/system/collectd/default.nix2
-rw-r--r--pkgs/tools/system/collectd/plugins.nix30
-rw-r--r--pkgs/tools/system/dfc/default.nix8
-rw-r--r--pkgs/tools/system/facter/default.nix4
-rw-r--r--pkgs/tools/system/fakeroot/default.nix14
-rw-r--r--pkgs/tools/system/fcron/default.nix2
-rw-r--r--pkgs/tools/system/fdisk/default.nix6
-rw-r--r--pkgs/tools/system/fio/default.nix6
-rw-r--r--pkgs/tools/system/freeipmi/default.nix8
-rw-r--r--pkgs/tools/system/gptfdisk/default.nix4
-rw-r--r--pkgs/tools/system/gt5/default.nix10
-rw-r--r--pkgs/tools/system/idle3tools/default.nix8
-rw-r--r--pkgs/tools/system/illum/default.nix8
-rw-r--r--pkgs/tools/system/inxi/default.nix2
-rw-r--r--pkgs/tools/system/ipmitool/default.nix6
-rw-r--r--pkgs/tools/system/ledmon/default.nix2
-rw-r--r--pkgs/tools/system/logrotate/default.nix10
-rw-r--r--pkgs/tools/system/mcron/default.nix6
-rw-r--r--pkgs/tools/system/monit/default.nix16
-rw-r--r--pkgs/tools/system/netdata/default.nix4
-rw-r--r--pkgs/tools/system/pciutils/default.nix2
-rw-r--r--pkgs/tools/system/plan9port/default.nix6
-rw-r--r--pkgs/tools/system/proot/default.nix4
-rw-r--r--pkgs/tools/system/rofi-systemd/default.nix10
-rw-r--r--pkgs/tools/system/rowhammer-test/default.nix2
-rw-r--r--pkgs/tools/system/rsyslog/default.nix8
-rw-r--r--pkgs/tools/system/runit/default.nix8
-rw-r--r--pkgs/tools/system/s6-rc/default.nix4
-rw-r--r--pkgs/tools/system/safecopy/default.nix8
-rw-r--r--pkgs/tools/system/setserial/default.nix6
-rw-r--r--pkgs/tools/system/sleuthkit/default.nix8
-rw-r--r--pkgs/tools/system/smartmontools/default.nix4
-rw-r--r--pkgs/tools/system/socklog/default.nix4
-rw-r--r--pkgs/tools/system/stress-ng/default.nix4
-rw-r--r--pkgs/tools/system/supervise/default.nix2
-rw-r--r--pkgs/tools/system/testdisk/default.nix10
-rw-r--r--pkgs/tools/system/thinkfan/default.nix4
-rw-r--r--pkgs/tools/system/tree/default.nix8
-rw-r--r--pkgs/tools/system/tuptime/default.nix2
-rw-r--r--pkgs/tools/system/undaemonize/default.nix8
-rw-r--r--pkgs/tools/system/zenith/default.nix2
47 files changed, 149 insertions, 149 deletions
diff --git a/pkgs/tools/system/amtterm/default.nix b/pkgs/tools/system/amtterm/default.nix
index 9050111fc17..4ceb1aea72b 100644
--- a/pkgs/tools/system/amtterm/default.nix
+++ b/pkgs/tools/system/amtterm/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, makeWrapper, perl, perlPackages }:
+{ fetchurl, lib, stdenv, makeWrapper, perl, perlPackages }:
 
 
 stdenv.mkDerivation rec {
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   postInstall =
     "wrapProgram $out/bin/amttool --prefix PERL5LIB : $PERL5LIB";
 
-  meta = with stdenv.lib;
+  meta = with lib;
     { description = "Intel AMTĀ® SoL client + tools";
       homepage = "https://www.kraxel.org/cgit/amtterm/";
       license = licenses.gpl2;
diff --git a/pkgs/tools/system/at/default.nix b/pkgs/tools/system/at/default.nix
index 278b14cd199..db3c066c0ba 100644
--- a/pkgs/tools/system/at/default.nix
+++ b/pkgs/tools/system/at/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, bison, flex, pam, perl
+{ lib, stdenv, fetchurl, fetchpatch, bison, flex, pam, perl
 , sendmailPath ? "/run/wrappers/bin/sendmail"
 , atWrapperPath ? "/run/wrappers/bin/at"
 }:
@@ -52,8 +52,8 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = ''The classical Unix `at' job scheduling command'';
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
     homepage = "https://packages.qa.debian.org/at";
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/tools/system/bar/default.nix b/pkgs/tools/system/bar/default.nix
index 32945a24bb1..79bb3f79a99 100644
--- a/pkgs/tools/system/bar/default.nix
+++ b/pkgs/tools/system/bar/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   name = "bar-1.11.1";
@@ -11,8 +11,8 @@ stdenv.mkDerivation {
   meta = {
     description = "Console progress bar";
     homepage = "http://clpbar.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = [ stdenv.lib.maintainers.rdnetto ];
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.rdnetto ];
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/tools/system/bfs/default.nix b/pkgs/tools/system/bfs/default.nix
index c49f033c42a..7ea7430e95d 100644
--- a/pkgs/tools/system/bfs/default.nix
+++ b/pkgs/tools/system/bfs/default.nix
@@ -11,10 +11,10 @@ stdenv.mkDerivation rec {
     sha256 = "1iricyigm0rsc8fr91vk3krvyafbnp0y3ww1rjv94l6jbdl7rrlb";
   };
 
-  buildInputs = stdenv.lib.optionals stdenv.isLinux [ libcap acl ];
+  buildInputs = lib.optionals stdenv.isLinux [ libcap acl ];
 
   # Disable LTO on darwin. See https://github.com/NixOS/nixpkgs/issues/19098
-  preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
+  preConfigure = lib.optionalString stdenv.isDarwin ''
     substituteInPlace Makefile --replace "-flto -DNDEBUG" "-DNDEBUG"
   '';
 
diff --git a/pkgs/tools/system/bottom/default.nix b/pkgs/tools/system/bottom/default.nix
index a79e8bdcebf..d138ed4d8c1 100644
--- a/pkgs/tools/system/bottom/default.nix
+++ b/pkgs/tools/system/bottom/default.nix
@@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec {
 
   nativeBuildInputs = [ installShellFiles ];
 
-  buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.IOKit;
+  buildInputs = lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.IOKit;
 
   cargoSha256 = "sha256-qnh4Tl6JRgxBJbu+t9IJX/XChIR15rTRLvsl+/ZvPxY=";
 
diff --git a/pkgs/tools/system/chase/default.nix b/pkgs/tools/system/chase/default.nix
index c4396aad9ca..a37d9bbf47a 100644
--- a/pkgs/tools/system/chase/default.nix
+++ b/pkgs/tools/system/chase/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl ,pkgconfig, libatomic_ops , boehmgc }:
+{ lib, stdenv, fetchurl ,pkgconfig, libatomic_ops , boehmgc }:
 
 stdenv.mkDerivation rec {
   pname = "chase";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   makeFlags = [ "-e" ];
   makeFlagsArray="LIBS=-lgc";
 
-  meta = with stdenv.lib ; {
+  meta = with lib ; {
     description = "Follow a symlink and print out its target file";
     longDescription = ''
     A commandline program that chases symbolic filesystems links to the original file
diff --git a/pkgs/tools/system/collectd/default.nix b/pkgs/tools/system/collectd/default.nix
index eb64a09a22b..8add2b3ad62 100644
--- a/pkgs/tools/system/collectd/default.nix
+++ b/pkgs/tools/system/collectd/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig autoreconfHook ];
   buildInputs = [
     libtool
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     darwin.apple_sdk.frameworks.ApplicationServices
   ] ++ plugins.buildInputs;
 
diff --git a/pkgs/tools/system/collectd/plugins.nix b/pkgs/tools/system/collectd/plugins.nix
index defeed4c892..dd578cd6393 100644
--- a/pkgs/tools/system/collectd/plugins.nix
+++ b/pkgs/tools/system/collectd/plugins.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , curl
 , darwin
 , hiredis
@@ -49,7 +49,7 @@ let
     aggregation = {};
     amqp = {
       buildInputs = [ yajl ] ++
-        stdenv.lib.optionals stdenv.isLinux [ rabbitmq-c ];
+        lib.optionals stdenv.isLinux [ rabbitmq-c ];
     };
     apache = {
       buildInputs = [ curl ];
@@ -62,7 +62,7 @@ let
     };
     barometer = {};
     battery = {
-      buildInputs = stdenv.lib.optionals stdenv.isDarwin [
+      buildInputs = lib.optionals stdenv.isDarwin [
         darwin.apple_sdk.frameworks.IOKit
       ];
     };
@@ -94,9 +94,9 @@ let
     };
     df = {};
     disk = {
-      buildInputs = stdenv.lib.optionals stdenv.isLinux [
+      buildInputs = lib.optionals stdenv.isLinux [
         udev
-      ] ++ stdenv.lib.optionals stdenv.isDarwin [
+      ] ++ lib.optionals stdenv.isDarwin [
         darwin.apple_sdk.frameworks.IOKit
       ];
     };
@@ -126,7 +126,7 @@ let
     iptables = {
       buildInputs = [
         libpcap
-      ] ++ stdenv.lib.optionals stdenv.isLinux [
+      ] ++ lib.optionals stdenv.isLinux [
         iptables libmnl
       ];
     };
@@ -161,14 +161,14 @@ let
     memory = {};
     mic = {};
     modbus = {
-      buildInputs = stdenv.lib.optionals stdenv.isLinux [ libmodbus ];
+      buildInputs = lib.optionals stdenv.isLinux [ libmodbus ];
     };
     mqtt = {
       buildInputs = [ mosquitto ];
     };
     multimeter = {};
     mysql = {
-      buildInputs = stdenv.lib.optionals (libmysqlclient != null) [
+      buildInputs = lib.optionals (libmysqlclient != null) [
         libmysqlclient
       ];
     };
@@ -176,7 +176,7 @@ let
     netlink = {
       buildInputs = [
         libpcap
-      ] ++ stdenv.lib.optionals stdenv.isLinux [
+      ] ++ lib.optionals stdenv.isLinux [
         libmnl
       ];
     };
@@ -236,20 +236,20 @@ let
       buildInputs = [ rrdtool libxml2 ];
     };
     sensors = {
-      buildInputs = stdenv.lib.optionals stdenv.isLinux [ lm_sensors ];
+      buildInputs = lib.optionals stdenv.isLinux [ lm_sensors ];
     };
     serial = {};
     sigrok = {
-      buildInputs = stdenv.lib.optionals stdenv.isLinux [ libsigrok udev ];
+      buildInputs = lib.optionals stdenv.isLinux [ libsigrok udev ];
     };
     smart = {
-      buildInputs = stdenv.lib.optionals stdenv.isLinux [ libatasmart udev ];
+      buildInputs = lib.optionals stdenv.isLinux [ libatasmart udev ];
     };
     snmp = {
-      buildInputs = stdenv.lib.optionals stdenv.isLinux [ net-snmp ];
+      buildInputs = lib.optionals stdenv.isLinux [ net-snmp ];
     };
     snmp_agent = {
-      buildInputs = stdenv.lib.optionals stdenv.isLinux [ net-snmp ];
+      buildInputs = lib.optionals stdenv.isLinux [ net-snmp ];
     };
     statsd = {};
     swap = {};
@@ -280,7 +280,7 @@ let
     };
     virt = {
       buildInputs = [ libvirt libxml2 yajl ] ++
-        stdenv.lib.optionals stdenv.isLinux [ lvm2 udev
+        lib.optionals stdenv.isLinux [ lvm2 udev
           # those might be no longer required when https://github.com/NixOS/nixpkgs/pull/51767
           # is merged
           libapparmor numactl libcap_ng
diff --git a/pkgs/tools/system/dfc/default.nix b/pkgs/tools/system/dfc/default.nix
index 415b647befa..6478e699539 100644
--- a/pkgs/tools/system/dfc/default.nix
+++ b/pkgs/tools/system/dfc/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, cmake, gettext}:
+{lib, stdenv, fetchurl, cmake, gettext}:
 
 stdenv.mkDerivation rec {
   pname = "dfc";
@@ -14,8 +14,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://projects.gw-computing.net/projects/dfc";
     description = "Displays file system space usage using graphs and colors";
-    license = stdenv.lib.licenses.bsd3;
-    maintainers = with stdenv.lib.maintainers; [qknight];
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.bsd3;
+    maintainers = with lib.maintainers; [qknight];
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/tools/system/facter/default.nix b/pkgs/tools/system/facter/default.nix
index a67b975ec92..2f2d35ef1e7 100644
--- a/pkgs/tools/system/facter/default.nix
+++ b/pkgs/tools/system/facter/default.nix
@@ -11,8 +11,8 @@ stdenv.mkDerivation rec {
     owner = "puppetlabs";
   };
 
-  CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isGNU "-fpermissive -Wno-error=catch-value";
-  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lblkid";
+  CXXFLAGS = lib.optionalString stdenv.cc.isGNU "-fpermissive -Wno-error=catch-value";
+  NIX_LDFLAGS = lib.optionalString stdenv.isLinux "-lblkid";
 
   cmakeFlags = [
     "-DFACTER_RUBY=${ruby}/lib/libruby${stdenv.hostPlatform.extensions.sharedLibrary}"
diff --git a/pkgs/tools/system/fakeroot/default.nix b/pkgs/tools/system/fakeroot/default.nix
index c5765609a27..57a986e3da9 100644
--- a/pkgs/tools/system/fakeroot/default.nix
+++ b/pkgs/tools/system/fakeroot/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, getopt, libcap, gnused }:
+{ lib, stdenv, fetchurl, fetchpatch, getopt, libcap, gnused }:
 
 stdenv.mkDerivation rec {
   version = "1.23";
@@ -9,9 +9,9 @@ stdenv.mkDerivation rec {
     sha256 = "1xpl0s2yjyjwlf832b6kbkaa5921liybaar13k7n45ckd9lxd700";
   };
 
-  patches = stdenv.lib.optional stdenv.isLinux ./einval.patch
+  patches = lib.optional stdenv.isLinux ./einval.patch
   # patchset from brew
-  ++ stdenv.lib.optionals stdenv.isDarwin [
+  ++ lib.optionals stdenv.isDarwin [
     (fetchpatch {
       name = "0001-Implement-openat-2-wrapper-which-handles-optional-ar.patch";
       url = "https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=0001-Implement-openat-2-wrapper-which-handles-optional-ar.patch;att=1;bug=766649";
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
   ];
 
   buildInputs = [ getopt gnused ]
-    ++ stdenv.lib.optional (!stdenv.isDarwin) libcap
+    ++ lib.optional (!stdenv.isDarwin) libcap
     ;
 
   postUnpack = ''
@@ -40,9 +40,9 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://salsa.debian.org/clint/fakeroot";
     description = "Give a fake root environment through LD_PRELOAD";
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
+    maintainers = with lib.maintainers; [viric];
+    platforms = lib.platforms.unix;
   };
 
 }
diff --git a/pkgs/tools/system/fcron/default.nix b/pkgs/tools/system/fcron/default.nix
index d6f764b9ea6..9e3b3c2c16d 100644
--- a/pkgs/tools/system/fcron/default.nix
+++ b/pkgs/tools/system/fcron/default.nix
@@ -56,6 +56,6 @@ stdenv.mkDerivation rec {
     description="A command scheduler with extended capabilities over cron and anacron";
     homepage = "http://fcron.free.fr";
     license = licenses.gpl2;
-    platforms = stdenv.lib.platforms.all;
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/tools/system/fdisk/default.nix b/pkgs/tools/system/fdisk/default.nix
index 423b00bd543..4ad654783df 100644
--- a/pkgs/tools/system/fdisk/default.nix
+++ b/pkgs/tools/system/fdisk/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, parted, libuuid, gettext, guile }:
+{ fetchurl, lib, stdenv, parted, libuuid, gettext, guile }:
 
 stdenv.mkDerivation rec {
   name = "gnufdisk-2.0.0a"; # .0a1 seems broken, see https://lists.gnu.org/archive/html/bug-fdisk/2012-09/msg00000.html
@@ -20,10 +20,10 @@ stdenv.mkDerivation rec {
       cfdisk.  It uses GNU Parted.
     '';
 
-    license = stdenv.lib.licenses.gpl3Plus;
+    license = lib.licenses.gpl3Plus;
 
     homepage = "https://www.gnu.org/software/fdisk/";
 
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/tools/system/fio/default.nix b/pkgs/tools/system/fio/default.nix
index 6efa107ef32..a71bef4809c 100644
--- a/pkgs/tools/system/fio/default.nix
+++ b/pkgs/tools/system/fio/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ python zlib ]
-    ++ stdenv.lib.optional (!stdenv.isDarwin) libaio;
+    ++ lib.optional (!stdenv.isDarwin) libaio;
 
   nativeBuildInputs = [ makeWrapper ];
 
@@ -27,9 +27,9 @@ stdenv.mkDerivation rec {
     substituteInPlace tools/plot/fio2gnuplot --replace /usr/share/fio $out/share/fio
   '';
 
-  postInstall = stdenv.lib.optionalString withGnuplot ''
+  postInstall = lib.optionalString withGnuplot ''
     wrapProgram $out/bin/fio2gnuplot \
-      --prefix PATH : ${stdenv.lib.makeBinPath [ gnuplot ]}
+      --prefix PATH : ${lib.makeBinPath [ gnuplot ]}
   '';
 
   meta = with lib; {
diff --git a/pkgs/tools/system/freeipmi/default.nix b/pkgs/tools/system/freeipmi/default.nix
index 76654d14539..610dfe0a646 100644
--- a/pkgs/tools/system/freeipmi/default.nix
+++ b/pkgs/tools/system/freeipmi/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, libgcrypt, readline, libgpgerror }:
+{ fetchurl, lib, stdenv, libgcrypt, readline, libgpgerror }:
 
 stdenv.mkDerivation rec {
   version = "1.6.6";
@@ -33,10 +33,10 @@ stdenv.mkDerivation rec {
     homepage = "https://www.gnu.org/software/freeipmi/";
     downloadPage = "https://www.gnu.org/software/freeipmi/download.html";
 
-    license = stdenv.lib.licenses.gpl3Plus;
+    license = lib.licenses.gpl3Plus;
 
-    maintainers = with stdenv.lib.maintainers; [ raskin ];
-    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
+    maintainers = with lib.maintainers; [ raskin ];
+    platforms = lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
 
     updateWalker = true;
     inherit version;
diff --git a/pkgs/tools/system/gptfdisk/default.nix b/pkgs/tools/system/gptfdisk/default.nix
index 5e2f047674e..b5f7c369dfd 100644
--- a/pkgs/tools/system/gptfdisk/default.nix
+++ b/pkgs/tools/system/gptfdisk/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   postPatch = ''
     patchShebangs gdisk_test.sh
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     substituteInPlace Makefile.mac --replace \
       "-mmacosx-version-min=10.4" "-mmacosx-version-min=10.6"
     substituteInPlace Makefile.mac --replace \
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
       "/opt/local/lib/libncurses.a" "${ncurses.out}/lib/libncurses.dylib"
   '';
 
-  buildPhase = stdenv.lib.optionalString stdenv.isDarwin "make -f Makefile.mac";
+  buildPhase = lib.optionalString stdenv.isDarwin "make -f Makefile.mac";
   buildInputs = [ libuuid popt icu ncurses ];
 
   installPhase = ''
diff --git a/pkgs/tools/system/gt5/default.nix b/pkgs/tools/system/gt5/default.nix
index 61d25f414bb..3e904e6c0ad 100644
--- a/pkgs/tools/system/gt5/default.nix
+++ b/pkgs/tools/system/gt5/default.nix
@@ -1,8 +1,8 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   name = "gt5-1.4.0";
-  
+
   src = fetchurl {
     url = "mirror://sourceforge/gt5/${name}.tar.gz";
     sha256 = "0gm0gzyp4d9rxqddbaskbz5zvmlhyr4nyb5x9g7x4abyyxqjlnkq";
@@ -19,8 +19,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A diff-capable 'du' browser";
     homepage = "http://gt5.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.gpl2Plus;
+    maintainers = with lib.maintainers; [viric];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/tools/system/idle3tools/default.nix b/pkgs/tools/system/idle3tools/default.nix
index fa5234d8cbc..5e9796396a9 100644
--- a/pkgs/tools/system/idle3tools/default.nix
+++ b/pkgs/tools/system/idle3tools/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation {
   name = "idle3-tools-0.9.1";
@@ -15,8 +15,8 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://idle3-tools.sourceforge.net/";
     description = "Tool to get/set the infamous idle3 timer in WD HDDs";
-    license = stdenv.lib.licenses.gpl3;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.gpl3;
+    maintainers = with lib.maintainers; [viric];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/tools/system/illum/default.nix b/pkgs/tools/system/illum/default.nix
index 41fce9b9b91..1f35c0766d9 100644
--- a/pkgs/tools/system/illum/default.nix
+++ b/pkgs/tools/system/illum/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, pkgconfig, ninja, libevdev, libev }:
+{ lib, stdenv, fetchgit, pkgconfig, ninja, libevdev, libev }:
 
 stdenv.mkDerivation {
   version = "0.4";
@@ -26,8 +26,8 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://github.com/jmesmon/illum";
     description = "Daemon that wires button presses to screen backlight level";
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.dancek ];
-    license = stdenv.lib.licenses.agpl3;
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.dancek ];
+    license = lib.licenses.agpl3;
   };
 }
diff --git a/pkgs/tools/system/inxi/default.nix b/pkgs/tools/system/inxi/default.nix
index 6b732a92ebb..1ef871c9d30 100644
--- a/pkgs/tools/system/inxi/default.nix
+++ b/pkgs/tools/system/inxi/default.nix
@@ -9,7 +9,7 @@
 
 let
   prefixPath = programs:
-    "--prefix PATH ':' '${stdenv.lib.makeBinPath programs}'";
+    "--prefix PATH ':' '${lib.makeBinPath programs}'";
   recommendedSystemPrograms = lib.optionals withRecommendedSystemPrograms [
     util-linuxMinimal dmidecode file hddtemp iproute ipmitool usbutils kmod
     lm_sensors smartmontools binutils tree upower pciutils
diff --git a/pkgs/tools/system/ipmitool/default.nix b/pkgs/tools/system/ipmitool/default.nix
index 196e59953fe..1d315004018 100644
--- a/pkgs/tools/system/ipmitool/default.nix
+++ b/pkgs/tools/system/ipmitool/default.nix
@@ -29,15 +29,15 @@ stdenv.mkDerivation {
   configureFlags = [
     "--infodir=${placeholder "out"}/share/info"
     "--mandir=${placeholder "out"}/share/man"
-  ] ++ stdenv.lib.optionals static [
+  ] ++ lib.optionals static [
     "LDFLAGS=-static"
     "--enable-static"
     "--disable-shared"
-  ] ++ stdenv.lib.optionals (!static) [
+  ] ++ lib.optionals (!static) [
     "--enable-shared"
   ];
 
-  makeFlags = stdenv.lib.optional static "AM_LDFLAGS=-all-static";
+  makeFlags = lib.optional static "AM_LDFLAGS=-all-static";
   dontDisableStatic = static;
 
   meta = with lib; {
diff --git a/pkgs/tools/system/ledmon/default.nix b/pkgs/tools/system/ledmon/default.nix
index ee9ba6c7346..0ca1aa441db 100644
--- a/pkgs/tools/system/ledmon/default.nix
+++ b/pkgs/tools/system/ledmon/default.nix
@@ -30,6 +30,6 @@ stdenv.mkDerivation rec {
     description = "Enclosure LED Utilities";
     platforms = platforms.linux;
     license = with licenses; [ gpl2 ];
-    maintainers = with stdenv.lib.maintainers; [ sorki ];
+    maintainers = with lib.maintainers; [ sorki ];
   };
 }
diff --git a/pkgs/tools/system/logrotate/default.nix b/pkgs/tools/system/logrotate/default.nix
index 4c891e3e5b3..513b48c6630 100644
--- a/pkgs/tools/system/logrotate/default.nix
+++ b/pkgs/tools/system/logrotate/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, gzip, popt, autoreconfHook
+{ lib, stdenv, fetchFromGitHub, gzip, popt, autoreconfHook
 , mailutils ? null
 }:
 
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     sed -i -e 's,[a-z/]\+gzip,${gzip}/bin/gzip,' \
            -e 's,[a-z/]\+gunzip,${gzip}/bin/gunzip,' configure.ac
 
-    ${stdenv.lib.optionalString (mailutils != null) ''
+    ${lib.optionalString (mailutils != null) ''
     sed -i -e 's,[a-z/]\+mail,${mailutils}/bin/mail,' configure.ac
     ''}
   '';
@@ -33,8 +33,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://fedorahosted.org/releases/l/o/logrotate/";
     description = "Rotates and compresses system logs";
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = [ stdenv.lib.maintainers.viric ];
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.gpl2Plus;
+    maintainers = [ lib.maintainers.viric ];
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/tools/system/mcron/default.nix b/pkgs/tools/system/mcron/default.nix
index ca515cbdfd8..b8175b51483 100644
--- a/pkgs/tools/system/mcron/default.nix
+++ b/pkgs/tools/system/mcron/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, guile, which, ed, libtool }:
+{ fetchurl, lib, stdenv, guile, which, ed, libtool }:
 
 stdenv.mkDerivation rec {
   name = "mcron-1.0.6";
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
 
     homepage = "https://www.gnu.org/software/mcron/";
 
-    license = stdenv.lib.licenses.gpl3Plus;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl3Plus;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/tools/system/monit/default.nix b/pkgs/tools/system/monit/default.nix
index 3349749d62e..29536a59546 100644
--- a/pkgs/tools/system/monit/default.nix
+++ b/pkgs/tools/system/monit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl, bison, flex
 , zlib
 , usePAM ? stdenv.hostPlatform.isLinux, pam
@@ -15,17 +15,17 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ bison flex ];
   buildInputs = [ zlib.dev ] ++
-    stdenv.lib.optionals useSSL [ openssl ] ++
-    stdenv.lib.optionals usePAM [ pam ];
+    lib.optionals useSSL [ openssl ] ++
+    lib.optionals usePAM [ pam ];
 
   configureFlags = [
-    (stdenv.lib.withFeature usePAM "pam")
+    (lib.withFeature usePAM "pam")
   ] ++ (if useSSL then [
       "--with-ssl-incl-dir=${openssl.dev}/include"
       "--with-ssl-lib-dir=${openssl.out}/lib"
     ] else [
       "--without-ssl"
-  ]) ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ]) ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     # will need to check both these are true for musl
     "libmonit_cv_setjmp_available=yes"
     "libmonit_cv_vsnprintf_c99_conformant=yes"
@@ -34,8 +34,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://mmonit.com/monit/";
     description = "Monitoring system";
-    license = stdenv.lib.licenses.agpl3;
-    maintainers = with stdenv.lib.maintainers; [ raskin wmertens ];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.agpl3;
+    maintainers = with lib.maintainers; [ raskin wmertens ];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/tools/system/netdata/default.nix b/pkgs/tools/system/netdata/default.nix
index 3c1fe75b581..7c528335344 100644
--- a/pkgs/tools/system/netdata/default.nix
+++ b/pkgs/tools/system/netdata/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, callPackage, fetchFromGitHub, autoreconfHook, pkgconfig
+{ lib, stdenv, callPackage, fetchFromGitHub, autoreconfHook, pkgconfig
 , CoreFoundation, IOKit, libossp_uuid
 , curl, libcap,  libuuid, lm_sensors, zlib, fetchpatch
 , nixosTests
@@ -10,7 +10,7 @@
 , withDebug ? false
 }:
 
-with stdenv.lib;
+with lib;
 
 let
   go-d-plugin = callPackage ./go.d.plugin.nix {};
diff --git a/pkgs/tools/system/pciutils/default.nix b/pkgs/tools/system/pciutils/default.nix
index 226f55f00dc..cd8e41c8256 100644
--- a/pkgs/tools/system/pciutils/default.nix
+++ b/pkgs/tools/system/pciutils/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ zlib kmod which ] ++
-    stdenv.lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.IOKit;
+    lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.IOKit;
 
   preConfigure = if stdenv.cc.isGNU then null else ''
     substituteInPlace Makefile --replace 'CC=$(CROSS_COMPILE)gcc' ""
diff --git a/pkgs/tools/system/plan9port/default.nix b/pkgs/tools/system/plan9port/default.nix
index c7c2ff60a7d..2b0df3c893e 100644
--- a/pkgs/tools/system/plan9port/default.nix
+++ b/pkgs/tools/system/plan9port/default.nix
@@ -37,7 +37,7 @@ stdenv.mkDerivation {
 
     substituteInPlace bin/9c \
       --replace 'which uniq' '${which}/bin/which uniq'
-  '' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
+  '' + lib.optionalString (!stdenv.isDarwin) ''
     #add missing ctrl+c\z\x\v keybind for non-Darwin
     substituteInPlace src/cmd/acme/text.c \
       --replace "case Kcmd+'c':" "case 0x03: case Kcmd+'c':" \
@@ -48,10 +48,10 @@ stdenv.mkDerivation {
 
   buildInputs = [
     perl
-  ] ++ stdenv.lib.optionals (!stdenv.isDarwin) [
+  ] ++ lib.optionals (!stdenv.isDarwin) [
     xorgproto libX11 libXext libXt fontconfig
     freetype # fontsrv wants ft2build.h provides system fonts for acme and sam.
-  ] ++ stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+  ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
     Carbon Cocoa IOKit Metal QuartzCore
   ]);
 
diff --git a/pkgs/tools/system/proot/default.nix b/pkgs/tools/system/proot/default.nix
index e1871eeb733..daf543d7f75 100644
--- a/pkgs/tools/system/proot/default.nix
+++ b/pkgs/tools/system/proot/default.nix
@@ -19,8 +19,8 @@ stdenv.mkDerivation {
     sed -i /CROSS_COMPILE/d src/GNUmakefile
   '';
 
-  buildInputs = [ talloc ] ++ stdenv.lib.optional enablePython python;
-  nativeBuildInputs = [ docutils ] ++ stdenv.lib.optional enablePython swig;
+  buildInputs = [ talloc ] ++ lib.optional enablePython python;
+  nativeBuildInputs = [ docutils ] ++ lib.optional enablePython swig;
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/tools/system/rofi-systemd/default.nix b/pkgs/tools/system/rofi-systemd/default.nix
index 5078adbf3b7..4a2e14edc91 100644
--- a/pkgs/tools/system/rofi-systemd/default.nix
+++ b/pkgs/tools/system/rofi-systemd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, rofi, systemd, coreutils, util-linux, gawk, makeWrapper, jq
+{ lib, stdenv, fetchFromGitHub, rofi, systemd, coreutils, util-linux, gawk, makeWrapper, jq
 }:
 
 stdenv.mkDerivation rec {
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     cp -a rofi-systemd $out/bin/rofi-systemd
   '';
 
-  wrapperPath = with stdenv.lib; makeBinPath [
+  wrapperPath = with lib; makeBinPath [
     coreutils
     gawk
     jq
@@ -39,8 +39,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Control your systemd units using rofi";
     homepage = "https://github.com/IvanMalison/rofi-systemd";
-    maintainers = with stdenv.lib.maintainers; [ imalison ];
-    license = stdenv.lib.licenses.gpl3;
-    platforms = with stdenv.lib.platforms; linux;
+    maintainers = with lib.maintainers; [ imalison ];
+    license = lib.licenses.gpl3;
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/tools/system/rowhammer-test/default.nix b/pkgs/tools/system/rowhammer-test/default.nix
index e2d736477ee..9afb1933e17 100644
--- a/pkgs/tools/system/rowhammer-test/default.nix
+++ b/pkgs/tools/system/rowhammer-test/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
     sha256 = "1fbfcnm5gjish47wdvikcsgzlb5vnlfqlzzm6mwiw2j5qkq0914i";
   };
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isi686 "-Wno-error=format";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isi686 "-Wno-error=format";
 
   buildPhase = "sh -e make.sh";
 
diff --git a/pkgs/tools/system/rsyslog/default.nix b/pkgs/tools/system/rsyslog/default.nix
index 7be7e5b3d37..0794f92bf12 100644
--- a/pkgs/tools/system/rsyslog/default.nix
+++ b/pkgs/tools/system/rsyslog/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, autoreconfHook, libestr, json_c, zlib, pythonPackages, fastJson
+{ lib, stdenv, fetchurl, pkgconfig, autoreconfHook, libestr, json_c, zlib, pythonPackages, fastJson
 , libkrb5 ? null, systemd ? null, jemalloc ? null, libmysqlclient ? null, postgresql ? null
 , libdbi ? null, net-snmp ? null, libuuid ? null, curl ? null, gnutls ? null
 , libgcrypt ? null, liblognorm ? null, openssl ? null, librelp ? null, libksi ? null
@@ -8,7 +8,7 @@
 , nixosTests ? null
 }:
 
-with stdenv.lib;
+with lib;
 let
   mkFlag = cond: name: if cond then "--enable-${name}" else "--disable-${name}";
 in
@@ -29,8 +29,8 @@ stdenv.mkDerivation rec {
     postgresql libdbi net-snmp libuuid curl gnutls libgcrypt liblognorm openssl
     librelp libksi liblogging libnet hadoop rdkafka libmongo-client czmq
     rabbitmq-c hiredis mongoc libmaxminddb
-  ] ++ stdenv.lib.optional (libmysqlclient != null) libmysqlclient
-    ++ stdenv.lib.optional stdenv.isLinux systemd;
+  ] ++ lib.optional (libmysqlclient != null) libmysqlclient
+    ++ lib.optional stdenv.isLinux systemd;
 
   configureFlags = [
     "--sysconfdir=/etc"
diff --git a/pkgs/tools/system/runit/default.nix b/pkgs/tools/system/runit/default.nix
index 977550837df..2553c07cd6b 100644
--- a/pkgs/tools/system/runit/default.nix
+++ b/pkgs/tools/system/runit/default.nix
@@ -23,15 +23,15 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  buildInputs = stdenv.lib.optionals static [ stdenv.cc.libc stdenv.cc.libc.static ] ++
-    stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.libs.utmp;
+  buildInputs = lib.optionals static [ stdenv.cc.libc stdenv.cc.libc.static ] ++
+    lib.optional stdenv.isDarwin darwin.apple_sdk.libs.utmp;
 
   postPatch = ''
     sed -i "s,\(#define RUNIT\) .*,\1 \"$out/bin/runit\"," src/runit.h
     # usernamespace sandbox of nix seems to conflict with runit's assumptions
     # about unix users. Therefor skip the check
     sed -i '/.\/chkshsgr/d' src/Makefile
-  '' + stdenv.lib.optionalString (!static) ''
+  '' + lib.optionalString (!static) ''
     sed -i 's,-static,,g' src/Makefile
   '';
 
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
 
     # Both of these are originally hard-coded to gcc
     echo ${stdenv.cc.targetPrefix}cc > conf-cc
-    echo ${stdenv.cc.targetPrefix}cc ${stdenv.lib.optionalString stdenv.isDarwin "-Xlinker -x "}> conf-ld
+    echo ${stdenv.cc.targetPrefix}cc ${lib.optionalString stdenv.isDarwin "-Xlinker -x "}> conf-ld
   '';
 
   installPhase = ''
diff --git a/pkgs/tools/system/s6-rc/default.nix b/pkgs/tools/system/s6-rc/default.nix
index 328dd3242d8..8b17ea583f2 100644
--- a/pkgs/tools/system/s6-rc/default.nix
+++ b/pkgs/tools/system/s6-rc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, skawarePackages }:
+{ lib, stdenv, skawarePackages }:
 
 with skawarePackages;
 
@@ -8,7 +8,7 @@ buildPackage {
   sha256 = "1qpygkajalaziszhwfv5rr6hc27q05z8dayyv7im06z6vndimchs";
 
   description = "A service manager for s6-based systems";
-  platforms = stdenv.lib.platforms.linux;
+  platforms = lib.platforms.linux;
 
   outputs = [ "bin" "lib" "dev" "doc" "out" ];
 
diff --git a/pkgs/tools/system/safecopy/default.nix b/pkgs/tools/system/safecopy/default.nix
index e8db6a2fd39..5533c9a57ff 100644
--- a/pkgs/tools/system/safecopy/default.nix
+++ b/pkgs/tools/system/safecopy/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "safecopy-1.7";
@@ -22,9 +22,9 @@ stdenv.mkDerivation rec {
 
     homepage = "http://safecopy.sourceforge.net";
 
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
 
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.bluescreen303 ];
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.bluescreen303 ];
   };
 }
diff --git a/pkgs/tools/system/setserial/default.nix b/pkgs/tools/system/setserial/default.nix
index 68ea32e1e8a..da5d3b2a0d1 100644
--- a/pkgs/tools/system/setserial/default.nix
+++ b/pkgs/tools/system/setserial/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, groff }:
+{ lib, stdenv, fetchurl, groff }:
 
 stdenv.mkDerivation rec {
   pname = "setserial";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "Serial port configuration utility";
-    platforms = stdenv.lib.platforms.linux;
-    license = stdenv.lib.licenses.gpl2;
+    platforms = lib.platforms.linux;
+    license = lib.licenses.gpl2;
   };
 }
diff --git a/pkgs/tools/system/sleuthkit/default.nix b/pkgs/tools/system/sleuthkit/default.nix
index 8dbc28d3a31..ae4ee9efa6e 100644
--- a/pkgs/tools/system/sleuthkit/default.nix
+++ b/pkgs/tools/system/sleuthkit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, libewf, afflib, openssl, zlib }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, libewf, afflib, openssl, zlib }:
 
 stdenv.mkDerivation rec {
   version = "4.6.5";
@@ -26,9 +26,9 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A forensic/data recovery tool";
     homepage = "https://www.sleuthkit.org/";
-    maintainers = [ stdenv.lib.maintainers.raskin ];
-    platforms = stdenv.lib.platforms.linux;
-    license = stdenv.lib.licenses.ipl10;
+    maintainers = [ lib.maintainers.raskin ];
+    platforms = lib.platforms.linux;
+    license = lib.licenses.ipl10;
     inherit version;
   };
 }
diff --git a/pkgs/tools/system/smartmontools/default.nix b/pkgs/tools/system/smartmontools/default.nix
index 093fd7b5bd5..e21fbcfd700 100644
--- a/pkgs/tools/system/smartmontools/default.nix
+++ b/pkgs/tools/system/smartmontools/default.nix
@@ -26,11 +26,11 @@ in stdenv.mkDerivation rec {
   postPatch = "cp -v ${driverdb} drivedb.h";
 
   configureFlags = [
-    "--with-scriptpath=${stdenv.lib.makeBinPath [ mailutils inetutils ]}"
+    "--with-scriptpath=${lib.makeBinPath [ mailutils inetutils ]}"
   ];
 
   nativeBuildInputs = [ autoreconfHook ];
-  buildInputs = [] ++ stdenv.lib.optionals stdenv.isDarwin [IOKit ApplicationServices];
+  buildInputs = [] ++ lib.optionals stdenv.isDarwin [IOKit ApplicationServices];
   enableParallelBuilding = true;
 
   meta = with lib; {
diff --git a/pkgs/tools/system/socklog/default.nix b/pkgs/tools/system/socklog/default.nix
index cf7fbe5e9a1..a235ea09d35 100644
--- a/pkgs/tools/system/socklog/default.nix
+++ b/pkgs/tools/system/socklog/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "socklog";
diff --git a/pkgs/tools/system/stress-ng/default.nix b/pkgs/tools/system/stress-ng/default.nix
index f033b038267..6eae792fa4d 100644
--- a/pkgs/tools/system/stress-ng/default.nix
+++ b/pkgs/tools/system/stress-ng/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   # All platforms inputs then Linux-only ones
   buildInputs = [ judy libbsd libgcrypt zlib ]
-    ++ stdenv.lib.optionals stdenv.hostPlatform.isLinux [
+    ++ lib.optionals stdenv.hostPlatform.isLinux [
       attr keyutils libaio libapparmor libcap lksctp-tools
     ];
 
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     "BASHDIR=${placeholder "out"}/share/bash-completion/completions"
   ];
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.hostPlatform.isMusl "-D_LINUX_SYSINFO_H=1";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isMusl "-D_LINUX_SYSINFO_H=1";
 
   # Won't build on i686 because the binary will be linked again in the
   # install phase without checking the dependencies. This will prevent
diff --git a/pkgs/tools/system/supervise/default.nix b/pkgs/tools/system/supervise/default.nix
index 2776d28fa38..3d69faf7bd4 100644
--- a/pkgs/tools/system/supervise/default.nix
+++ b/pkgs/tools/system/supervise/default.nix
@@ -15,6 +15,6 @@ stdenv.mkDerivation rec {
     description = "A minimal unprivileged process supervisor making use of modern Linux features";
     platforms = platforms.linux;
     license = licenses.gpl3;
-    maintainers = with stdenv.lib.maintainers; [ catern ];
+    maintainers = with lib.maintainers; [ catern ];
   };
 }
diff --git a/pkgs/tools/system/testdisk/default.nix b/pkgs/tools/system/testdisk/default.nix
index 032b2061744..f76180638a3 100644
--- a/pkgs/tools/system/testdisk/default.nix
+++ b/pkgs/tools/system/testdisk/default.nix
@@ -35,9 +35,9 @@ assert enableQt -> qwt != null;
     zlib
     libewf
   ]
-  ++ stdenv.lib.optional enableNtfs ntfs3g
-  ++ stdenv.lib.optional enableExtFs e2fsprogs
-  ++ stdenv.lib.optionals enableQt [ qtbase qttools qwt ];
+  ++ lib.optional enableNtfs ntfs3g
+  ++ lib.optional enableExtFs e2fsprogs
+  ++ lib.optionals enableQt [ qtbase qttools qwt ];
 
   nativeBuildInputs = [ pkgconfig ];
 
@@ -61,8 +61,8 @@ assert enableQt -> qwt != null;
       it will still work even if your media's file system has been severely
       damaged or reformatted.
     '';
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.all;
     maintainers = with maintainers; [ fgaz eelco ];
   };
 }
diff --git a/pkgs/tools/system/thinkfan/default.nix b/pkgs/tools/system/thinkfan/default.nix
index 48d5d5fc08b..14d6b90b77d 100644
--- a/pkgs/tools/system/thinkfan/default.nix
+++ b/pkgs/tools/system/thinkfan/default.nix
@@ -15,11 +15,11 @@ stdenv.mkDerivation rec {
   cmakeFlags = [
     "-DCMAKE_INSTALL_DOCDIR=share/doc/${pname}"
     "-DUSE_NVML=OFF"
-  ] ++ stdenv.lib.optional smartSupport "-DUSE_ATASMART=ON";
+  ] ++ lib.optional smartSupport "-DUSE_ATASMART=ON";
 
   nativeBuildInputs = [ cmake pkgconfig ];
 
-  buildInputs = [ libyamlcpp ] ++ stdenv.lib.optional smartSupport libatasmart;
+  buildInputs = [ libyamlcpp ] ++ lib.optional smartSupport libatasmart;
 
   installPhase = ''
     runHook preInstall
diff --git a/pkgs/tools/system/tree/default.nix b/pkgs/tools/system/tree/default.nix
index 24d11a9c0ee..dea7fd2e2b6 100644
--- a/pkgs/tools/system/tree/default.nix
+++ b/pkgs/tools/system/tree/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 let
   version = "1.8.0";
@@ -45,7 +45,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://mama.indstate.edu/users/ice/tree/";
     description = "Command to produce a depth indented directory listing";
-    license = stdenv.lib.licenses.gpl2;
+    license = lib.licenses.gpl2;
 
     longDescription = ''
       Tree is a recursive directory listing command that produces a
@@ -53,7 +53,7 @@ stdenv.mkDerivation {
       the LS_COLORS environment variable is set and output is to tty.
     '';
 
-    platforms = stdenv.lib.platforms.all;
-    maintainers = [stdenv.lib.maintainers.peti];
+    platforms = lib.platforms.all;
+    maintainers = [lib.maintainers.peti];
   };
 }
diff --git a/pkgs/tools/system/tuptime/default.nix b/pkgs/tools/system/tuptime/default.nix
index c0c0ef1b213..92878c5386b 100644
--- a/pkgs/tools/system/tuptime/default.nix
+++ b/pkgs/tools/system/tuptime/default.nix
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
 
   preFixup = ''
     wrapProgram $out/share/tuptime/db-tuptime-migrate-4.0-to-5.0.sh \
-      --prefix PATH : "${stdenv.lib.makeBinPath [ sqlite ]}"
+      --prefix PATH : "${lib.makeBinPath [ sqlite ]}"
   '';
 
   meta = with lib; {
diff --git a/pkgs/tools/system/undaemonize/default.nix b/pkgs/tools/system/undaemonize/default.nix
index e82ee18b831..45e7a8d6d62 100644
--- a/pkgs/tools/system/undaemonize/default.nix
+++ b/pkgs/tools/system/undaemonize/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation {
   name = "undaemonize-2017-07-11";
@@ -14,9 +14,9 @@ stdenv.mkDerivation {
   meta = {
     description = "Tiny helper utility to force programs which insist on daemonizing themselves to run in the foreground";
     homepage = "https://github.com/nickstenning/undaemonize";
-    license = stdenv.lib.licenses.mit;
-    maintainers = [ stdenv.lib.maintainers.canndrew ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.mit;
+    maintainers = [ lib.maintainers.canndrew ];
+    platforms = lib.platforms.linux;
   };
 }
 
diff --git a/pkgs/tools/system/zenith/default.nix b/pkgs/tools/system/zenith/default.nix
index d4ca083d0b1..3a7f8a55a12 100644
--- a/pkgs/tools/system/zenith/default.nix
+++ b/pkgs/tools/system/zenith/default.nix
@@ -13,7 +13,7 @@ rustPlatform.buildRustPackage rec {
 
   cargoSha256 = "16s7swv2sp15gry1j1pcyz29cspvafczaf4v02x4fd2jbn2y3f6r";
 
-  buildInputs = stdenv.lib.optionals stdenv.isDarwin [ IOKit ];
+  buildInputs = lib.optionals stdenv.isDarwin [ IOKit ];
 
   meta = with lib; {
     description = "Sort of like top or htop but with zoom-able charts, network, and disk usage";