summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/games/abbaye-des-morts/default.nix2
-rw-r--r--pkgs/games/adom/default.nix2
-rw-r--r--pkgs/games/alephone/default.nix2
-rw-r--r--pkgs/games/andyetitmoves/default.nix6
-rw-r--r--pkgs/games/arena/default.nix8
-rw-r--r--pkgs/games/arx-libertatis/default.nix4
-rw-r--r--pkgs/games/assaultcube/default.nix6
-rw-r--r--pkgs/games/astromenace/default.nix6
-rw-r--r--pkgs/games/azimuth/default.nix8
-rw-r--r--pkgs/games/ball-and-paddle/default.nix8
-rw-r--r--pkgs/games/beret/default.nix4
-rw-r--r--pkgs/games/bitsnbots/default.nix6
-rw-r--r--pkgs/games/blackshades/default.nix8
-rw-r--r--pkgs/games/blobby/default.nix4
-rw-r--r--pkgs/games/bsdgames/default.nix8
-rw-r--r--pkgs/games/cataclysm-dda/common.nix2
-rw-r--r--pkgs/games/chessdb/default.nix6
-rw-r--r--pkgs/games/chiaki/default.nix4
-rw-r--r--pkgs/games/chocolate-doom/default.nix10
-rw-r--r--pkgs/games/ckan/default.nix2
-rw-r--r--pkgs/games/cockatrice/default.nix8
-rw-r--r--pkgs/games/construo/default.nix10
-rw-r--r--pkgs/games/crack-attack/default.nix8
-rw-r--r--pkgs/games/crafty/default.nix8
-rw-r--r--pkgs/games/crispy-doom/default.nix8
-rw-r--r--pkgs/games/crrcsim/default.nix6
-rw-r--r--pkgs/games/cutemaze/default.nix2
-rw-r--r--pkgs/games/cuyo/default.nix12
-rw-r--r--pkgs/games/dhewm3/default.nix2
-rw-r--r--pkgs/games/domination/default.nix4
-rw-r--r--pkgs/games/eboard/default.nix4
-rw-r--r--pkgs/games/eduke32/default.nix2
-rw-r--r--pkgs/games/egoboo/default.nix8
-rw-r--r--pkgs/games/endgame-singularity/default.nix10
-rw-r--r--pkgs/games/enyo-doom/default.nix8
-rw-r--r--pkgs/games/eternity-engine/default.nix8
-rw-r--r--pkgs/games/extremetuxracer/default.nix8
-rw-r--r--pkgs/games/exult/default.nix10
-rw-r--r--pkgs/games/ezquake/default.nix2
-rw-r--r--pkgs/games/factorio/default.nix12
-rw-r--r--pkgs/games/factorio/mods.nix4
-rw-r--r--pkgs/games/factorio/utils.nix4
-rw-r--r--pkgs/games/fairymax/default.nix8
-rw-r--r--pkgs/games/flare/engine.nix2
-rw-r--r--pkgs/games/freecell-solver/default.nix4
-rw-r--r--pkgs/games/freeciv/default.nix2
-rw-r--r--pkgs/games/freedink/default.nix10
-rw-r--r--pkgs/games/freedroidrpg/default.nix4
-rw-r--r--pkgs/games/frozen-bubble/default.nix6
-rw-r--r--pkgs/games/fsg/default.nix6
-rw-r--r--pkgs/games/galaxis/default.nix4
-rw-r--r--pkgs/games/gargoyle/default.nix4
-rw-r--r--pkgs/games/gav/default.nix6
-rw-r--r--pkgs/games/gltron/default.nix8
-rw-r--r--pkgs/games/gmad/default.nix8
-rw-r--r--pkgs/games/gnubg/default.nix4
-rw-r--r--pkgs/games/gnuchess/default.nix8
-rw-r--r--pkgs/games/gnugo/default.nix6
-rw-r--r--pkgs/games/gogui/default.nix8
-rw-r--r--pkgs/games/gtetrinet/default.nix8
-rw-r--r--pkgs/games/gtypist/default.nix2
-rw-r--r--pkgs/games/hawkthorne/default.nix6
-rw-r--r--pkgs/games/icbm3d/default.nix6
-rw-r--r--pkgs/games/instead/default.nix4
-rw-r--r--pkgs/games/jumpnbump/default.nix4
-rw-r--r--pkgs/games/keeperrl/default.nix6
-rw-r--r--pkgs/games/kobodeluxe/default.nix6
-rw-r--r--pkgs/games/koboredux/default.nix4
-rw-r--r--pkgs/games/lbreakout2/default.nix2
-rw-r--r--pkgs/games/liquidwar/5.nix2
-rw-r--r--pkgs/games/lugaru/default.nix6
-rw-r--r--pkgs/games/macopix/default.nix6
-rw-r--r--pkgs/games/megaglest/default.nix4
-rw-r--r--pkgs/games/minecraft/default.nix8
-rw-r--r--pkgs/games/minetest/default.nix2
-rw-r--r--pkgs/games/moon-buggy/default.nix8
-rw-r--r--pkgs/games/multimc/default.nix2
-rw-r--r--pkgs/games/n2048/default.nix10
-rw-r--r--pkgs/games/naev/default.nix8
-rw-r--r--pkgs/games/nethack/default.nix2
-rw-r--r--pkgs/games/neverball/default.nix6
-rw-r--r--pkgs/games/nexuiz/default.nix8
-rw-r--r--pkgs/games/njam/default.nix6
-rw-r--r--pkgs/games/nudoku/default.nix2
-rw-r--r--pkgs/games/nxengine-evo/default.nix8
-rw-r--r--pkgs/games/odamex/default.nix8
-rw-r--r--pkgs/games/oilrush/default.nix10
-rw-r--r--pkgs/games/openarena/default.nix8
-rw-r--r--pkgs/games/openclonk/default.nix2
-rw-r--r--pkgs/games/openlierox/default.nix6
-rw-r--r--pkgs/games/openra/common.nix4
-rw-r--r--pkgs/games/openra/engine.nix4
-rw-r--r--pkgs/games/openra/mod.nix4
-rw-r--r--pkgs/games/openrw/default.nix2
-rw-r--r--pkgs/games/openspades/default.nix2
-rw-r--r--pkgs/games/openttd/default.nix10
-rw-r--r--pkgs/games/opentyrian/default.nix4
-rw-r--r--pkgs/games/openxcom/default.nix8
-rw-r--r--pkgs/games/papermc/default.nix8
-rw-r--r--pkgs/games/pingus/default.nix8
-rw-r--r--pkgs/games/planetaryannihilation/default.nix8
-rw-r--r--pkgs/games/pokerth/default.nix6
-rw-r--r--pkgs/games/pong3d/default.nix6
-rw-r--r--pkgs/games/prboom/default.nix12
-rw-r--r--pkgs/games/quake2/yquake2/wrapper.nix2
-rw-r--r--pkgs/games/quake3/wrapper/default.nix2
-rw-r--r--pkgs/games/quakespasm/default.nix6
-rw-r--r--pkgs/games/quantumminigolf/default.nix8
-rw-r--r--pkgs/games/r2mod_cli/default.nix2
-rw-r--r--pkgs/games/racer/default.nix6
-rw-r--r--pkgs/games/residualvm/default.nix12
-rw-r--r--pkgs/games/rftg/default.nix6
-rw-r--r--pkgs/games/rigsofrods/default.nix4
-rw-r--r--pkgs/games/rili/default.nix8
-rw-r--r--pkgs/games/robotfindskitten/default.nix4
-rw-r--r--pkgs/games/scid-vs-pc/default.nix4
-rw-r--r--pkgs/games/scid/default.nix4
-rw-r--r--pkgs/games/scrolls/default.nix6
-rw-r--r--pkgs/games/sil/default.nix18
-rw-r--r--pkgs/games/simutrans/default.nix4
-rw-r--r--pkgs/games/sm64ex/default.nix2
-rw-r--r--pkgs/games/soldat-unstable/default.nix6
-rw-r--r--pkgs/games/speed-dreams/default.nix8
-rw-r--r--pkgs/games/spring/default.nix6
-rw-r--r--pkgs/games/steam/steam.nix2
-rw-r--r--pkgs/games/tcl2048/default.nix8
-rw-r--r--pkgs/games/teetertorture/default.nix6
-rw-r--r--pkgs/games/teeworlds/default.nix6
-rw-r--r--pkgs/games/the-powder-toy/default.nix3
-rw-r--r--pkgs/games/tibia/default.nix9
-rw-r--r--pkgs/games/tinyfugue/default.nix4
-rw-r--r--pkgs/games/torcs/default.nix8
-rw-r--r--pkgs/games/trackballs/default.nix4
-rw-r--r--pkgs/games/trigger/default.nix8
-rw-r--r--pkgs/games/tuxpaint/default.nix10
-rw-r--r--pkgs/games/ue4/default.nix8
-rw-r--r--pkgs/games/ue4demos/default.nix8
-rw-r--r--pkgs/games/ufoai/default.nix10
-rw-r--r--pkgs/games/ultimatestunts/default.nix8
-rw-r--r--pkgs/games/ultrastardx/default.nix2
-rw-r--r--pkgs/games/uqm/3dovideo.nix4
-rw-r--r--pkgs/games/uqm/default.nix2
-rw-r--r--pkgs/games/vdrift/default.nix8
-rw-r--r--pkgs/games/vectoroids/default.nix6
-rw-r--r--pkgs/games/vessel/default.nix4
-rw-r--r--pkgs/games/vms-empire/default.nix6
-rw-r--r--pkgs/games/warzone2100/default.nix2
-rw-r--r--pkgs/games/wesnoth/default.nix2
-rw-r--r--pkgs/games/worldofgoo/default.nix4
-rw-r--r--pkgs/games/xboard/default.nix8
-rw-r--r--pkgs/games/xonotic/default.nix6
-rw-r--r--pkgs/games/xpilot/bloodspilot-client.nix8
-rw-r--r--pkgs/games/xskat/default.nix4
-rw-r--r--pkgs/games/xsnow/default.nix6
-rw-r--r--pkgs/games/xsok/default.nix10
-rw-r--r--pkgs/games/zandronum/fmod.nix2
-rw-r--r--pkgs/games/zandronum/sqlite.nix2
-rw-r--r--pkgs/games/zangband/default.nix4
-rw-r--r--pkgs/games/zod/default.nix4
159 files changed, 457 insertions, 465 deletions
diff --git a/pkgs/games/abbaye-des-morts/default.nix b/pkgs/games/abbaye-des-morts/default.nix
index 5e536d2b18d..3091c8feff2 100644
--- a/pkgs/games/abbaye-des-morts/default.nix
+++ b/pkgs/games/abbaye-des-morts/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "PREFIX=$(out)" "DESTDIR=" ];
 
-  preBuild = stdenv.lib.optionalString stdenv.cc.isClang
+  preBuild = lib.optionalString stdenv.cc.isClang
     ''
       substituteInPlace Makefile \
         --replace -fpredictive-commoning ""
diff --git a/pkgs/games/adom/default.nix b/pkgs/games/adom/default.nix
index c5ffe950983..dc4f1f47f7b 100644
--- a/pkgs/games/adom/default.nix
+++ b/pkgs/games/adom/default.nix
@@ -5,7 +5,7 @@ let
 
   inherit (xorg) libXext libX11;
 
-  lpath = "${stdenv.cc.cc.lib}/lib64:" + stdenv.lib.makeLibraryPath [
+  lpath = "${stdenv.cc.cc.lib}/lib64:" + lib.makeLibraryPath [
       zlib libmad libpng12 libcaca libXext libX11 libGLU libGL alsaLib libpulseaudio];
 
 in
diff --git a/pkgs/games/alephone/default.nix b/pkgs/games/alephone/default.nix
index 7691001edac..44202da16ea 100644
--- a/pkgs/games/alephone/default.nix
+++ b/pkgs/games/alephone/default.nix
@@ -93,7 +93,7 @@ in self // {
       '';
 
       meta = alephone.meta // {
-        license = stdenv.lib.licenses.free;
+        license = lib.licenses.free;
         hydraPlatforms = [ ];
       } // meta;
     });
diff --git a/pkgs/games/andyetitmoves/default.nix b/pkgs/games/andyetitmoves/default.nix
index 84c1f545a38..f939f5b2bac 100644
--- a/pkgs/games/andyetitmoves/default.nix
+++ b/pkgs/games/andyetitmoves/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libvorbis, libogg, libtheora, SDL, libXft, SDL_image, zlib, libX11, libpng, openal, runtimeShell, requireFile, commercialVersion ? false }:
+{ lib, stdenv, fetchurl, libvorbis, libogg, libtheora, SDL, libXft, SDL_image, zlib, libX11, libpng, openal, runtimeShell, requireFile, commercialVersion ? false }:
 
 let plainName = "andyetitmoves";
     version   = "1.2.2";
@@ -68,8 +68,8 @@ stdenv.mkDerivation {
 
     homepage = "http://www.andyetitmoves.net/";
 
-    license = stdenv.lib.licenses.unfree;
+    license = lib.licenses.unfree;
 
-    maintainers = with stdenv.lib.maintainers; [bluescreen303];
+    maintainers = with lib.maintainers; [bluescreen303];
   };
 }
diff --git a/pkgs/games/arena/default.nix b/pkgs/games/arena/default.nix
index beba98b6316..7320a405bb1 100644
--- a/pkgs/games/arena/default.nix
+++ b/pkgs/games/arena/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gtk2-x11, glib, pango, cairo, atk, gdk-pixbuf, libX11 }:
+{ lib, stdenv, fetchurl, gtk2-x11, glib, pango, cairo, atk, gdk-pixbuf, libX11 }:
 
 # Arena is free software in the sense of "free beer" but not as in "free
 # speech". We can install it as we please, but we cannot re-distribute it in
@@ -7,7 +7,7 @@
 
 let
 
-  inherit (stdenv.lib) makeLibraryPath;
+  inherit (lib) makeLibraryPath;
   libDir = "lib64";
 
 in
@@ -66,9 +66,9 @@ stdenv.mkDerivation rec {
       UCI protocol I, II. Furthermore, compatible to Chess960, DGT electronic
       chess board & DGT clocks and much more.
     '';
-    license = stdenv.lib.licenses.unfree;
+    license = lib.licenses.unfree;
     platforms = ["x86_64-linux"];
-    hydraPlatforms = stdenv.lib.platforms.none;
+    hydraPlatforms = lib.platforms.none;
   };
 
 }
diff --git a/pkgs/games/arx-libertatis/default.nix b/pkgs/games/arx-libertatis/default.nix
index b82ee2a3a99..945ebf7b785 100644
--- a/pkgs/games/arx-libertatis/default.nix
+++ b/pkgs/games/arx-libertatis/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, zlib, boost
+{ lib, stdenv, fetchFromGitHub, cmake, zlib, boost
 , openal, glm, freetype, libGLU, SDL2, epoxy
 , dejavu_fonts, inkscape, optipng, imagemagick
 , withCrashReporter ? !stdenv.isDarwin
@@ -8,7 +8,7 @@
 ,   gdb  ? null
 }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation {
   pname = "arx-libertatis";
diff --git a/pkgs/games/assaultcube/default.nix b/pkgs/games/assaultcube/default.nix
index 423130a5356..a3284bb3ab6 100644
--- a/pkgs/games/assaultcube/default.nix
+++ b/pkgs/games/assaultcube/default.nix
@@ -1,8 +1,8 @@
-{ fetchFromGitHub, stdenv, makeDesktopItem, openal, pkgconfig, libogg,
+{ fetchFromGitHub, lib, stdenv, makeDesktopItem, openal, pkgconfig, libogg,
   libvorbis, SDL, SDL_image, makeWrapper, zlib, file,
   client ? true, server ? true }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
 
@@ -67,6 +67,6 @@ stdenv.mkDerivation rec {
     homepage = "https://assault.cubers.net";
     maintainers = [ ];
     platforms = platforms.linux; # should work on darwin with a little effort.
-    license = stdenv.lib.licenses.zlib;
+    license = lib.licenses.zlib;
   };
 }
diff --git a/pkgs/games/astromenace/default.nix b/pkgs/games/astromenace/default.nix
index 1882f5a9b68..cbe2385ea12 100644
--- a/pkgs/games/astromenace/default.nix
+++ b/pkgs/games/astromenace/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, cmake, xlibsWrapper, libGLU, libGL, SDL, openal, freealut, libogg, libvorbis, runtimeShell }:
+{ fetchurl, lib, stdenv, cmake, xlibsWrapper, libGLU, libGL, SDL, openal, freealut, libogg, libvorbis, runtimeShell }:
 
 stdenv.mkDerivation rec {
   version = "1.3.2";
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Hardcore 3D space shooter with spaceship upgrade possibilities";
     homepage = "https://www.viewizard.com/";
-    license = stdenv.lib.licenses.gpl3;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl3;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/azimuth/default.nix b/pkgs/games/azimuth/default.nix
index 67bbd8558c3..dcc67533fac 100644
--- a/pkgs/games/azimuth/default.nix
+++ b/pkgs/games/azimuth/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, SDL, which, installTool ? false }:
+{ lib, stdenv, fetchFromGitHub, SDL, which, installTool ? false }:
 
 stdenv.mkDerivation rec {
   pname = "azimuth";
@@ -41,10 +41,10 @@ stdenv.mkDerivation rec {
       bosses to tangle with.
     '';
 
-    license = stdenv.lib.licenses.gpl3Plus;
+    license = lib.licenses.gpl3Plus;
     homepage = "https://mdsteele.games/azimuth/index.html";
-    maintainers = with stdenv.lib.maintainers; [ marius851000 ];
-    platforms = stdenv.lib.platforms.linux;
+    maintainers = with lib.maintainers; [ marius851000 ];
+    platforms = lib.platforms.linux;
   };
 
 }
diff --git a/pkgs/games/ball-and-paddle/default.nix b/pkgs/games/ball-and-paddle/default.nix
index 862905efd3b..7fe74dc47d9 100644
--- a/pkgs/games/ball-and-paddle/default.nix
+++ b/pkgs/games/ball-and-paddle/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, SDL, SDL_image, SDL_mixer, SDL_ttf, guile, gettext }:
+{ fetchurl, lib, stdenv, SDL, SDL_image, SDL_mixer, SDL_ttf, guile, gettext }:
 
 stdenv.mkDerivation rec {
   name = "ballandpaddle-0.8.1";
@@ -31,14 +31,14 @@ stdenv.mkDerivation rec {
       with Guile.  Follow the example level sets and the documentation.
     '';
 
-    license = stdenv.lib.licenses.gpl3Plus;
+    license = lib.licenses.gpl3Plus;
 
     homepage = "https://www.gnu.org/software/ballandpaddle/";
 
     maintainers = [ ];
 
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
 
-    hydraPlatforms = stdenv.lib.platforms.linux; # sdl-config times out on darwin
+    hydraPlatforms = lib.platforms.linux; # sdl-config times out on darwin
   };
 }
diff --git a/pkgs/games/beret/default.nix b/pkgs/games/beret/default.nix
index db9e6b96902..e59fc7eb274 100644
--- a/pkgs/games/beret/default.nix
+++ b/pkgs/games/beret/default.nix
@@ -6,8 +6,8 @@ stdenv.mkDerivation {
   buildInputs = [ SDL SDL_image SDL_ttf SDL_mixer ];
 
   NIX_CFLAGS_COMPILE = "-I${SDL.dev}/include/SDL";
-  NIX_CFLAGS_LINK = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
-  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin
+  NIX_CFLAGS_LINK = lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
+  NIX_LDFLAGS = lib.optionalString stdenv.isDarwin
     "-framework CoreFoundation -framework OpenGL -framework Cocoa";
 
   patches = [ ./use-home-dir.patch ];
diff --git a/pkgs/games/bitsnbots/default.nix b/pkgs/games/bitsnbots/default.nix
index 52286b32f90..a3bd399a5ff 100644
--- a/pkgs/games/bitsnbots/default.nix
+++ b/pkgs/games/bitsnbots/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL, lua, libGLU, libGL }:
+{ lib, stdenv, fetchurl, SDL, lua, libGLU, libGL }:
 
 stdenv.mkDerivation rec {
   name = "bitsnbots-20111230";
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Simple puzzle game with moving robots";
     homepage = "http://moikmellah.org/blog/?page_id=19";
-    license = stdenv.lib.licenses.gpl3Plus;
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.gpl3Plus;
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/games/blackshades/default.nix b/pkgs/games/blackshades/default.nix
index e47e430d84c..7fe4a6087f7 100644
--- a/pkgs/games/blackshades/default.nix
+++ b/pkgs/games/blackshades/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchsvn, SDL, libGLU, libGL, openal, libvorbis, freealut, SDL_image}:
+{lib, stdenv, fetchsvn, SDL, libGLU, libGL, openal, libvorbis, freealut, SDL_image}:
 
 stdenv.mkDerivation {
   name = "blackshades-svn-110";
@@ -27,8 +27,8 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://icculus.org/blackshades/";
     description = "Protect the VIP";
-    license = stdenv.lib.licenses.free;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.free;
+    maintainers = with lib.maintainers; [viric];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/games/blobby/default.nix b/pkgs/games/blobby/default.nix
index 98c31f4e9fe..afa0a22722a 100644
--- a/pkgs/games/blobby/default.nix
+++ b/pkgs/games/blobby/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL2, SDL2_image, libGLU, libGL, cmake, physfs, boost, zip, zlib, pkg-config }:
+{ lib, stdenv, fetchurl, SDL2, SDL2_image, libGLU, libGL, cmake, physfs, boost, zip, zlib, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "blobby-volley";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     chmod a+x "$out/bin/blobby"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = ''A blobby volleyball game'';
     license = licenses.bsd3;
     platforms = platforms.linux;
diff --git a/pkgs/games/bsdgames/default.nix b/pkgs/games/bsdgames/default.nix
index 41414a573a6..04a86c0b83c 100644
--- a/pkgs/games/bsdgames/default.nix
+++ b/pkgs/games/bsdgames/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ncurses, openssl, flex, bison, less, miscfiles }:
+{ lib, stdenv, fetchurl, ncurses, openssl, flex, bison, less, miscfiles }:
 
 stdenv.mkDerivation {
   name = "bsd-games-2.17";
@@ -60,8 +60,8 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://www.t2-project.org/packages/bsd-games.html";
     description = "Ports of all the games from NetBSD-current that are free";
-    license = stdenv.lib.licenses.free;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.free;
+    maintainers = with lib.maintainers; [viric];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/games/cataclysm-dda/common.nix b/pkgs/games/cataclysm-dda/common.nix
index c41b0df5a80..81df46d4314 100644
--- a/pkgs/games/cataclysm-dda/common.nix
+++ b/pkgs/games/cataclysm-dda/common.nix
@@ -5,7 +5,7 @@
 }:
 
 let
-  inherit (stdenv.lib) optionals optionalString;
+  inherit (lib) optionals optionalString;
 
   cursesDeps = [ gettext ncurses ]
     ++ optionals stdenv.isDarwin [ CoreFoundation ];
diff --git a/pkgs/games/chessdb/default.nix b/pkgs/games/chessdb/default.nix
index 76862c4bffe..656e4ab6add 100644
--- a/pkgs/games/chessdb/default.nix
+++ b/pkgs/games/chessdb/default.nix
@@ -1,8 +1,8 @@
-{ stdenv, fetchurl, tcl, tk, libX11, makeWrapper }:
+{ lib, stdenv, fetchurl, tcl, tk, libX11, makeWrapper }:
 
 stdenv.mkDerivation {
   name = "chessdb-3.6.19-beta-1";
-  
+
   src = fetchurl {
     url = "mirror://sourceforge/chessdb/ChessDB-3.6.19-beta-1.tar.gz";
     sha256 = "0brc3wln3bxp979iqj2w1zxpfd0pch8zzazhdmwf7acww4hrsz62";
@@ -25,6 +25,6 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://chessdb.sourceforge.net/";
     description = "A free chess database";
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/chiaki/default.nix b/pkgs/games/chiaki/default.nix
index e3a2560ac10..33abfe64465 100644
--- a/pkgs/games/chiaki/default.nix
+++ b/pkgs/games/chiaki/default.nix
@@ -43,10 +43,10 @@ mkDerivation rec {
     qtsvg
     protobuf
     SDL2
-  ] ++ stdenv.lib.optionals stdenv.isLinux [
+  ] ++ lib.optionals stdenv.isLinux [
     libevdev
     udev
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     qtmacextras
   ];
 
diff --git a/pkgs/games/chocolate-doom/default.nix b/pkgs/games/chocolate-doom/default.nix
index 1b77a72f8d0..2336bd5e016 100644
--- a/pkgs/games/chocolate-doom/default.nix
+++ b/pkgs/games/chocolate-doom/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, autoreconfHook, pkgconfig, SDL2, SDL2_mixer, SDL2_net, fetchFromGitHub }:
+{ lib, stdenv, autoreconfHook, pkgconfig, SDL2, SDL2_mixer, SDL2_net, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "chocolate-doom";
@@ -22,9 +22,9 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://chocolate-doom.org/";
     description = "A Doom source port that accurately reproduces the experience of Doom as it was played in the 1990s";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.unix;
-    hydraPlatforms = stdenv.lib.platforms.linux; # darwin times out
-    maintainers = with stdenv.lib.maintainers; [ MP2E ];
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.unix;
+    hydraPlatforms = lib.platforms.linux; # darwin times out
+    maintainers = with lib.maintainers; [ MP2E ];
   };
 }
diff --git a/pkgs/games/ckan/default.nix b/pkgs/games/ckan/default.nix
index b0a509ce4db..052982bf15d 100644
--- a/pkgs/games/ckan/default.nix
+++ b/pkgs/games/ckan/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ makeWrapper mono ];
 
-  libraries = stdenv.lib.makeLibraryPath [ gtk2 curl ];
+  libraries = lib.makeLibraryPath [ gtk2 curl ];
 
   buildPhase = "true";
 
diff --git a/pkgs/games/cockatrice/default.nix b/pkgs/games/cockatrice/default.nix
index f8b90f87a72..d47e0d5521d 100644
--- a/pkgs/games/cockatrice/default.nix
+++ b/pkgs/games/cockatrice/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, mkDerivation, cmake, protobuf
+{ lib, stdenv, fetchFromGitHub, mkDerivation, cmake, protobuf
 , qtbase, qtmultimedia, qttools, qtwebsockets, wrapQtAppsHook
 }:
 
@@ -22,8 +22,8 @@ mkDerivation rec {
   meta = {
     homepage = "https://github.com/Cockatrice/Cockatrice";
     description = "A cross-platform virtual tabletop for multiplayer card games";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = with stdenv.lib.maintainers; [ evanjs ];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.gpl2;
+    maintainers = with lib.maintainers; [ evanjs ];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/games/construo/default.nix b/pkgs/games/construo/default.nix
index 815c2f3fab4..2565d8599a5 100644
--- a/pkgs/games/construo/default.nix
+++ b/pkgs/games/construo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , libX11
 , zlib
@@ -18,9 +18,9 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ libX11 zlib xorgproto ]
-    ++ stdenv.lib.optional (libGL != null) libGL
-    ++ stdenv.lib.optional (libGLU != null) libGLU
-    ++ stdenv.lib.optional (freeglut != null) freeglut;
+    ++ lib.optional (libGL != null) libGL
+    ++ lib.optional (libGLU != null) libGLU
+    ++ lib.optional (freeglut != null) freeglut;
 
   preConfigure = ''
     substituteInPlace src/Makefile.in \
@@ -30,6 +30,6 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Masses and springs simulation game";
     homepage = "http://fs.fsf.org/construo/";
-    license = stdenv.lib.licenses.gpl3;
+    license = lib.licenses.gpl3;
   };
 }
diff --git a/pkgs/games/crack-attack/default.nix b/pkgs/games/crack-attack/default.nix
index 05c829441ad..b5fe9467d2e 100644
--- a/pkgs/games/crack-attack/default.nix
+++ b/pkgs/games/crack-attack/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, gtk2, freeglut, SDL, SDL_mixer, libGLU, libGL, libXi, libXmu }:
+{ lib, stdenv, fetchurl, pkgconfig, gtk2, freeglut, SDL, SDL_mixer, libGLU, libGL, libXi, libXmu }:
 
 stdenv.mkDerivation {
   name = "crack-attack-1.1.14";
@@ -28,8 +28,8 @@ stdenv.mkDerivation {
   meta = {
     description = "A fast-paced puzzle game inspired by the classic Super NES title Tetris Attack!";
     homepage = "https://www.nongnu.org/crack-attack/";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.piotr ];
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.piotr ];
   };
 }
diff --git a/pkgs/games/crafty/default.nix b/pkgs/games/crafty/default.nix
index 191baa7e592..1328488dde3 100644
--- a/pkgs/games/crafty/default.nix
+++ b/pkgs/games/crafty/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip }:
+{ lib, stdenv, fetchurl, unzip }:
 
 stdenv.mkDerivation rec {
   pname = "crafty";
@@ -66,8 +66,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://www.craftychess.com/";
     description = "Chess program developed by Dr. Robert M. Hyatt";
-    license = stdenv.lib.licenses.unfree;
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = [ stdenv.lib.maintainers.jwiegley ];
+    license = lib.licenses.unfree;
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.jwiegley ];
   };
 }
diff --git a/pkgs/games/crispy-doom/default.nix b/pkgs/games/crispy-doom/default.nix
index 70e191fe887..f9e6acb44b0 100644
--- a/pkgs/games/crispy-doom/default.nix
+++ b/pkgs/games/crispy-doom/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, autoreconfHook, pkgconfig, SDL2, SDL2_mixer, SDL2_net, fetchFromGitHub, python }:
+{ lib, stdenv, autoreconfHook, pkgconfig, SDL2, SDL2_mixer, SDL2_net, fetchFromGitHub, python }:
 
 stdenv.mkDerivation rec {
   pname = "crispy-doom";
@@ -27,8 +27,8 @@ stdenv.mkDerivation rec {
       Crispy Doom is a limit-removing enhanced-resolution Doom source port based on Chocolate Doom.
       Its name means that 640x400 looks \"crisp\" and is also a slight reference to its origin.
     '';
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ neonfuz ];
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ neonfuz ];
   };
 }
diff --git a/pkgs/games/crrcsim/default.nix b/pkgs/games/crrcsim/default.nix
index e57d6bcab06..741f402870a 100644
--- a/pkgs/games/crrcsim/default.nix
+++ b/pkgs/games/crrcsim/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libGLU, libGL, SDL, SDL_mixer, plib, libjpeg }:
+{ lib, stdenv, fetchurl, libGLU, libGL, SDL, SDL_mixer, plib, libjpeg }:
 let
   version = "0.9.13";
 in
@@ -21,8 +21,8 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "A model-airplane flight simulator";
-    maintainers = with stdenv.lib.maintainers; [ raskin ];
+    maintainers = with lib.maintainers; [ raskin ];
     platforms = [ "i686-linux" "x86_64-linux" ];
-    license = stdenv.lib.licenses.gpl2;
+    license = lib.licenses.gpl2;
   };
 }
diff --git a/pkgs/games/cutemaze/default.nix b/pkgs/games/cutemaze/default.nix
index 89fdc7e9d87..0cd16e433df 100644
--- a/pkgs/games/cutemaze/default.nix
+++ b/pkgs/games/cutemaze/default.nix
@@ -13,7 +13,7 @@ mkDerivation rec {
 
   buildInputs = [ qtsvg ];
 
-  postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
+  postInstall = lib.optionalString stdenv.isDarwin ''
     mkdir -p $out/Applications
     mv CuteMaze.app $out/Applications
   '';
diff --git a/pkgs/games/cuyo/default.nix b/pkgs/games/cuyo/default.nix
index 72c55fc1811..871812e097a 100644
--- a/pkgs/games/cuyo/default.nix
+++ b/pkgs/games/cuyo/default.nix
@@ -1,21 +1,21 @@
-{ stdenv, fetchurl, SDL, SDL_mixer, zlib }:
+{ lib, stdenv, fetchurl, SDL, SDL_mixer, zlib }:
 
 stdenv.mkDerivation {
   pname = "cuyo";
   version = "2.1.0";
-  
+
   src = fetchurl {
      url = "https://download.savannah.gnu.org/releases/cuyo/cuyo-2.1.0.tar.gz";
      sha256 = "17yqv924x7yvwix7yz9jdhgyar8lzdhqvmpvv0any8rdkajhj23c";
      };
 
   buildInputs = [ SDL SDL_mixer zlib ];
-     
+
   meta = {
      homepage = "http://karimmi.de/cuyo";
      description = "Stacking blocks game, with different rules for each level";
-     license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+     license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
   };
-  
+
 }
diff --git a/pkgs/games/dhewm3/default.nix b/pkgs/games/dhewm3/default.nix
index edec85a1c65..b5caa603eaf 100644
--- a/pkgs/games/dhewm3/default.nix
+++ b/pkgs/games/dhewm3/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     homepage = "https://github.com/dhewm/dhewm3";
     description = "Doom 3 port to SDL";
-    license = stdenv.lib.licenses.gpl3;
+    license = lib.licenses.gpl3;
     maintainers = with maintainers; [ MP2E ];
     platforms = with platforms; linux;
   };
diff --git a/pkgs/games/domination/default.nix b/pkgs/games/domination/default.nix
index 37c7d37741b..2fc4f8d36cb 100644
--- a/pkgs/games/domination/default.nix
+++ b/pkgs/games/domination/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchsvn
 # jdk8 is needed for building, but the game runs on newer jres as well
 , jdk8
@@ -76,7 +76,7 @@ in stdenv.mkDerivation {
     install -Dm644 build/game/resources/icon.png $out/share/pixmaps/domination.png
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://domination.sourceforge.net/";
     downloadPage = "http://domination.sourceforge.net/download.shtml";
     description = "A game that is a bit like the board game Risk or RisiKo";
diff --git a/pkgs/games/eboard/default.nix b/pkgs/games/eboard/default.nix
index b11cc90d11f..57cd5b4176e 100644
--- a/pkgs/games/eboard/default.nix
+++ b/pkgs/games/eboard/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl, pkgconfig, gtk2 }:
+{ lib, stdenv, fetchurl, perl, pkgconfig, gtk2 }:
 
 stdenv.mkDerivation {
   name = "eboard-1.1.1";
@@ -25,6 +25,6 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://www.bergo.eng.br/eboard/";
     description = "Chess interface for Unix-like systems";
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/eduke32/default.nix b/pkgs/games/eduke32/default.nix
index f264fd0b9e3..8f90faa0381 100644
--- a/pkgs/games/eduke32/default.nix
+++ b/pkgs/games/eduke32/default.nix
@@ -30,7 +30,7 @@ in stdenv.mkDerivation {
   buildInputs = [ alsaLib flac gtk2 libvorbis libvpx libGL libGLU SDL2 SDL2_mixer ];
 
   nativeBuildInputs = [ makeWrapper pkgconfig ]
-    ++ stdenv.lib.optional (stdenv.hostPlatform.system == "i686-linux") nasm;
+    ++ lib.optional (stdenv.hostPlatform.system == "i686-linux") nasm;
 
   postPatch = ''
     substituteInPlace source/build/src/glbuild.cpp \
diff --git a/pkgs/games/egoboo/default.nix b/pkgs/games/egoboo/default.nix
index 138ad8a757f..56ebcb1444e 100644
--- a/pkgs/games/egoboo/default.nix
+++ b/pkgs/games/egoboo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libGLU, libGL, SDL, SDL_mixer, SDL_image, SDL_ttf }:
+{ lib, stdenv, fetchurl, libGLU, libGL, SDL, SDL_mixer, SDL_image, SDL_ttf }:
 
 stdenv.mkDerivation rec {
   # pf5234 (a developer?) at freenode #egoboo told me that I better use 2.7.3 until
@@ -50,10 +50,10 @@ stdenv.mkDerivation rec {
     description = "3D dungeon crawling adventure";
 
     homepage = "http://www.freedink.org/";
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
 
     # I take it out of hydra as it does not work as well as I'd like
-    # maintainers = [ stdenv.lib.maintainers.bjg ];
-    # platforms = stdenv.lib.platforms.all;
+    # maintainers = [ lib.maintainers.bjg ];
+    # platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/games/endgame-singularity/default.nix b/pkgs/games/endgame-singularity/default.nix
index 4e855dbd053..f220a85e0eb 100644
--- a/pkgs/games/endgame-singularity/default.nix
+++ b/pkgs/games/endgame-singularity/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchFromGitHub
 , unzip
@@ -17,7 +17,7 @@ python3.pkgs.buildPythonApplication rec {
       rev = "v${version}";
       sha256 = "0ndrnxwii8lag6vrjpwpf5n36hhv223bb46d431l9gsigbizv0hl";
     })
-  ] ++ stdenv.lib.optional enableDefaultMusicPack (
+  ] ++ lib.optional enableDefaultMusicPack (
     fetchurl {
       url = "http://www.emhsoft.com/singularity/endgame-singularity-music-007.zip";
       sha256 = "0vf2qaf66jh56728pq1zbnw50yckjz6pf6c6qw6dl7vk60kkqnpb";
@@ -29,7 +29,7 @@ python3.pkgs.buildPythonApplication rec {
   propagatedBuildInputs = with python3.pkgs; [ pygame numpy polib ];
 
   # Add the music
-  postInstall = stdenv.lib.optionalString enableDefaultMusicPack ''
+  postInstall = lib.optionalString enableDefaultMusicPack ''
     cp -R "../endgame-singularity-music-007" \
           "$(echo $out/lib/python*/site-packages/singularity)/music"
           # ↑ we cannot glob on [...]/music, it doesn't exist yet
@@ -42,7 +42,7 @@ python3.pkgs.buildPythonApplication rec {
       A simulation of a true AI. Go from computer to computer, pursued by the
       entire world. Keep hidden, and you might have a chance
     '';
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = with stdenv.lib.maintainers; [ fgaz ];
+    license = lib.licenses.gpl2;
+    maintainers = with lib.maintainers; [ fgaz ];
   };
 }
diff --git a/pkgs/games/enyo-doom/default.nix b/pkgs/games/enyo-doom/default.nix
index bcb98fc8cca..10cce9f3bf8 100644
--- a/pkgs/games/enyo-doom/default.nix
+++ b/pkgs/games/enyo-doom/default.nix
@@ -1,4 +1,4 @@
-{ mkDerivation, stdenv, fetchFromGitLab, cmake, qtbase }:
+{ mkDerivation, lib, stdenv, fetchFromGitLab, cmake, qtbase }:
 
 mkDerivation rec {
   pname = "enyo-doom";
@@ -18,8 +18,8 @@ mkDerivation rec {
   meta = {
     homepage = "https://gitlab.com/sdcofer70/enyo-doom";
     description = "Frontend for Doom engines";
-    license = stdenv.lib.licenses.gpl3Plus;
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = [ stdenv.lib.maintainers.tadfisher ];
+    license = lib.licenses.gpl3Plus;
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.tadfisher ];
   };
 }
diff --git a/pkgs/games/eternity-engine/default.nix b/pkgs/games/eternity-engine/default.nix
index 72e2af9025d..42111556105 100644
--- a/pkgs/games/eternity-engine/default.nix
+++ b/pkgs/games/eternity-engine/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cmake, libGL, SDL, SDL_mixer, SDL_net, fetchFromGitHub, makeWrapper }:
+{ lib, stdenv, cmake, libGL, SDL, SDL_mixer, SDL_net, fetchFromGitHub, makeWrapper }:
 
 stdenv.mkDerivation rec {
   pname = "eternity-engine";
@@ -23,8 +23,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://doomworld.com/eternity";
     description = "New school Doom port by James Haley";
-    license = stdenv.lib.licenses.gpl3;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = with stdenv.lib.maintainers; [ MP2E ];
+    license = lib.licenses.gpl3;
+    platforms = lib.platforms.linux;
+    maintainers = with lib.maintainers; [ MP2E ];
   };
 }
diff --git a/pkgs/games/extremetuxracer/default.nix b/pkgs/games/extremetuxracer/default.nix
index 1c0a47e4b61..8ea19c93dfe 100644
--- a/pkgs/games/extremetuxracer/default.nix
+++ b/pkgs/games/extremetuxracer/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libGLU, libGL, libX11, xorgproto, tcl, freeglut, freetype
+{ lib, stdenv, fetchurl, libGLU, libGL, libX11, xorgproto, tcl, freeglut, freetype
 , sfml, libXi
 , libXmu, libXext, libXt, libSM, libICE
 , libpng, pkgconfig, gettext, intltool
@@ -31,9 +31,9 @@ stdenv.mkDerivation rec {
     longDescription = ''
       ExtremeTuxRacer - Tux lies on his belly and accelerates down ice slopes.
     '';
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
     homepage = "https://sourceforge.net/projects/extremetuxracer/";
-    maintainers = with stdenv.lib.maintainers; [ ];
-    platforms = with stdenv.lib.platforms; linux;
+    maintainers = with lib.maintainers; [ ];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/games/exult/default.nix b/pkgs/games/exult/default.nix
index adbf4dd0702..6dd9d711a28 100644
--- a/pkgs/games/exult/default.nix
+++ b/pkgs/games/exult/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, SDL2, libogg, libvorbis, zlib, unzip }:
+{ lib, stdenv, fetchurl, pkgconfig, SDL2, libogg, libvorbis, zlib, unzip }:
 
 let
 
@@ -38,9 +38,9 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://exult.sourceforge.net/";
     description = "A reimplementation of the Ultima VII game engine";
-    maintainers = [ stdenv.lib.maintainers.eelco ];
-    platforms = stdenv.lib.platforms.unix;
-    hydraPlatforms = stdenv.lib.platforms.linux; # darwin times out
-    license = stdenv.lib.licenses.gpl2Plus;
+    maintainers = [ lib.maintainers.eelco ];
+    platforms = lib.platforms.unix;
+    hydraPlatforms = lib.platforms.linux; # darwin times out
+    license = lib.licenses.gpl2Plus;
   };
 }
diff --git a/pkgs/games/ezquake/default.nix b/pkgs/games/ezquake/default.nix
index 143a7d94015..1251c38e0fd 100644
--- a/pkgs/games/ezquake/default.nix
+++ b/pkgs/games/ezquake/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     expat curl jansson libpng libjpeg libGLU libGL libXxf86vm pcre SDL2 vim speex
   ];
 
-  installPhase = with stdenv.lib; let
+  installPhase = with lib; let
     sys = last (splitString "-" stdenv.hostPlatform.system);
     arch = head (splitString "-" stdenv.hostPlatform.system);
   in ''
diff --git a/pkgs/games/factorio/default.nix b/pkgs/games/factorio/default.nix
index 4535f31f262..9db8a95746d 100644
--- a/pkgs/games/factorio/default.nix
+++ b/pkgs/games/factorio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, makeWrapper, makeDesktopItem
+{ lib, stdenv, fetchurl, makeWrapper, makeDesktopItem
 , alsaLib, libpulseaudio, libX11, libXcursor, libXinerama, libXrandr, libXi, libGL
 , libSM, libICE, libXext, factorio-utils
 , releaseType
@@ -13,7 +13,7 @@ assert releaseType == "alpha"
 
 let
 
-  inherit (stdenv.lib) importJSON;
+  inherit (lib) importJSON;
 
   helpMsg = ''
 
@@ -83,7 +83,7 @@ let
       if !needsAuth then
         fetchurl { inherit name url sha256; }
       else
-        (stdenv.lib.overrideDerivation
+        (lib.overrideDerivation
           (fetchurl {
             inherit name url sha256;
             curlOpts = [
@@ -168,8 +168,8 @@ let
         version 1.0 in mid 2020.
       '';
       homepage = "https://www.factorio.com/";
-      license = stdenv.lib.licenses.unfree;
-      maintainers = with stdenv.lib.maintainers; [ Baughn elitak erictapen priegger lukegb ];
+      license = lib.licenses.unfree;
+      maintainers = with lib.maintainers; [ Baughn elitak erictapen priegger lukegb ];
       platforms = [ "x86_64-linux" ];
     };
   };
@@ -180,7 +180,7 @@ let
 
       buildInputs = [ makeWrapper libpulseaudio ];
 
-      libPath = stdenv.lib.makeLibraryPath [
+      libPath = lib.makeLibraryPath [
         alsaLib
         libpulseaudio
         libX11
diff --git a/pkgs/games/factorio/mods.nix b/pkgs/games/factorio/mods.nix
index 5c9b4f0628a..8d9976689cc 100644
--- a/pkgs/games/factorio/mods.nix
+++ b/pkgs/games/factorio/mods.nix
@@ -2,12 +2,12 @@
 # mods. It will eventually be replaced by a nixos-channel that will provide
 # derivations for most or all of the mods tracked through the official mod
 # manager site.
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , factorio-utils
 , allRecommendedMods ? true
 , allOptionalMods ? false
 }:
-with stdenv.lib;
+with lib;
 let
   modDrv = factorio-utils.modDrv { inherit allRecommendedMods allOptionalMods; };
 in
diff --git a/pkgs/games/factorio/utils.nix b/pkgs/games/factorio/utils.nix
index 2764592a324..be5b7fd5ecc 100644
--- a/pkgs/games/factorio/utils.nix
+++ b/pkgs/games/factorio/utils.nix
@@ -1,7 +1,7 @@
 # This file provides a top-level function that will be used by both nixpkgs and nixos
 # to generate mod directories for use at runtime by factorio.
-{ stdenv }:
-with stdenv.lib;
+{ lib, stdenv }:
+with lib;
 {
   mkModDirDrv = mods: # a list of mod derivations
     let
diff --git a/pkgs/games/fairymax/default.nix b/pkgs/games/fairymax/default.nix
index b5e3afa9e3b..e0d2fdd8252 100644
--- a/pkgs/games/fairymax/default.nix
+++ b/pkgs/games/fairymax/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 stdenv.mkDerivation rec {
   pname = "fairymax";
   version = "4.8";
@@ -32,9 +32,9 @@ stdenv.mkDerivation rec {
        and board sizes up to 12x8. A Linux port exists in the
        format of a debian package.
     '';
-    license = stdenv.lib.licenses.free ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.free ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.linux;
     homepage = "http://home.hccnet.nl/h.g.muller/dwnldpage.html";
   };
 }
diff --git a/pkgs/games/flare/engine.nix b/pkgs/games/flare/engine.nix
index 22a12fda054..2b2738b4108 100644
--- a/pkgs/games/flare/engine.nix
+++ b/pkgs/games/flare/engine.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
   buildInputs = [ SDL2 SDL2_image SDL2_mixer SDL2_ttf ]
-    ++ stdenv.lib.optional stdenv.isDarwin Cocoa;
+    ++ lib.optional stdenv.isDarwin Cocoa;
 
   meta = with lib; {
     description = "Free/Libre Action Roleplaying Engine";
diff --git a/pkgs/games/freecell-solver/default.nix b/pkgs/games/freecell-solver/default.nix
index 1845ba825eb..af75dbfa226 100644
--- a/pkgs/games/freecell-solver/default.nix
+++ b/pkgs/games/freecell-solver/default.nix
@@ -1,8 +1,8 @@
-{ stdenv, fetchurl, pkgconfig, cmake
+{ lib, stdenv, fetchurl, pkgconfig, cmake
 , perl, gmp, libtap, gperf
 , perlPackages, python3 }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
 
   pname = "freecell-solver";
diff --git a/pkgs/games/freeciv/default.nix b/pkgs/games/freeciv/default.nix
index 31532a6c2e2..cec3349b2a6 100644
--- a/pkgs/games/freeciv/default.nix
+++ b/pkgs/games/freeciv/default.nix
@@ -8,7 +8,7 @@
 }:
 
 let
-  inherit (stdenv.lib) optional optionals;
+  inherit (lib) optional optionals;
 
 in stdenv.mkDerivation rec {
   pname = "freeciv";
diff --git a/pkgs/games/freedink/default.nix b/pkgs/games/freedink/default.nix
index 735a49bee62..fff8426c16a 100644
--- a/pkgs/games/freedink/default.nix
+++ b/pkgs/games/freedink/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL, SDL_mixer, SDL_image, SDL_ttf, SDL_gfx
+{ lib, stdenv, fetchurl, SDL, SDL_mixer, SDL_image, SDL_ttf, SDL_gfx
 , pkgconfig, intltool, fontconfig, libzip, zip, zlib }:
 
 let
@@ -52,10 +52,10 @@ in stdenv.mkDerivation rec {
     '';
 
     homepage = "http://www.freedink.org/";
-    license = stdenv.lib.licenses.gpl3Plus;
+    license = lib.licenses.gpl3Plus;
 
-    maintainers = [ stdenv.lib.maintainers.bjg ];
-    platforms = stdenv.lib.platforms.all;
-    hydraPlatforms = stdenv.lib.platforms.linux; # sdl-config times out on darwin
+    maintainers = [ lib.maintainers.bjg ];
+    platforms = lib.platforms.all;
+    hydraPlatforms = lib.platforms.linux; # sdl-config times out on darwin
   };
 }
diff --git a/pkgs/games/freedroidrpg/default.nix b/pkgs/games/freedroidrpg/default.nix
index aab2b748d1a..ad84005c155 100644
--- a/pkgs/games/freedroidrpg/default.nix
+++ b/pkgs/games/freedroidrpg/default.nix
@@ -7,7 +7,7 @@ in stdenv.mkDerivation {
   inherit version;
 
   src = fetchurl {
-    url = "ftp://ftp.osuosl.org/pub/freedroid/freedroidRPG-${stdenv.lib.versions.majorMinor version}/freedroidRPG-${version}.tar.gz";
+    url = "ftp://ftp.osuosl.org/pub/freedroid/freedroidRPG-${lib.versions.majorMinor version}/freedroidRPG-${version}.tar.gz";
     sha256 = "0n4kn38ncmcy3lrxmq8fjry6c1z50z4q1zcqfig0j4jb0dsz2va2";
   };
 
@@ -15,7 +15,7 @@ in stdenv.mkDerivation {
 
   buildInputs = [
     SDL SDL_image SDL_gfx SDL_mixer libogg libvorbis lua5_3 libjpeg libpng zlib
-  ] ++ stdenv.lib.optional stdenv.isDarwin libiconv;
+  ] ++ lib.optional stdenv.isDarwin libiconv;
 
   meta = with lib; {
     description = "Isometric 3D RPG similar to game Diablo";
diff --git a/pkgs/games/frozen-bubble/default.nix b/pkgs/games/frozen-bubble/default.nix
index 3b562ee44f2..6798b4d1b9e 100644
--- a/pkgs/games/frozen-bubble/default.nix
+++ b/pkgs/games/frozen-bubble/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perlPackages, pkgconfig, SDL, SDL_mixer, SDL_Pango, glib }:
+{ lib, stdenv, fetchurl, perlPackages, pkgconfig, SDL, SDL_mixer, SDL_Pango, glib }:
 
 perlPackages.buildPerlModule {
   pname = "frozen-bubble";
@@ -19,7 +19,7 @@ perlPackages.buildPerlModule {
 
   meta = {
     description = "Puzzle with Bubbles";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = with stdenv.lib.maintainers; [ puckipedia ];
+    license = lib.licenses.gpl2;
+    maintainers = with lib.maintainers; [ puckipedia ];
   };
 }
diff --git a/pkgs/games/fsg/default.nix b/pkgs/games/fsg/default.nix
index b8a0d5ff3c7..909ea662400 100644
--- a/pkgs/games/fsg/default.nix
+++ b/pkgs/games/fsg/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gtk2, glib, pkgconfig, libGLU, libGL, wxGTK, libX11, xorgproto
+{ lib, stdenv, fetchurl, gtk2, glib, pkgconfig, libGLU, libGL, wxGTK, libX11, xorgproto
 , runtimeShell }:
 
 stdenv.mkDerivation {
@@ -31,7 +31,7 @@ stdenv.mkDerivation {
 
   meta = {
     description = "Cellular automata engine tuned towards the likes of Falling Sand";
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/galaxis/default.nix b/pkgs/games/galaxis/default.nix
index 19df8db78a0..a3847e73c8d 100644
--- a/pkgs/games/galaxis/default.nix
+++ b/pkgs/games/galaxis/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, ncurses, xmlto }:
+{ lib, stdenv, fetchurl, ncurses, xmlto }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
 
   pname = "galaxis";
diff --git a/pkgs/games/gargoyle/default.nix b/pkgs/games/gargoyle/default.nix
index 78bffaf16af..f6bbce2bf90 100644
--- a/pkgs/games/gargoyle/default.nix
+++ b/pkgs/games/gargoyle/default.nix
@@ -30,10 +30,10 @@ stdenv.mkDerivation rec {
     sha256 = "0w54avmbp4i4zps2rb4acmpa641s6wvwbrln4vbdhcz97fx48nzz";
   };
 
-  nativeBuildInputs = [ jam pkgconfig ] ++ stdenv.lib.optional stdenv.isDarwin cctools;
+  nativeBuildInputs = [ jam pkgconfig ] ++ lib.optional stdenv.isDarwin cctools;
 
   buildInputs = [ SDL SDL_mixer SDL_sound gtk2 ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ smpeg libvorbis ];
+    ++ lib.optionals stdenv.isDarwin [ smpeg libvorbis ];
 
   buildPhase = jamenv + "jam -j$NIX_BUILD_CORES";
 
diff --git a/pkgs/games/gav/default.nix b/pkgs/games/gav/default.nix
index e42afefb830..b8390455377 100644
--- a/pkgs/games/gav/default.nix
+++ b/pkgs/games/gav/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, SDL, SDL_image, SDL_mixer, SDL_net} :
+{lib, stdenv, fetchurl, SDL, SDL_image, SDL_mixer, SDL_net} :
 
 stdenv.mkDerivation {
   name = "gav-0.9.0";
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
   meta = {
     description = "Remake of AV Arcade Volleyball";
     homepage = "http://gav.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/gltron/default.nix b/pkgs/games/gltron/default.nix
index f6d74b6e9b7..45267579c9b 100644
--- a/pkgs/games/gltron/default.nix
+++ b/pkgs/games/gltron/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, SDL, libGLU, libGL, zlib, libpng, libvorbis, libmikmod, SDL_sound } :
+{lib, stdenv, fetchurl, SDL, libGLU, libGL, zlib, libpng, libvorbis, libmikmod, SDL_sound } :
 
 stdenv.mkDerivation rec {
   name = "gltron-0.70";
@@ -22,8 +22,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://www.gltron.org/";
     description = "Game based on the movie Tron";
-    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/games/gmad/default.nix b/pkgs/games/gmad/default.nix
index aad53a7915a..eb893882ff5 100644
--- a/pkgs/games/gmad/default.nix
+++ b/pkgs/games/gmad/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, premake4, bootil }:
+{ lib, stdenv, fetchFromGitHub, premake4, bootil }:
 
 stdenv.mkDerivation rec {
   name = "gmad-unstable-2015-04-16";
@@ -6,9 +6,9 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Garry's Mod Addon Creator and Extractor";
     homepage = "https://github.com/garrynewman/gmad";
-    license = stdenv.lib.licenses.unfree;
-    maintainers = [ stdenv.lib.maintainers.abigailbuccaneer ];
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.unfree;
+    maintainers = [ lib.maintainers.abigailbuccaneer ];
+    platforms = lib.platforms.all;
   };
 
   src = fetchFromGitHub {
diff --git a/pkgs/games/gnubg/default.nix b/pkgs/games/gnubg/default.nix
index edfde5ea3e9..f3d897d32af 100644
--- a/pkgs/games/gnubg/default.nix
+++ b/pkgs/games/gnubg/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, glib, python, gtk2, readline }:
+{ lib, stdenv, fetchurl, pkgconfig, glib, python, gtk2, readline }:
 
 let version = "1.06.002"; in
 stdenv.mkDerivation {
@@ -14,7 +14,7 @@ stdenv.mkDerivation {
 
   configureFlags = [ "--with-gtk" "--with--board3d" ];
 
-  meta = with stdenv.lib;
+  meta = with lib;
     { description = "World class backgammon application";
       homepage = "http://www.gnubg.org/";
       license = licenses.gpl3;
diff --git a/pkgs/games/gnuchess/default.nix b/pkgs/games/gnuchess/default.nix
index a7b27933496..69ec574a644 100644
--- a/pkgs/games/gnuchess/default.nix
+++ b/pkgs/games/gnuchess/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, flex, makeWrapper}:
+{lib, stdenv, fetchurl, flex, makeWrapper}:
 let
   s = # Generated upstream information
   rec {
@@ -28,8 +28,8 @@ stdenv.mkDerivation {
   meta = {
     inherit (s) version;
     description = "GNU Chess engine";
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.gpl3Plus;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
+    license = lib.licenses.gpl3Plus;
   };
 }
diff --git a/pkgs/games/gnugo/default.nix b/pkgs/games/gnugo/default.nix
index 069d14756e3..e33c27bf9eb 100644
--- a/pkgs/games/gnugo/default.nix
+++ b/pkgs/games/gnugo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "gnugo";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "GNU Go - A computer go player";
     homepage = "https://www.gnu.org/software/gnugo/";
-    license = stdenv.lib.licenses.gpl3;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl3;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/games/gogui/default.nix b/pkgs/games/gogui/default.nix
index b13a145ff5e..8eb989a8f47 100644
--- a/pkgs/games/gogui/default.nix
+++ b/pkgs/games/gogui/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, openjdk, unzip, makeWrapper }:
+{ fetchurl, lib, stdenv, openjdk, unzip, makeWrapper }:
 
 let
   version = "1.4.9";
@@ -20,10 +20,10 @@ in stdenv.mkDerivation {
     done
   '';
   meta = {
-    maintainers = [ stdenv.lib.maintainers.cleverca22 ];
+    maintainers = [ lib.maintainers.cleverca22 ];
     description = "A graphical user interface to programs that play the board game Go and support the Go Text Protocol such as GNU Go";
     homepage = "http://gogui.sourceforge.net/";
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.gpl3;
+    platforms = lib.platforms.unix;
+    license = lib.licenses.gpl3;
   };
 }
diff --git a/pkgs/games/gtetrinet/default.nix b/pkgs/games/gtetrinet/default.nix
index f3cc9ab0006..ef815b3bacc 100644
--- a/pkgs/games/gtetrinet/default.nix
+++ b/pkgs/games/gtetrinet/default.nix
@@ -1,4 +1,4 @@
-{ fetchFromGitHub, stdenv, autoreconfHook, intltool, pkgconfig, libgnome, libgnomeui, GConf }:
+{ fetchFromGitHub, lib, stdenv, autoreconfHook, intltool, pkgconfig, libgnome, libgnomeui, GConf }:
 
 stdenv.mkDerivation {
   name = "gtetrinet-0.7.11";
@@ -37,8 +37,8 @@ stdenv.mkDerivation {
       that is played over the internet.
     '';
     homepage = "http://gtetrinet.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = [ stdenv.lib.maintainers.chris-martin ];
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.chris-martin ];
   };
 }
diff --git a/pkgs/games/gtypist/default.nix b/pkgs/games/gtypist/default.nix
index 52794ca3218..d0ddf43fe2a 100644
--- a/pkgs/games/gtypist/default.nix
+++ b/pkgs/games/gtypist/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ makeWrapper ncurses perl fortune ]
-   ++ stdenv.lib.optional stdenv.isDarwin libiconv;
+   ++ lib.optional stdenv.isDarwin libiconv;
 
   preFixup = ''
      wrapProgram "$out/bin/typefortune" \
diff --git a/pkgs/games/hawkthorne/default.nix b/pkgs/games/hawkthorne/default.nix
index 81984530992..3da78349dbb 100644
--- a/pkgs/games/hawkthorne/default.nix
+++ b/pkgs/games/hawkthorne/default.nix
@@ -1,4 +1,4 @@
-{ fetchgit, stdenv, love, curl, zip }:
+{ fetchgit, lib, stdenv, love, curl, zip }:
 
 stdenv.mkDerivation {
   version = "0.12.1";
@@ -32,8 +32,8 @@ stdenv.mkDerivation {
       Hawthorne's inheritance.
     '';
     homepage = "https://www.reddit.com/r/hawkthorne";
-    license = stdenv.lib.licenses.mit;
-    maintainers = with stdenv.lib.maintainers; [ campadrenalin ];
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ campadrenalin ];
     broken = true;
   };
 }
diff --git a/pkgs/games/icbm3d/default.nix b/pkgs/games/icbm3d/default.nix
index 71ecfacb37e..7edf7cd477e 100644
--- a/pkgs/games/icbm3d/default.nix
+++ b/pkgs/games/icbm3d/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, libX11}:
+{lib, stdenv, fetchurl, libX11}:
 
 stdenv.mkDerivation {
   name = "icbm3d-0.4";
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://www.newbreedsoftware.com/icbm3d/";
     description = "3D vector-based clone of the atari game Missile Command";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/instead/default.nix b/pkgs/games/instead/default.nix
index 02a54dc7604..0450e8eafd0 100644
--- a/pkgs/games/instead/default.nix
+++ b/pkgs/games/instead/default.nix
@@ -65,8 +65,8 @@ stdenv.mkDerivation {
   meta = with lib; {
     description = "Simple text adventure interpreter for Unix and Windows";
     homepage = "https://instead.syscall.ru/";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.gpl2;
+    platforms = with lib.platforms; linux;
     maintainers = with maintainers; [ pSub ];
   };
 }
diff --git a/pkgs/games/jumpnbump/default.nix b/pkgs/games/jumpnbump/default.nix
index d81aece0e82..b502b4f1396 100644
--- a/pkgs/games/jumpnbump/default.nix
+++ b/pkgs/games/jumpnbump/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitLab
 , fetchzip
 , SDL2, SDL2_mixer, SDL2_net
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
     wrapPythonPrograms
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "cute, true multiplayer platform game with bunnies";
     homepage    = "https://libregames.gitlab.io/jumpnbump/";
     license     = licenses.gpl2Plus;
diff --git a/pkgs/games/keeperrl/default.nix b/pkgs/games/keeperrl/default.nix
index 568a0449ac2..bd49b821f9e 100644
--- a/pkgs/games/keeperrl/default.nix
+++ b/pkgs/games/keeperrl/default.nix
@@ -33,9 +33,9 @@ stdenv.mkDerivation rec {
 
   sourceRoot = "source";
 
-  srcs = [ free-src ] ++ stdenv.lib.optional unfree_assets assets;
+  srcs = [ free-src ] ++ lib.optional unfree_assets assets;
 
-  postUnpack = stdenv.lib.optionalString unfree_assets ''
+  postUnpack = lib.optionalString unfree_assets ''
     mv data $sourceRoot
   '';
 
@@ -61,7 +61,7 @@ stdenv.mkDerivation rec {
 
     cp -r data_free $out/share
     cp -r data_contrib $out/share
-    ${stdenv.lib.optionalString unfree_assets "cp -r data $out/share"}
+    ${lib.optionalString unfree_assets "cp -r data $out/share"}
   '';
 
   meta = with lib; {
diff --git a/pkgs/games/kobodeluxe/default.nix b/pkgs/games/kobodeluxe/default.nix
index 5620cee185d..cd5dc3cc2bc 100644
--- a/pkgs/games/kobodeluxe/default.nix
+++ b/pkgs/games/kobodeluxe/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, SDL, SDL_image, libGLU, libGL} :
+{lib, stdenv, fetchurl, SDL, SDL_image, libGLU, libGL} :
 
 stdenv.mkDerivation {
   name = "kobodeluxe-0.5.1";
@@ -18,7 +18,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://olofson.net/kobodl/";
     description = "Enhanced version of Akira Higuchi's game XKobo  for Un*x systems with X11";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/koboredux/default.nix b/pkgs/games/koboredux/default.nix
index 746e9d6bbef..622dd2de50e 100644
--- a/pkgs/games/koboredux/default.nix
+++ b/pkgs/games/koboredux/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , requireFile
@@ -10,7 +10,7 @@
 , useProprietaryAssets ? true
 }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "koboredux";
   version = "0.7.5.1";
diff --git a/pkgs/games/lbreakout2/default.nix b/pkgs/games/lbreakout2/default.nix
index 24797952d58..818cd31fa59 100644
--- a/pkgs/games/lbreakout2/default.nix
+++ b/pkgs/games/lbreakout2/default.nix
@@ -16,6 +16,6 @@ stdenv.mkDerivation rec {
     license = licenses.gpl2;
     maintainers = [ maintainers.ciil ];
     platforms = platforms.unix;
-    hydraPlatforms = stdenv.lib.platforms.linux; # sdl-config times out on darwin
+    hydraPlatforms = lib.platforms.linux; # sdl-config times out on darwin
   };
 }
diff --git a/pkgs/games/liquidwar/5.nix b/pkgs/games/liquidwar/5.nix
index 8abb1c7d53e..db0c7a61ddb 100644
--- a/pkgs/games/liquidwar/5.nix
+++ b/pkgs/games/liquidwar/5.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ allegro ];
 
-  configureFlags = stdenv.lib.optional stdenv.isx86_64 "--disable-asm";
+  configureFlags = lib.optional stdenv.isx86_64 "--disable-asm";
 
   hardeningDisable = [ "format" ];
 
diff --git a/pkgs/games/lugaru/default.nix b/pkgs/games/lugaru/default.nix
index 877a3880a00..12e9cfc2d63 100644
--- a/pkgs/games/lugaru/default.nix
+++ b/pkgs/games/lugaru/default.nix
@@ -1,7 +1,7 @@
-{ stdenv, fetchFromGitLab, cmake, openal, pkgconfig, libogg,
+{ lib, stdenv, fetchFromGitLab, cmake, openal, pkgconfig, libogg,
   libvorbis, SDL2, makeWrapper, libpng, libjpeg_turbo, libGLU }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
 
@@ -26,6 +26,6 @@ stdenv.mkDerivation rec {
     homepage = "https://osslugaru.gitlab.io";
     maintainers = [ ];
     platforms = platforms.linux;
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
   };
 }
diff --git a/pkgs/games/macopix/default.nix b/pkgs/games/macopix/default.nix
index f88b763aaf8..01a923838f0 100644
--- a/pkgs/games/macopix/default.nix
+++ b/pkgs/games/macopix/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, gtk, openssl }:
+{ lib, stdenv, fetchurl, pkgconfig, gtk, openssl }:
 
 stdenv.mkDerivation rec {
   name = "macopix-1.7.4";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Mascot Constructive Pilot for X";
     homepage = "http://rosegray.sakura.ne.jp/macopix/index-e.html";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/megaglest/default.nix b/pkgs/games/megaglest/default.nix
index 0660d196f1e..c97ea55882b 100644
--- a/pkgs/games/megaglest/default.nix
+++ b/pkgs/games/megaglest/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cmake, pkg-config, git, curl, SDL2, xercesc, openal, lua, libvlc
+{ lib, stdenv, cmake, pkg-config, git, curl, SDL2, xercesc, openal, lua, libvlc
 , libjpeg, wxGTK, cppunit, ftgl, glew, libogg, libvorbis, buildEnv, libpng
 , fontconfig, freetype, xorg, makeWrapper, bash, which, gnome3, libGLU, glib
 , fetchFromGitHub
@@ -48,7 +48,7 @@ stdenv.mkDerivation {
     done
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An entertaining free (freeware and free software) and open source cross-platform 3D real-time strategy (RTS) game";
     license = licenses.gpl3;
     homepage = "http://megaglest.org/";
diff --git a/pkgs/games/minecraft/default.nix b/pkgs/games/minecraft/default.nix
index 814abd698ce..462cbc48af6 100644
--- a/pkgs/games/minecraft/default.nix
+++ b/pkgs/games/minecraft/default.nix
@@ -41,7 +41,7 @@ let
     categories = "Game;";
   };
 
-  envLibPath = stdenv.lib.makeLibraryPath [
+  envLibPath = lib.makeLibraryPath [
     curl
     libpulseaudio
     systemd
@@ -50,7 +50,7 @@ let
     libXxf86vm # needed only for versions <1.13
   ];
 
-  libPath = stdenv.lib.makeLibraryPath ([
+  libPath = lib.makeLibraryPath ([
     alsaLib
     atk
     cairo
@@ -137,8 +137,8 @@ stdenv.mkDerivation rec {
     # Do not create `GPUCache` in current directory
     makeWrapper $out/opt/minecraft-launcher/minecraft-launcher $out/bin/minecraft-launcher \
       --prefix LD_LIBRARY_PATH : ${envLibPath} \
-      --prefix PATH : ${stdenv.lib.makeBinPath [ jre ]} \
-      --set JAVA_HOME ${stdenv.lib.getBin jre} \
+      --prefix PATH : ${lib.makeBinPath [ jre ]} \
+      --set JAVA_HOME ${lib.getBin jre} \
       --run "cd /tmp" \
       "''${gappsWrapperArgs[@]}"
   '';
diff --git a/pkgs/games/minetest/default.nix b/pkgs/games/minetest/default.nix
index 763c7f4bd67..ddb415a6ad2 100644
--- a/pkgs/games/minetest/default.nix
+++ b/pkgs/games/minetest/default.nix
@@ -4,7 +4,7 @@
 , leveldb, postgresql, hiredis, libiconv, OpenGL, OpenAL ? openal, Carbon, Cocoa
 }:
 
-with stdenv.lib;
+with lib;
 
 let
   boolToCMake = b: if b then "ON" else "OFF";
diff --git a/pkgs/games/moon-buggy/default.nix b/pkgs/games/moon-buggy/default.nix
index 9de24c1ae9d..6f099a88b2c 100644
--- a/pkgs/games/moon-buggy/default.nix
+++ b/pkgs/games/moon-buggy/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, ncurses}:
+{lib, stdenv, fetchurl, ncurses}:
 
 stdenv.mkDerivation rec {
   baseName = "moon-buggy";
@@ -16,9 +16,9 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = ''A simple character graphics game where you drive some kind of car across the moon's surface'';
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = [stdenv.lib.maintainers.rybern];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2;
+    maintainers = [lib.maintainers.rybern];
+    platforms = lib.platforms.linux;
     homepage = "https://www.seehuhn.de/pages/moon-buggy";
   };
 }
diff --git a/pkgs/games/multimc/default.nix b/pkgs/games/multimc/default.nix
index 6ac2e65b577..7a723e0347e 100644
--- a/pkgs/games/multimc/default.nix
+++ b/pkgs/games/multimc/default.nix
@@ -2,7 +2,7 @@
 
 let
   jdk = jdk8;
-  libpath = with xorg; stdenv.lib.makeLibraryPath [ libX11 libXext libXcursor libXrandr libXxf86vm libpulseaudio ];
+  libpath = with xorg; lib.makeLibraryPath [ libX11 libXext libXcursor libXrandr libXxf86vm libpulseaudio ];
 in mkDerivation rec {
   pname = "multimc";
   version = "0.6.11";
diff --git a/pkgs/games/n2048/default.nix b/pkgs/games/n2048/default.nix
index f5ff0b4690e..42424fe9ef4 100644
--- a/pkgs/games/n2048/default.nix
+++ b/pkgs/games/n2048/default.nix
@@ -1,6 +1,6 @@
-{stdenv, fetchurl, ncurses}:
+{lib, stdenv, fetchurl, ncurses}:
 let
-  s = 
+  s =
   rec {
     baseName = "n2048";
     version = "0.1";
@@ -27,9 +27,9 @@ stdenv.mkDerivation {
   meta = {
     inherit (s) version;
     description = ''Console implementation of 2048 game'';
-    license = stdenv.lib.licenses.bsd2;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.bsd2;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.linux;
     homepage = "http://www.dettus.net/n2048/";
   };
 }
diff --git a/pkgs/games/naev/default.nix b/pkgs/games/naev/default.nix
index c328199b377..4e5b7036763 100644
--- a/pkgs/games/naev/default.nix
+++ b/pkgs/games/naev/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, SDL, openal, SDL_mixer, libxml2, pkgconfig, libvorbis
+{ lib, fetchurl, stdenv, SDL, openal, SDL_mixer, libxml2, pkgconfig, libvorbis
 , libpng, libGLU, libGL, makeWrapper, zlib, freetype }:
 
 let
@@ -34,9 +34,9 @@ stdenv.mkDerivation {
   meta = {
     description = "2D action/rpg space game";
     homepage = "http://www.naev.org";
-    license = stdenv.lib.licenses.gpl3Plus;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl3Plus;
+    maintainers = with lib.maintainers; [viric];
+    platforms = lib.platforms.linux;
     hydraPlatforms = [];
   };
 }
diff --git a/pkgs/games/nethack/default.nix b/pkgs/games/nethack/default.nix
index a922064f78b..361752b714d 100644
--- a/pkgs/games/nethack/default.nix
+++ b/pkgs/games/nethack/default.nix
@@ -97,7 +97,7 @@ in stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  preFixup = stdenv.lib.optionalString qtMode ''
+  preFixup = lib.optionalString qtMode ''
     wrapQtApp "$out/games/nethack"
   '';
 
diff --git a/pkgs/games/neverball/default.nix b/pkgs/games/neverball/default.nix
index 99ce818d04d..431dfd58a81 100644
--- a/pkgs/games/neverball/default.nix
+++ b/pkgs/games/neverball/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL2, libGL, libpng, libjpeg, SDL2_ttf, libvorbis, gettext
+{ lib, stdenv, fetchurl, SDL2, libGL, libpng, libjpeg, SDL2_ttf, libvorbis, gettext
 , physfs }:
 
 stdenv.mkDerivation rec {
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
     homepage = "https://neverball.org/";
     description = "Tilt the floor to roll a ball";
     license = "GPL";
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
+    maintainers = with lib.maintainers; [viric];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/games/nexuiz/default.nix b/pkgs/games/nexuiz/default.nix
index e055e27d2cd..60085d5c85b 100644
--- a/pkgs/games/nexuiz/default.nix
+++ b/pkgs/games/nexuiz/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , # required for both
   unzip, zlib, curl, libjpeg, libpng, libvorbis, libtheora
 , libogg, libmodplug
@@ -11,7 +11,7 @@
 let
   version = "2.5.2";
 
-  version_short = stdenv.lib.replaceChars [ "." ] [ "" ] version;
+  version_short = lib.replaceChars [ "." ] [ "" ] version;
 in stdenv.mkDerivation {
   pname = "nexuiz";
   inherit version;
@@ -71,7 +71,7 @@ in stdenv.mkDerivation {
   meta = {
     description = "A free fast-paced first-person shooter";
     homepage = "http://www.alientrap.org/games/nexuiz";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/njam/default.nix b/pkgs/games/njam/default.nix
index 5022a92a7cd..1833840d2e3 100644
--- a/pkgs/games/njam/default.nix
+++ b/pkgs/games/njam/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, SDL, SDL_image, SDL_mixer, SDL_net }:
+{lib, stdenv, fetchurl, SDL, SDL_image, SDL_mixer, SDL_net }:
 
 stdenv.mkDerivation {
   name = "njam-1.25";
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://trackballs.sourceforge.net/";
     description = "Cross-platform pacman-like game";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/nudoku/default.nix b/pkgs/games/nudoku/default.nix
index d10807071a9..b8ef2b3cbed 100644
--- a/pkgs/games/nudoku/default.nix
+++ b/pkgs/games/nudoku/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkgconfig gettext ];
   buildInputs = [ ncurses ];
 
-  configureFlags = stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-nls";
+  configureFlags = lib.optional stdenv.hostPlatform.isMusl "--disable-nls";
 
   meta = with lib; {
     description = "An ncurses based sudoku game";
diff --git a/pkgs/games/nxengine-evo/default.nix b/pkgs/games/nxengine-evo/default.nix
index 909737a6804..e3df235b757 100644
--- a/pkgs/games/nxengine-evo/default.nix
+++ b/pkgs/games/nxengine-evo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchpatch
 , fetchurl
 , cmake
@@ -54,12 +54,12 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "A complete open-source clone/rewrite of the masterpiece jump-and-run platformer Doukutsu Monogatari (also known as Cave Story)";
-    license = with stdenv.lib.licenses; [
+    license = with lib.licenses; [
       gpl3                   # Game engine
       unfreeRedistributable  # Game assets, freeware
     ];
-    maintainers = [ stdenv.lib.maintainers.scubed2 ];
+    maintainers = [ lib.maintainers.scubed2 ];
     homepage = "https://github.com/nxengine/nxengine-evo";
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/odamex/default.nix b/pkgs/games/odamex/default.nix
index ba220a720cd..de66d8996b4 100644
--- a/pkgs/games/odamex/default.nix
+++ b/pkgs/games/odamex/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cmake, fetchurl, pkgconfig, SDL, SDL_mixer, SDL_net, wxGTK30 }:
+{ lib, stdenv, cmake, fetchurl, pkgconfig, SDL, SDL_mixer, SDL_net, wxGTK30 }:
 
 stdenv.mkDerivation rec {
   pname = "odamex";
@@ -15,8 +15,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://odamex.net/";
     description = "A client/server port for playing old-school Doom online";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = with stdenv.lib.maintainers; [ MP2E ];
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.linux;
+    maintainers = with lib.maintainers; [ MP2E ];
   };
 }
diff --git a/pkgs/games/oilrush/default.nix b/pkgs/games/oilrush/default.nix
index 6a05a566524..b78baee725d 100644
--- a/pkgs/games/oilrush/default.nix
+++ b/pkgs/games/oilrush/default.nix
@@ -1,7 +1,7 @@
-{ stdenv, config, fetchurl, libX11, libXext, libXinerama, libXrandr
+{ lib, stdenv, config, fetchurl, libX11, libXext, libXinerama, libXrandr
 , libXrender, fontconfig, freetype, openal, runtimeShell }:
 
-let inherit (stdenv.lib) makeLibraryPath; in
+let inherit (lib) makeLibraryPath; in
 
 stdenv.mkDerivation {
   name = "oilrush";
@@ -69,9 +69,9 @@ stdenv.mkDerivation {
       of Tower Defense.
     '';
     homepage = "http://oilrush-game.com/";
-    license = stdenv.lib.licenses.unfree;
-    #maintainers = with stdenv.lib.maintainers; [ astsmtl ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.unfree;
+    #maintainers = with lib.maintainers; [ astsmtl ];
+    platforms = lib.platforms.linux;
     hydraPlatforms = [];
   };
 
diff --git a/pkgs/games/openarena/default.nix b/pkgs/games/openarena/default.nix
index 577eafb6a8c..7b1f793895e 100644
--- a/pkgs/games/openarena/default.nix
+++ b/pkgs/games/openarena/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, makeWrapper, patchelf, pkgs, stdenv, SDL, libglvnd, libogg, libvorbis, curl, openal }:
+{ lib, fetchurl, makeWrapper, patchelf, pkgs, stdenv, SDL, libglvnd, libogg, libvorbis, curl, openal }:
 
 stdenv.mkDerivation {
   pname = "openarena";
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
   installPhase = let
     gameDir = "$out/openarena-$version";
     interpreter = "$(< \"$NIX_CC/nix-support/dynamic-linker\")";
-    libPath = stdenv.lib.makeLibraryPath [ SDL libglvnd libogg libvorbis curl openal ];
+    libPath = lib.makeLibraryPath [ SDL libglvnd libogg libvorbis curl openal ];
     arch = {
       "x86_64-linux" = "x86_64";
       "i386-linux" = "i386";
@@ -36,8 +36,8 @@ stdenv.mkDerivation {
   meta = {
     description = "Crossplatform openarena client";
     homepage = "http://openarena.ws/";
-    maintainers = [ stdenv.lib.maintainers.wyvie ];
+    maintainers = [ lib.maintainers.wyvie ];
     platforms = [ "i386-linux" "x86_64-linux" ];
-    license = stdenv.lib.licenses.gpl2;
+    license = lib.licenses.gpl2;
   };
 }
diff --git a/pkgs/games/openclonk/default.nix b/pkgs/games/openclonk/default.nix
index db9b4760b25..dff9eea788f 100644
--- a/pkgs/games/openclonk/default.nix
+++ b/pkgs/games/openclonk/default.nix
@@ -20,7 +20,7 @@ in stdenv.mkDerivation rec {
 
   postInstall = ''
     mv -v $out/games/openclonk $out/bin/
-  '' + stdenv.lib.optionalString enableSoundtrack ''
+  '' + lib.optionalString enableSoundtrack ''
     ln -sv ${soundtrack_src} $out/share/games/openclonk/Music.ocg
   '';
 
diff --git a/pkgs/games/openlierox/default.nix b/pkgs/games/openlierox/default.nix
index 7bda06b8457..fefac190b0a 100644
--- a/pkgs/games/openlierox/default.nix
+++ b/pkgs/games/openlierox/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libX11, xorgproto, gd, SDL, SDL_image, SDL_mixer, zlib
+{ lib, stdenv, fetchurl, libX11, xorgproto, gd, SDL, SDL_image, SDL_mixer, zlib
 , libxml2, pkg-config, curl, cmake, libzip }:
 
 stdenv.mkDerivation {
@@ -35,7 +35,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://openlierox.net";
     description = "Real-time game with Worms-like shooting";
-    license = stdenv.lib.licenses.lgpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.lgpl2Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/openra/common.nix b/pkgs/games/openra/common.nix
index 51f94177177..4f90cecb16b 100644
--- a/pkgs/games/openra/common.nix
+++ b/pkgs/games/openra/common.nix
@@ -1,13 +1,13 @@
 /*  The reusable code, and package attributes, between OpenRA engine packages (engine.nix)
     and out-of-tree mod packages (mod.nix).
 */
-{ stdenv, makeSetupHook, curl, unzip, dos2unix, pkgconfig, makeWrapper
+{ lib, stdenv, makeSetupHook, curl, unzip, dos2unix, pkgconfig, makeWrapper
 , lua, mono, dotnetPackages, python
 , libGL, freetype, openal, SDL2
 , zenity
 }:
 
-with stdenv.lib;
+with lib;
 
 let
   path = makeBinPath ([ mono python ] ++ optional (zenity != null) zenity);
diff --git a/pkgs/games/openra/engine.nix b/pkgs/games/openra/engine.nix
index 7d2d007d075..365dc3d2679 100644
--- a/pkgs/games/openra/engine.nix
+++ b/pkgs/games/openra/engine.nix
@@ -7,14 +7,14 @@
     This package could be seen as providing a set of in-tree mods,
     while the `mod.nix` pacakges provide a single out-of-tree mod.
 */
-{ stdenv
+{ lib, stdenv
 , packageAttrs
 , patchEngine
 , wrapLaunchGame
 , engine
 }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation (recursiveUpdate packageAttrs rec {
   name = "${pname}-${version}";
diff --git a/pkgs/games/openra/mod.nix b/pkgs/games/openra/mod.nix
index 8df5922a441..4d0a18e6334 100644
--- a/pkgs/games/openra/mod.nix
+++ b/pkgs/games/openra/mod.nix
@@ -6,7 +6,7 @@
     The engine is relatively small and quick to build, so this is not much of a problem.
     Building a mod will result in a wrapper script that starts the mod inside the specified engine.
 */
-{ stdenv
+{ lib, stdenv
 , packageAttrs
 , patchEngine
 , wrapLaunchGame
@@ -14,7 +14,7 @@
 , engine
 }:
 
-with stdenv.lib;
+with lib;
 
 let
   engineSourceName = engine.src.name or "engine";
diff --git a/pkgs/games/openrw/default.nix b/pkgs/games/openrw/default.nix
index 7258ed6550c..4064023fafd 100644
--- a/pkgs/games/openrw/default.nix
+++ b/pkgs/games/openrw/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation {
 
   buildInputs = [
     sfml libGLU libGL bullet glm libmad xlibsWrapper openal SDL2 boost ffmpeg_3
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [ OpenAL Cocoa ];
+  ] ++ lib.optionals stdenv.isDarwin [ OpenAL Cocoa ];
 
   meta = with lib; {
     description = "Unofficial open source recreation of the classic Grand Theft Auto III game executable";
diff --git a/pkgs/games/openspades/default.nix b/pkgs/games/openspades/default.nix
index fdd429e376f..58ac3f8df79 100644
--- a/pkgs/games/openspades/default.nix
+++ b/pkgs/games/openspades/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [
     freetype SDL2 SDL2_image libGL zlib curl glew opusfile openal libogg
-  ] ++ stdenv.lib.optionals stdenv.hostPlatform.isDarwin [
+  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
     Cocoa
   ];
 
diff --git a/pkgs/games/openttd/default.nix b/pkgs/games/openttd/default.nix
index 8c0755127cb..8cb8ca8ea24 100644
--- a/pkgs/games/openttd/default.nix
+++ b/pkgs/games/openttd/default.nix
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig which makeWrapper ];
   buildInputs = [ SDL2 libpng xz zlib freetype fontconfig libxdg_basedir ]
-    ++ stdenv.lib.optionals withFluidSynth [ fluidsynth soundfont-fluid ];
+    ++ lib.optionals withFluidSynth [ fluidsynth soundfont-fluid ];
 
   prefixKey = "--prefix-dir=";
 
@@ -51,23 +51,23 @@ stdenv.mkDerivation rec {
   postInstall = ''
     mv $out/games/ $out/bin
 
-    ${stdenv.lib.optionalString withOpenGFX ''
+    ${lib.optionalString withOpenGFX ''
       cp ${opengfx}/* $out/share/games/openttd/baseset
     ''}
 
     mkdir -p $out/share/games/openttd/data
 
-    ${stdenv.lib.optionalString withOpenSFX ''
+    ${lib.optionalString withOpenSFX ''
       cp ${opensfx}/*.{obs,cat} $out/share/games/openttd/data
     ''}
 
     mkdir $out/share/games/openttd/baseset/openmsx
 
-    ${stdenv.lib.optionalString withOpenMSX ''
+    ${lib.optionalString withOpenMSX ''
       cp ${openmsx}/*.{obm,mid} $out/share/games/openttd/baseset/openmsx
     ''}
 
-    ${stdenv.lib.optionalString withFluidSynth ''
+    ${lib.optionalString withFluidSynth ''
       wrapProgram $out/bin/openttd \
         --add-flags -m \
         --add-flags extmidi:cmd=${playmidi}/bin/playmidi
diff --git a/pkgs/games/opentyrian/default.nix b/pkgs/games/opentyrian/default.nix
index 9872a3ee05f..43c8e08c79f 100644
--- a/pkgs/games/opentyrian/default.nix
+++ b/pkgs/games/opentyrian/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, fetchzip, SDL, SDL_net}:
+{ lib, stdenv, fetchurl, fetchzip, SDL, SDL_net }:
 
 stdenv.mkDerivation rec {
   pname = "opentyrian";
@@ -31,6 +31,6 @@ stdenv.mkDerivation rec {
     description = ''Open source port of the game "Tyrian"'';
     homepage = "https://bitbucket.org/opentyrian/opentyrian";
     # This does not account of Tyrian data.
-    # license = stdenv.lib.licenses.gpl2;
+    # license = lib.licenses.gpl2;
   };
 }
diff --git a/pkgs/games/openxcom/default.nix b/pkgs/games/openxcom/default.nix
index 3ec18640054..8c115e9b312 100644
--- a/pkgs/games/openxcom/default.nix
+++ b/pkgs/games/openxcom/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, cmake, libGLU, libGL, zlib, openssl, libyamlcpp, boost
+{lib, stdenv, fetchFromGitHub, cmake, libGLU, libGL, zlib, openssl, libyamlcpp, boost
 , SDL, SDL_image, SDL_mixer, SDL_gfx }:
 
 let version = "1.0.0.2019.10.18"; in
@@ -19,9 +19,9 @@ stdenv.mkDerivation {
     description = "Open source clone of UFO: Enemy Unknown";
     homepage = "https://openxcom.org";
     repositories.git = "https://github.com/SupSuper/OpenXcom.git";
-    maintainers = [ stdenv.lib.maintainers.cpages ];
-    platforms = stdenv.lib.platforms.linux;
-    license = stdenv.lib.licenses.gpl3;
+    maintainers = [ lib.maintainers.cpages ];
+    platforms = lib.platforms.linux;
+    license = lib.licenses.gpl3;
   };
 
 }
diff --git a/pkgs/games/papermc/default.nix b/pkgs/games/papermc/default.nix
index 15b05b56d84..f06d41495a8 100644
--- a/pkgs/games/papermc/default.nix
+++ b/pkgs/games/papermc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, bash, jre }:
+{ lib, stdenv, fetchurl, bash, jre }:
 let
   mcVersion = "1.16.4";
   buildNum = "296";
@@ -29,8 +29,8 @@ in stdenv.mkDerivation {
   meta = {
     description = "High-performance Minecraft Server";
     homepage    = "https://papermc.io/";
-    license     = stdenv.lib.licenses.gpl3Only;
-    platforms   = stdenv.lib.platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ aaronjanse ];
+    license     = lib.licenses.gpl3Only;
+    platforms   = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ aaronjanse ];
   };
 }
diff --git a/pkgs/games/pingus/default.nix b/pkgs/games/pingus/default.nix
index 81e22b90e97..bc3b591d5c7 100644
--- a/pkgs/games/pingus/default.nix
+++ b/pkgs/games/pingus/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchgit, cmake, SDL2, SDL2_image, boost, libpng, SDL2_mixer
+{lib, stdenv, fetchgit, cmake, SDL2, SDL2_image, boost, libpng, SDL2_mixer
 , pkgconfig, libGLU, libGL, git, jsoncpp }:
 stdenv.mkDerivation rec {
   pname = "pingus";
@@ -15,8 +15,8 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = ''A puzzle game with mechanics similar to Lemmings'';
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    license = stdenv.lib.licenses.gpl3;
+    platforms = lib.platforms.linux;
+    maintainers = [lib.maintainers.raskin];
+    license = lib.licenses.gpl3;
   };
 }
diff --git a/pkgs/games/planetaryannihilation/default.nix b/pkgs/games/planetaryannihilation/default.nix
index 768e0a1d724..7dbca783b67 100644
--- a/pkgs/games/planetaryannihilation/default.nix
+++ b/pkgs/games/planetaryannihilation/default.nix
@@ -34,19 +34,19 @@ stdenv.mkDerivation {
     ln -s ${systemd}/lib/libudev.so.1 $out/lib/libudev.so.0
 
     patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$out/PA"
-    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath "${stdenv.lib.makeLibraryPath [ stdenv.cc.cc.lib xorg.libXdamage xorg.libXfixes gtk2 glib stdenv.glibc.out "$out" xorg.libXext pango udev xorg.libX11 xorg.libXcomposite alsaLib atk nspr fontconfig cairo pango nss freetype gnome2.GConf gdk-pixbuf xorg.libXrender ]}:{stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/lib64" "$out/host/CoherentUI_Host"
+    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib xorg.libXdamage xorg.libXfixes gtk2 glib stdenv.glibc.out "$out" xorg.libXext pango udev xorg.libX11 xorg.libXcomposite alsaLib atk nspr fontconfig cairo pango nss freetype gnome2.GConf gdk-pixbuf xorg.libXrender ]}:{stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/lib64" "$out/host/CoherentUI_Host"
 
-    wrapProgram $out/PA --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ stdenv.cc.cc.lib stdenv.glibc.out xorg.libX11 xorg.libXcursor gtk2 glib curl "$out" ]}:${stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/lib64"
+    wrapProgram $out/PA --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc.lib stdenv.glibc.out xorg.libX11 xorg.libXcursor gtk2 glib curl "$out" ]}:${stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/lib64"
 
     for f in $out/lib/*; do
-      patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ stdenv.cc.cc.lib curl xorg.libX11 stdenv.glibc.out xorg.libXcursor "$out" ]}:${stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/lib64" $f
+      patchelf --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib curl xorg.libX11 stdenv.glibc.out xorg.libXcursor "$out" ]}:${stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/lib64" $f
     done
   '';
 
   meta = with lib; {
     homepage = "http://www.uberent.com/pa/";
     description = "Next-generation RTS that takes the genre to a planetary scale";
-    license = stdenv.lib.licenses.unfree;
+    license = lib.licenses.unfree;
     platforms = platforms.linux;
     maintainers = [ maintainers.domenkozar ];
   };
diff --git a/pkgs/games/pokerth/default.nix b/pkgs/games/pokerth/default.nix
index 00b1f68e137..56f0d5a47f2 100644
--- a/pkgs/games/pokerth/default.nix
+++ b/pkgs/games/pokerth/default.nix
@@ -1,10 +1,8 @@
-{ mkDerivation, stdenv, fetchFromGitHub, runCommand, fetchpatch, patchutils, qmake, qtbase
+{ lib, mkDerivation, stdenv, fetchFromGitHub, runCommand, fetchpatch, patchutils, qmake, qtbase
 , SDL, SDL_mixer, boost, curl, gsasl, libgcrypt, libircclient, protobuf, sqlite
 , wrapQtAppsHook
 , tinyxml2, target ? "client" }:
 
-with stdenv.lib;
-
 let
   hiDPI = fetchpatch {
     url = "https://github.com/pokerth/pokerth/commit/ad8c9cabfb85d8293720d0f14840278d38b5feeb.patch";
@@ -65,7 +63,7 @@ mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = {
+  meta = with lib; {
     homepage = "https://www.pokerth.net";
     description = "Poker game ${target}";
     license = licenses.gpl3;
diff --git a/pkgs/games/pong3d/default.nix b/pkgs/games/pong3d/default.nix
index c7817041f7a..3cd017e8d3b 100644
--- a/pkgs/games/pong3d/default.nix
+++ b/pkgs/games/pong3d/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, libX11}:
+{lib, stdenv, fetchurl, libX11}:
 
 stdenv.mkDerivation {
   name = "3dpong-0.5";
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://www.newbreedsoftware.com/3dpong/";
     description = "One or two player 3d sports game based on Pong from Atari";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/prboom/default.nix b/pkgs/games/prboom/default.nix
index 278aa8a93ea..4bd59c9e39d 100644
--- a/pkgs/games/prboom/default.nix
+++ b/pkgs/games/prboom/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL, SDL_mixer, SDL_net
+{ lib, stdenv, fetchurl, SDL, SDL_mixer, SDL_net
 , libGLU ? null
 , libGL ? null
 , useOpenGL ? stdenv.hostPlatform == stdenv.buildPlatform
@@ -14,21 +14,21 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ SDL SDL_mixer SDL_net ]
-    ++ stdenv.lib.optionals useOpenGL [ libGL libGLU ];
+    ++ lib.optionals useOpenGL [ libGL libGLU ];
 
   doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
 
   configureFlags = [
-    (stdenv.lib.enableFeature useOpenGL "gl")
-    (stdenv.lib.enableFeature doCheck "sdltest")
-  ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    (lib.enableFeature useOpenGL "gl")
+    (lib.enableFeature doCheck "sdltest")
+  ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "--disable-cpu-opt"
     "--without-x"
     "ac_cv_type_uid_t=yes"
     "ac_cv_type_gid_t=yes"
   ];
 
-  postInstall = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+  postInstall = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
     mv $out/games/ $out/bin
   '';
 }
diff --git a/pkgs/games/quake2/yquake2/wrapper.nix b/pkgs/games/quake2/yquake2/wrapper.nix
index 9ab086f96a2..4850dff99dc 100644
--- a/pkgs/games/quake2/yquake2/wrapper.nix
+++ b/pkgs/games/quake2/yquake2/wrapper.nix
@@ -12,7 +12,7 @@ let
   };
 
 in stdenv.mkDerivation {
-  name = "${name}-${stdenv.lib.getVersion yquake2}";
+  name = "${name}-${lib.getVersion yquake2}";
 
   nativeBuildInputs = [ makeWrapper ];
 
diff --git a/pkgs/games/quake3/wrapper/default.nix b/pkgs/games/quake3/wrapper/default.nix
index 4ab53d67732..3cb64641153 100644
--- a/pkgs/games/quake3/wrapper/default.nix
+++ b/pkgs/games/quake3/wrapper/default.nix
@@ -1,6 +1,6 @@
 { stdenv, buildEnv, lib, libGL, ioquake3, makeWrapper }:
 
-{ paks, name ? (stdenv.lib.head paks).name, description ? "" }:
+{ paks, name ? (lib.head paks).name, description ? "" }:
 
 let
   libPath = lib.makeLibraryPath [ libGL stdenv.cc.cc ];
diff --git a/pkgs/games/quakespasm/default.nix b/pkgs/games/quakespasm/default.nix
index 1e8de1a18f0..64b7c8f7920 100644
--- a/pkgs/games/quakespasm/default.nix
+++ b/pkgs/games/quakespasm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, SDL, fetchurl, gzip, libvorbis, libmad }:
+{ lib, stdenv, SDL, fetchurl, gzip, libvorbis, libmad }:
 stdenv.mkDerivation rec {
   pname = "quakespasm";
   majorVersion = "0.93";
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
       and smoother mouse input - though no CD support.
     '';
 
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.m3tti ];
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.m3tti ];
   };
 }
diff --git a/pkgs/games/quantumminigolf/default.nix b/pkgs/games/quantumminigolf/default.nix
index 1a8cbbea5f9..524559bc6f7 100644
--- a/pkgs/games/quantumminigolf/default.nix
+++ b/pkgs/games/quantumminigolf/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, fftwSinglePrec, freetype, SDL, SDL_ttf}:
+{lib, stdenv, fetchurl, fftwSinglePrec, freetype, SDL, SDL_ttf}:
 let
   s = # Generated upstream information
   rec {
@@ -33,8 +33,8 @@ stdenv.mkDerivation {
   meta = {
     inherit (s) version;
     description = ''Quantum mechanics-based minigolf-like game'';
-    license = stdenv.lib.licenses.gpl2 ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2 ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/r2mod_cli/default.nix b/pkgs/games/r2mod_cli/default.nix
index edf53482ac3..b81f1814ac9 100644
--- a/pkgs/games/r2mod_cli/default.nix
+++ b/pkgs/games/r2mod_cli/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   makeFlags = [ "PREFIX=$(out)" ];
 
   postInstall = ''
-    wrapProgram $out/bin/r2mod --prefix PATH : "${stdenv.lib.makeBinPath [ jq p7zip ]}";
+    wrapProgram $out/bin/r2mod --prefix PATH : "${lib.makeBinPath [ jq p7zip ]}";
   '';
 
   meta = with lib; {
diff --git a/pkgs/games/racer/default.nix b/pkgs/games/racer/default.nix
index a5d9a911afa..dfbe9bc45e1 100644
--- a/pkgs/games/racer/default.nix
+++ b/pkgs/games/racer/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, allegro, libjpeg, makeWrapper }:
+{ fetchurl, lib, stdenv, allegro, libjpeg, makeWrapper }:
 
 stdenv.mkDerivation {
   name = "racer-1.1";
@@ -25,7 +25,7 @@ stdenv.mkDerivation {
   meta = {
     description = "Car racing game";
     homepage = "http://hippo.nipax.cz/download.en.php";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/residualvm/default.nix b/pkgs/games/residualvm/default.nix
index da003c3190f..51dd4f90860 100644
--- a/pkgs/games/residualvm/default.nix
+++ b/pkgs/games/residualvm/default.nix
@@ -1,12 +1,10 @@
-{ stdenv, fetchurl, SDL, zlib, libmpeg2, libmad, libogg, libvorbis, flac, alsaLib
-, libGLSupported ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
+{ lib, stdenv, fetchurl, SDL, zlib, libmpeg2, libmad, libogg, libvorbis, flac, alsaLib
+, libGLSupported ? lib.elem stdenv.hostPlatform.system lib.platforms.mesaPlatforms
 , openglSupport ? libGLSupported, libGLU, libGL ? null
 }:
 
 assert openglSupport -> libGL != null && libGLU != null;
 
-with stdenv.lib;
-
 stdenv.mkDerivation rec {
   version = "0.1.1";
   pname = "residualvm";
@@ -17,15 +15,15 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ stdenv SDL zlib libmpeg2 libmad libogg libvorbis flac alsaLib ]
-    ++ optionals openglSupport [ libGL libGLU ];
+    ++ lib.optionals openglSupport [ libGL libGLU ];
 
   configureFlags = [ "--enable-all-engines" ];
 
-  meta = {
+  meta = with lib; {
     description = "Interpreter for LucasArts' Lua-based 3D adventure games";
     homepage = "http://residualvm.org/";
     repositories.git = "https://github.com/residualvm/residualvm.git";
     license = licenses.gpl2;
-    platforms = stdenv.lib.platforms.linux;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/games/rftg/default.nix b/pkgs/games/rftg/default.nix
index 966f903888b..1272521e55f 100644
--- a/pkgs/games/rftg/default.nix
+++ b/pkgs/games/rftg/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gtk2, pkgconfig }:
+{ lib, stdenv, fetchurl, gtk2, pkgconfig }:
 
 stdenv.mkDerivation rec {
 
@@ -16,8 +16,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://keldon.net/rftg/";
     description = "Implementation of the card game Race for the Galaxy, including an AI";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = [ stdenv.lib.maintainers.falsifian ];
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.falsifian ];
   };
 
 }
diff --git a/pkgs/games/rigsofrods/default.nix b/pkgs/games/rigsofrods/default.nix
index f1e1c50a596..01dd1f0c04f 100644
--- a/pkgs/games/rigsofrods/default.nix
+++ b/pkgs/games/rigsofrods/default.nix
@@ -1,4 +1,4 @@
-{ fetchFromGitHub, stdenv, wxGTK30, freeimage, cmake, zziplib, libGLU, libGL, boost,
+{ fetchFromGitHub, lib, stdenv, wxGTK30, freeimage, cmake, zziplib, libGLU, libGL, boost,
   pkg-config, libuuid, openal, ogre, ois, curl, gtk2, mygui, unzip,
   angelscript, ogrepaged, mysocketw, libxcb
   }:
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     libuuid openal ogre ois curl gtk2 mygui unzip angelscript
     ogrepaged mysocketw libxcb ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "3D simulator game where you can drive, fly and sail various vehicles";
     homepage = "http://rigsofrods.sourceforge.net/";
     license = licenses.gpl3;
diff --git a/pkgs/games/rili/default.nix b/pkgs/games/rili/default.nix
index 0b7fa118f80..0e3fa9b8cc8 100644
--- a/pkgs/games/rili/default.nix
+++ b/pkgs/games/rili/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL_mixer, SDL, autoreconfHook }:
+{ lib, stdenv, fetchurl, SDL_mixer, SDL, autoreconfHook }:
 
 stdenv.mkDerivation {
   name = "ri_li-2.0.1";
@@ -17,14 +17,14 @@ stdenv.mkDerivation {
 
   meta = {
     homepage = "http://ri-li.sourceforge.net";
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
     description = "A children's train game";
     longDescription = ''
      Ri-li is an arcade game licensed under the GPL (General Public License).
 You drive a toy wood engine in many levels and you must collect all the coaches
 to win.
     '';
-    maintainers = with stdenv.lib.maintainers; [ jcumming ];
-    platforms = with stdenv.lib.platforms; linux;
+    maintainers = with lib.maintainers; [ jcumming ];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/games/robotfindskitten/default.nix b/pkgs/games/robotfindskitten/default.nix
index 73beba2e34f..95a168b7d2a 100644
--- a/pkgs/games/robotfindskitten/default.nix
+++ b/pkgs/games/robotfindskitten/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, pkgconfig, ncurses }:
+{ lib, stdenv, fetchurl, pkgconfig, ncurses }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
 
   pname = "robotfindskitten";
diff --git a/pkgs/games/scid-vs-pc/default.nix b/pkgs/games/scid-vs-pc/default.nix
index bb33faf7374..33373e0e7b1 100644
--- a/pkgs/games/scid-vs-pc/default.nix
+++ b/pkgs/games/scid-vs-pc/default.nix
@@ -74,9 +74,9 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Chess database with play and training functionality";
     homepage = "http://scidvspc.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl2;
+    license = lib.licenses.gpl2;
     maintainers = [ maintainers.paraseba ];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
 
diff --git a/pkgs/games/scid/default.nix b/pkgs/games/scid/default.nix
index b3d22d4c0f9..f0fdef8e62e 100644
--- a/pkgs/games/scid/default.nix
+++ b/pkgs/games/scid/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, tcl, tk, libX11, zlib, makeWrapper }:
+{ lib, stdenv, fetchurl, tcl, tk, libX11, zlib, makeWrapper }:
 
 stdenv.mkDerivation {
   pname = "scid";
@@ -52,6 +52,6 @@ stdenv.mkDerivation {
   meta = {
     description = "Chess database with play and training functionality";
     homepage = "http://scid.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl2;
+    license = lib.licenses.gpl2;
   };
 }
diff --git a/pkgs/games/scrolls/default.nix b/pkgs/games/scrolls/default.nix
index a435a240ede..13079e15984 100644
--- a/pkgs/games/scrolls/default.nix
+++ b/pkgs/games/scrolls/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gcc
+{ lib, stdenv, fetchurl, gcc
 , libGLU, libX11, libXext, libXcursor, libpulseaudio
 }:
 stdenv.mkDerivation {
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
 
     platforms = [ "x86_64-linux" ];
 
-    license = stdenv.lib.licenses.unfree;
+    license = lib.licenses.unfree;
   };
 
   src = fetchurl {
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
     sha256 = "ead1fd14988aa07041fedfa7f845c756cd5077a5a402d85bfb749cb669ececec";
   };
 
-  libPath = stdenv.lib.makeLibraryPath [
+  libPath = lib.makeLibraryPath [
     gcc
     libGLU
     libX11
diff --git a/pkgs/games/sil/default.nix b/pkgs/games/sil/default.nix
index 208a14dc1c5..3128ed5358b 100644
--- a/pkgs/games/sil/default.nix
+++ b/pkgs/games/sil/default.nix
@@ -1,5 +1,5 @@
-{ stdenv, fetchzip, ncurses, libX11, libXaw, libXt, libXext, libXmu, makeWrapper, writeScript, ... }:
-let 
+{ lib, stdenv, fetchzip, ncurses, libX11, libXaw, libXt, libXext, libXmu, makeWrapper, writeScript, ... }:
+let
   setup = writeScript "setup" ''
     mkdir -p "$ANGBAND_PATH"
     # Copy all the data files into place
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   prePatch = ''
     # Allow usage of ANGBAND_PATH
-    substituteInPlace config.h --replace "#define FIXED_PATHS" "" 
+    substituteInPlace config.h --replace "#define FIXED_PATHS" ""
   '';
 
   preConfigure = ''
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
     mkdir -p $out/bin
     cp sil $out/bin/sil
     # Wrap the program to set a user-local ANGBAND_PATH, and run the setup script to copy files into place
-    # We could just use the options for a user-local save and scores dir, but it tried to write to the 
+    # We could just use the options for a user-local save and scores dir, but it tried to write to the
     # lib directory anyway, so we might as well give everyone a copy
     wrapProgram $out/bin/sil \
       --run "set -u" \
@@ -49,15 +49,15 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A rouge-like game set in the first age of Middle-earth";
     longDescription = ''
-      A game of adventure set in the first age of Middle-earth, when the world still 
+      A game of adventure set in the first age of Middle-earth, when the world still
       rang with elven song and gleamed with dwarven mail.
 
-      Walk the dark halls of Angband.  Slay creatures black and fell.  Wrest a shining 
+      Walk the dark halls of Angband.  Slay creatures black and fell.  Wrest a shining
       Silmaril from Morgoth’s iron crown.
     '';
     homepage = "http://www.amirrorclear.net/flowers/game/sil/index.html";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = [ stdenv.lib.maintainers.michaelpj ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.michaelpj ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/simutrans/default.nix b/pkgs/games/simutrans/default.nix
index b45a182cc01..97fc0b3104d 100644
--- a/pkgs/games/simutrans/default.nix
+++ b/pkgs/games/simutrans/default.nix
@@ -6,7 +6,7 @@ let
   # Choose your "paksets" of objects, images, text, music, etc.
   paksets = config.simutrans.paksets or "pak64 pak64.japan pak128 pak128.britain pak128.german";
 
-  result = with stdenv.lib; withPaks (
+  result = with lib; withPaks (
     if paksets == "*" then attrValues pakSpec # taking all
       else map (name: pakSpec.${name}) (splitString " " paksets)
   );
@@ -24,7 +24,7 @@ let
 
 
   # As of 2015/03, many packsets still didn't have a release for version 120.
-  pakSpec = stdenv.lib.mapAttrs
+  pakSpec = lib.mapAttrs
     (pakName: attrs: mkPak (attrs // {inherit pakName;}))
   {
     pak64 = {
diff --git a/pkgs/games/sm64ex/default.nix b/pkgs/games/sm64ex/default.nix
index 1e678a49f05..24ff2283791 100644
--- a/pkgs/games/sm64ex/default.nix
+++ b/pkgs/games/sm64ex/default.nix
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ audiofile SDL2 hexdump ];
 
   makeFlags = [ "VERSION=${region}" ] ++ compileFlags
-    ++ stdenv.lib.optionals stdenv.isDarwin [ "OSX_BUILD=1" ];
+    ++ lib.optionals stdenv.isDarwin [ "OSX_BUILD=1" ];
 
   inherit baseRom;
 
diff --git a/pkgs/games/soldat-unstable/default.nix b/pkgs/games/soldat-unstable/default.nix
index 0278afc5e40..d48cf3048ee 100644
--- a/pkgs/games/soldat-unstable/default.nix
+++ b/pkgs/games/soldat-unstable/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, fpc, zip, makeWrapper
+{ lib, stdenv, fetchFromGitHub, fetchpatch, fpc, zip, makeWrapper
 , SDL2, freetype, physfs, openal, gamenetworkingsockets
 , xorg, autoPatchelfHook
 }:
@@ -27,7 +27,7 @@ let
       install -Dm644 client/play-regular.ttf -t $out/share/soldat
     '';
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       description = "Soldat's base game content";
       license = licenses.cc-by-40;
       platforms = platforms.all;
@@ -109,7 +109,7 @@ stdenv.mkDerivation rec {
     done
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Soldat is a unique 2D (side-view) multiplayer action game";
     license = [ licenses.mit base.meta.license ];
     inherit (src.meta) homepage;
diff --git a/pkgs/games/speed-dreams/default.nix b/pkgs/games/speed-dreams/default.nix
index 473409ffae9..3bf368e807b 100644
--- a/pkgs/games/speed-dreams/default.nix
+++ b/pkgs/games/speed-dreams/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, libGLU, libGL, freeglut, libX11, plib, openal, freealut, libXrandr, xorgproto,
+{ fetchurl, lib, stdenv, libGLU, libGL, freeglut, libX11, plib, openal, freealut, libXrandr, xorgproto,
 libXext, libSM, libICE, libXi, libXt, libXrender, libXxf86vm, openscenegraph, expat,
 libpng, zlib, bash, SDL2, enet, libjpeg, cmake, pkgconfig, libvorbis, runtimeShell, curl }:
 
@@ -65,9 +65,9 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Car racing game - TORCS fork with more experimental approach";
     homepage = "http://speed-dreams.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = with stdenv.lib.maintainers; [raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    maintainers = with lib.maintainers; [raskin];
+    platforms = lib.platforms.linux;
     hydraPlatforms = [];
   };
 }
diff --git a/pkgs/games/spring/default.nix b/pkgs/games/spring/default.nix
index 9bc204c08d0..fe16a8a0403 100644
--- a/pkgs/games/spring/default.nix
+++ b/pkgs/games/spring/default.nix
@@ -44,14 +44,14 @@ stdenv.mkDerivation rec {
   buildInputs = [ lzma boost libdevil zlib p7zip openal libvorbis freetype SDL2
     xorg.libX11 xorg.libXcursor libGLU libGL glew curl
     systemd libunwind which minizip ]
-    ++ stdenv.lib.optional withAI jdk
-    ++ stdenv.lib.optional withAI python;
+    ++ lib.optional withAI jdk
+    ++ lib.optional withAI python;
 
   NIX_CFLAGS_COMPILE = "-fpermissive"; # GL header minor incompatibility
 
   postInstall = ''
     wrapProgram "$out/bin/spring" \
-      --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ stdenv.cc.cc systemd ]}"
+      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc systemd ]}"
   '';
 
   meta = with lib; {
diff --git a/pkgs/games/steam/steam.nix b/pkgs/games/steam/steam.nix
index f7ef287c1ff..43c1512c650 100644
--- a/pkgs/games/steam/steam.nix
+++ b/pkgs/games/steam/steam.nix
@@ -17,7 +17,7 @@ in stdenv.mkDerivation {
 
   postInstall = ''
     rm $out/bin/steamdeps
-    ${stdenv.lib.optionalString traceDeps ''
+    ${lib.optionalString traceDeps ''
       cat > $out/bin/steamdeps <<EOF
       #!${runtimeShell}
       echo \$1 >> ${traceLog}
diff --git a/pkgs/games/tcl2048/default.nix b/pkgs/games/tcl2048/default.nix
index 765c50149ac..734e7be3666 100644
--- a/pkgs/games/tcl2048/default.nix
+++ b/pkgs/games/tcl2048/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, tcl, tcllib, runtimeShell }:
+{ lib, stdenv, fetchurl, tcl, tcllib, runtimeShell }:
 
 stdenv.mkDerivation {
   name = "tcl2048-0.4.0";
@@ -27,8 +27,8 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://github.com/dbohdan/2048.tcl";
     description = "The game of 2048 implemented in Tcl";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.all;
-    maintainers = with stdenv.lib.maintainers; [ dbohdan ];
+    license = lib.licenses.mit;
+    platforms = lib.platforms.all;
+    maintainers = with lib.maintainers; [ dbohdan ];
   };
 }
diff --git a/pkgs/games/teetertorture/default.nix b/pkgs/games/teetertorture/default.nix
index a568fd79085..9df0843c5e4 100644
--- a/pkgs/games/teetertorture/default.nix
+++ b/pkgs/games/teetertorture/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, SDL, SDL_image, SDL_mixer}:
+{ lib, stdenv, fetchurl, SDL, SDL_image, SDL_mixer }:
 
 stdenv.mkDerivation {
   name = "teeter-torture-20051018";
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://www.newbreedsoftware.com/teetertorture/";
     description = "Simple shooting game with your cannon is sitting atop a teeter totter";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/teeworlds/default.nix b/pkgs/games/teeworlds/default.nix
index 9ff50d533be..09193232d32 100644
--- a/pkgs/games/teeworlds/default.nix
+++ b/pkgs/games/teeworlds/default.nix
@@ -1,4 +1,4 @@
-{ fetchFromGitHub, stdenv, cmake, pkgconfig, python3, alsaLib
+{ fetchFromGitHub, lib, stdenv, cmake, pkgconfig, python3, alsaLib
 , libX11, libGLU, SDL2, lua5_3, zlib, freetype, wavpack, icoutils
 , nixosTests
 }:
@@ -51,7 +51,7 @@ stdenv.mkDerivation rec {
 
     homepage = "https://teeworlds.com/";
     license = "BSD-style, see `license.txt'";
-    maintainers = with stdenv.lib.maintainers; [ astsmtl ];
-    platforms = stdenv.lib.platforms.linux;
+    maintainers = with lib.maintainers; [ astsmtl ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/the-powder-toy/default.nix b/pkgs/games/the-powder-toy/default.nix
index 084a4103bd5..37d4553be6b 100644
--- a/pkgs/games/the-powder-toy/default.nix
+++ b/pkgs/games/the-powder-toy/default.nix
@@ -1,4 +1,3 @@
-
 { lib, stdenv, fetchFromGitHub, scons, pkgconfig, SDL2, lua, fftwFloat,
   zlib, bzip2, curl, darwin }:
 
@@ -15,7 +14,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ scons pkgconfig ];
 
-  propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin
+  propagatedBuildInputs = lib.optionals stdenv.isDarwin
     [ darwin.apple_sdk.frameworks.Cocoa ];
 
   buildInputs = [ SDL2 lua fftwFloat zlib bzip2 curl ];
diff --git a/pkgs/games/tibia/default.nix b/pkgs/games/tibia/default.nix
index b8c2c3f3cf4..0892dc2dedd 100644
--- a/pkgs/games/tibia/default.nix
+++ b/pkgs/games/tibia/default.nix
@@ -1,6 +1,5 @@
-{ stdenv, fetchurl, glibc, libX11, runtimeShell, libGLU, libGL }:
+{ lib, stdenv, fetchurl, glibc, libX11, runtimeShell, libGLU, libGL }:
 
-with stdenv.lib;
 stdenv.mkDerivation {
   name = "tibia-10.90";
 
@@ -24,7 +23,7 @@ stdenv.mkDerivation {
     cp -r * $out/res
 
     patchelf --set-interpreter ${glibc.out}/lib/ld-linux.so.2 \
-             --set-rpath ${stdenv.lib.makeLibraryPath [ stdenv.cc.cc libX11 libGLU libGL ]} \
+             --set-rpath ${lib.makeLibraryPath [ stdenv.cc.cc libX11 libGLU libGL ]} \
              "$out/res/Tibia"
 
     # We've patchelf'd the files. The main ‘Tibia’ binary is a bit
@@ -50,8 +49,8 @@ stdenv.mkDerivation {
   meta = {
     description = "Top-down MMORPG set in a fantasy world";
     homepage = "http://tibia.com";
-    license = stdenv.lib.licenses.unfree;
+    license = lib.licenses.unfree;
     platforms = ["i686-linux"];
-    maintainers = with stdenv.lib.maintainers; [ ];
+    maintainers = with lib.maintainers; [ ];
   };
 }
diff --git a/pkgs/games/tinyfugue/default.nix b/pkgs/games/tinyfugue/default.nix
index fb706d38e18..763241f2909 100644
--- a/pkgs/games/tinyfugue/default.nix
+++ b/pkgs/games/tinyfugue/default.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchurl, ncurses, zlib
+{ lib, stdenv, fetchurl, ncurses, zlib
 , openssl ? null
 , sslSupport ? true
 }:
 
-with stdenv.lib;
+with lib;
 
 assert sslSupport -> openssl != null;
 
diff --git a/pkgs/games/torcs/default.nix b/pkgs/games/torcs/default.nix
index 136578924a0..d1dafb85ce3 100644
--- a/pkgs/games/torcs/default.nix
+++ b/pkgs/games/torcs/default.nix
@@ -1,4 +1,4 @@
-{ fetchpatch, fetchurl, stdenv, libGLU, freeglut, libX11, plib, openal, freealut, libXrandr, xorgproto,
+{ fetchpatch, fetchurl, lib, stdenv, libGLU, freeglut, libX11, plib, openal, freealut, libXrandr, xorgproto,
 libXext, libSM, libICE, libXi, libXt, libXrender, libXxf86vm, libvorbis,
 libpng, zlib, makeWrapper }:
 
@@ -42,9 +42,9 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Car racing game";
     homepage = "http://torcs.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    maintainers = with lib.maintainers; [viric];
+    platforms = lib.platforms.linux;
     hydraPlatforms = [];
   };
 }
diff --git a/pkgs/games/trackballs/default.nix b/pkgs/games/trackballs/default.nix
index 3eee4f17af1..4c7d2ba6956 100644
--- a/pkgs/games/trackballs/default.nix
+++ b/pkgs/games/trackballs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, SDL2, SDL2_ttf, gettext, zlib, SDL2_mixer, SDL2_image, guile, libGLU, libGL }:
+{ lib, stdenv, fetchFromGitHub, cmake, SDL2, SDL2_ttf, gettext, zlib, SDL2_mixer, SDL2_image, guile, libGLU, libGL }:
 
 stdenv.mkDerivation rec {
   pname = "trackballs";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ zlib SDL2 SDL2_ttf SDL2_mixer SDL2_image guile gettext libGLU libGL ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://trackballs.github.io/";
     description = "3D Marble Madness clone";
     platforms = platforms.linux;
diff --git a/pkgs/games/trigger/default.nix b/pkgs/games/trigger/default.nix
index 74a56f1fd40..cb3227f24e3 100644
--- a/pkgs/games/trigger/default.nix
+++ b/pkgs/games/trigger/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, runtimeShell, SDL2, freealut, SDL2_image, openal, physfs
+{ lib, fetchurl, stdenv, runtimeShell, SDL2, freealut, SDL2_image, openal, physfs
 , zlib, libGLU, libGL, glew, tinyxml-2 }:
 
 stdenv.mkDerivation rec {
@@ -47,8 +47,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A fast-paced single-player racing game";
     homepage = "http://trigger-rally.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.gpl2;
+    maintainers = with lib.maintainers; [viric];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/games/tuxpaint/default.nix b/pkgs/games/tuxpaint/default.nix
index a5bea42d04e..9e08b6c1e41 100644
--- a/pkgs/games/tuxpaint/default.nix
+++ b/pkgs/games/tuxpaint/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL, SDL_image, SDL_ttf, SDL_mixer, libpng,
+{ lib, stdenv, fetchurl, SDL, SDL_image, SDL_ttf, SDL_mixer, libpng,
   cairo, librsvg, gettext, libpaper, fribidi, pkgconfig, gperf, imagemagick }:
 
 stdenv.mkDerivation rec {
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
     mkdir -p $out/share/applications
     cp hildon/tuxpaint.xpm $out/share/pixmaps
     sed -e "s+Exec=tuxpaint+Exec=$out/bin/tuxpaint+" < src/tuxpaint.desktop > $out/share/applications/tuxpaint.desktop
- 
+
     # Install stamps
     tar xzf $stamps
     cd tuxpaint-stamps-2014.08.23
@@ -45,8 +45,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Open Source Drawing Software for Children";
     homepage = "http://www.tuxpaint.org/";
-    license = stdenv.lib.licenses.gpl3;
-    maintainers = with stdenv.lib.maintainers; [ woffs ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl3;
+    maintainers = with lib.maintainers; [ woffs ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/ue4/default.nix b/pkgs/games/ue4/default.nix
index 643779cf5fd..73b1cb38ca3 100644
--- a/pkgs/games/ue4/default.nix
+++ b/pkgs/games/ue4/default.nix
@@ -11,7 +11,7 @@ let
       ln -s ${lib.getAttr hash deps} .git/ue4-gitdeps/${prefix}/${hash}
     ''
   ) (lib.attrNames deps));
-  libPath = stdenv.lib.makeLibraryPath [
+  libPath = lib.makeLibraryPath [
     xorg.libX11 xorg.libXScrnSaver xorg.libXau xorg.libXcursor xorg.libXext
     xorg.libXfixes xorg.libXi xorg.libXrandr xorg.libXrender xorg.libXxf86vm
     xorg.libxcb
@@ -75,9 +75,9 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A suite of integrated tools for game developers to design and build games, simulations, and visualizations";
     homepage = "https://www.unrealengine.com/what-is-unreal-engine-4";
-    license = stdenv.lib.licenses.unfree;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.puffnfresh ];
+    license = lib.licenses.unfree;
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.puffnfresh ];
     broken = true;
   };
 }
diff --git a/pkgs/games/ue4demos/default.nix b/pkgs/games/ue4demos/default.nix
index 24c98f7d774..a2d114f5113 100644
--- a/pkgs/games/ue4demos/default.nix
+++ b/pkgs/games/ue4demos/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip, patchelf, xorg, openal }:
+{ lib, stdenv, fetchurl, unzip, patchelf, xorg, openal }:
 
 let
   urls = file:
@@ -14,9 +14,9 @@ let
 
       nativeBuildInputs = [ unzip patchelf ];
 
-      rtdeps = stdenv.lib.makeLibraryPath
+      rtdeps = lib.makeLibraryPath
         [ xorg.libXxf86vm xorg.libXext openal ]
-        + ":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" [ stdenv.cc.cc ];
+        + ":" + lib.makeSearchPathOutput "lib" "lib64" [ stdenv.cc.cc ];
 
       buildCommand =
       ''
@@ -52,7 +52,7 @@ let
         description = "Unreal Engine 4 Linux demos";
         homepage = "https://wiki.unrealengine.com/Linux_Demos";
         platforms = [ "x86_64-linux" ];
-        license = stdenv.lib.licenses.unfree;
+        license = lib.licenses.unfree;
       };
     };
 
diff --git a/pkgs/games/ufoai/default.nix b/pkgs/games/ufoai/default.nix
index 94a12774a43..7694821d44f 100644
--- a/pkgs/games/ufoai/default.nix
+++ b/pkgs/games/ufoai/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libtheora, xvidcore, libGLU, libGL, SDL, SDL_ttf, SDL_mixer
+{ lib, stdenv, fetchurl, libtheora, xvidcore, libGLU, libGL, SDL, SDL_ttf, SDL_mixer
 , curl, libjpeg, libpng, gettext, cunit, enableEditor?false }:
 
 stdenv.mkDerivation rec {
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   preConfigure = ''tar xvf "${srcData}"'';
 
   configureFlags = [ "--enable-release" "--enable-sse" ]
-    ++ stdenv.lib.optional enableEditor "--enable-uforadiant";
+    ++ lib.optional enableEditor "--enable-uforadiant";
 
   buildInputs = [
     libtheora xvidcore libGLU libGL SDL SDL_ttf SDL_mixer
@@ -28,9 +28,9 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://ufoai.org";
     description = "A squad-based tactical strategy game in the tradition of X-Com";
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    maintainers = with lib.maintainers; [viric];
+    platforms = lib.platforms.linux;
     hydraPlatforms = [];
   };
 }
diff --git a/pkgs/games/ultimatestunts/default.nix b/pkgs/games/ultimatestunts/default.nix
index 6eb4725897f..daaa3110244 100644
--- a/pkgs/games/ultimatestunts/default.nix
+++ b/pkgs/games/ultimatestunts/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, SDL, libGLU, libGL, SDL_image, freealut, openal, libvorbis,
+{lib, stdenv, fetchurl, SDL, libGLU, libGL, SDL_image, freealut, openal, libvorbis,
 pkgconfig}:
 
 stdenv.mkDerivation {
@@ -18,8 +18,8 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://www.ultimatestunts.nl/";
     description = "Remake of the popular racing DOS-game Stunts";
-    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/games/ultrastardx/default.nix b/pkgs/games/ultrastardx/default.nix
index 43fd30f1d7d..397946acf58 100644
--- a/pkgs/games/ultrastardx/default.nix
+++ b/pkgs/games/ultrastardx/default.nix
@@ -55,7 +55,7 @@ in stdenv.mkDerivation rec {
       --subst-var-by libpcre_LIBNAME libpcre.so.1
   '';
 
-  preBuild = with stdenv.lib;
+  preBuild = with lib;
     let items = concatMapStringsSep " " (x: "-rpath ${getLib x}/lib") sharedLibs;
     in ''
       export NIX_LDFLAGS="$NIX_LDFLAGS ${items}"
diff --git a/pkgs/games/uqm/3dovideo.nix b/pkgs/games/uqm/3dovideo.nix
index 8d1bf2b6887..0773b651152 100644
--- a/pkgs/games/uqm/3dovideo.nix
+++ b/pkgs/games/uqm/3dovideo.nix
@@ -1,6 +1,6 @@
 { stdenv, requireFile, writeText, fetchurl, haskellPackages }:
 
-with stdenv.lib;
+with lib;
 
 let
   makeSpin = num: let
@@ -30,7 +30,7 @@ let
     buildDepends = [ base binary bytestring filepath tar ];
 
     description = "Extract video files from a Star Control II 3DO image";
-    license = stdenv.lib.licenses.bsd3;
+    license = lib.licenses.bsd3;
   };
 
 in stdenv.mkDerivation {
diff --git a/pkgs/games/uqm/default.nix b/pkgs/games/uqm/default.nix
index bce8fde3acd..0c6d2d9d952 100644
--- a/pkgs/games/uqm/default.nix
+++ b/pkgs/games/uqm/default.nix
@@ -102,7 +102,7 @@ in stdenv.mkDerivation rec {
           spin-offs, thereby making zillions more people happy!
     '';
     homepage = "http://sc2.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl2;
+    license = lib.licenses.gpl2;
     maintainers = with lib.maintainers; [ jcumming aszlig ];
     platforms = with lib.platforms; linux;
   };
diff --git a/pkgs/games/vdrift/default.nix b/pkgs/games/vdrift/default.nix
index ea8b3941f8b..bc499d736f0 100644
--- a/pkgs/games/vdrift/default.nix
+++ b/pkgs/games/vdrift/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchsvn, pkgconfig, sconsPackages, libGLU, libGL, SDL2, SDL2_image
+{ lib, stdenv, fetchFromGitHub, fetchsvn, pkgconfig, sconsPackages, libGLU, libGL, SDL2, SDL2_image
 , libvorbis, bullet, curl, gettext, writeTextFile
 
 , data ? fetchsvn {
@@ -35,9 +35,9 @@ let
     meta = {
       description = "Car racing game";
       homepage = "http://vdrift.net/";
-      license = stdenv.lib.licenses.gpl2Plus;
-      maintainers = with stdenv.lib.maintainers; [viric];
-      platforms = stdenv.lib.platforms.linux;
+      license = lib.licenses.gpl2Plus;
+      maintainers = with lib.maintainers; [viric];
+      platforms = lib.platforms.linux;
     };
   };
   wrappedName = "vdrift-${version}-with-data-${toString data.rev}";
diff --git a/pkgs/games/vectoroids/default.nix b/pkgs/games/vectoroids/default.nix
index 01e787b8d91..e0b7e13c91e 100644
--- a/pkgs/games/vectoroids/default.nix
+++ b/pkgs/games/vectoroids/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, SDL, SDL_image, SDL_mixer}:
+{lib, stdenv, fetchurl, SDL, SDL_image, SDL_mixer}:
 
 stdenv.mkDerivation {
   name = "vectoroids-1.1.0";
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://www.newbreedsoftware.com/vectoroids/";
     description = "Clone of the classic arcade game Asteroids by Atari";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/vessel/default.nix b/pkgs/games/vessel/default.nix
index fa5aff2b81b..a60ec15744c 100644
--- a/pkgs/games/vessel/default.nix
+++ b/pkgs/games/vessel/default.nix
@@ -20,8 +20,8 @@ stdenv.mkDerivation rec {
   phases = "installPhase";
   ld_preload = ./isatty.c;
 
-  libPath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc stdenv.cc.libc ]
-    + ":" + stdenv.lib.makeLibraryPath [ SDL libpulseaudio alsaLib ] ;
+  libPath = lib.makeLibraryPath [ stdenv.cc.cc stdenv.cc.libc ]
+    + ":" + lib.makeLibraryPath [ SDL libpulseaudio alsaLib ] ;
 
   installPhase = ''
     mkdir -p $out/libexec/strangeloop/vessel/
diff --git a/pkgs/games/vms-empire/default.nix b/pkgs/games/vms-empire/default.nix
index eb9108c32c9..fcfc89667af 100644
--- a/pkgs/games/vms-empire/default.nix
+++ b/pkgs/games/vms-empire/default.nix
@@ -1,8 +1,6 @@
-{ stdenv, fetchurl, ncurses, xmlto }:
+{ lib, stdenv, fetchurl, ncurses, xmlto }:
 
-with stdenv.lib;
 stdenv.mkDerivation rec {
-
   pname = "vms-empire";
   version = "1.15";
 
@@ -22,7 +20,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "DESTDIR=$(out)" ];
 
-  meta = {
+  meta = with lib; {
     description = "The ancestor of all expand/explore/exploit/exterminate games";
     longDescription = ''
       Empire is a simulation of a full-scale war between two emperors, the
diff --git a/pkgs/games/warzone2100/default.nix b/pkgs/games/warzone2100/default.nix
index 2dfb2a72d89..95c3ec3630f 100644
--- a/pkgs/games/warzone2100/default.nix
+++ b/pkgs/games/warzone2100/default.nix
@@ -44,7 +44,7 @@ mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  postInstall = stdenv.lib.optionalString withVideos
+  postInstall = lib.optionalString withVideos
     "cp ${sequences_src} $out/share/warzone2100/sequences.wz";
 
   meta = with lib; {
diff --git a/pkgs/games/wesnoth/default.nix b/pkgs/games/wesnoth/default.nix
index d5eb7495df0..71734b9ff98 100644
--- a/pkgs/games/wesnoth/default.nix
+++ b/pkgs/games/wesnoth/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ SDL2 SDL2_image SDL2_mixer SDL2_net SDL2_ttf pango gettext boost
                   libvorbis fribidi dbus libpng pcre openssl icu ]
-                ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa Foundation];
+                ++ lib.optionals stdenv.isDarwin [ Cocoa Foundation];
 
   cmakeFlags = [ "-DENABLE_TOOLS=${if enableTools then "ON" else "OFF"}" ];
 
diff --git a/pkgs/games/worldofgoo/default.nix b/pkgs/games/worldofgoo/default.nix
index 8d06b94271f..27a270fcf8f 100644
--- a/pkgs/games/worldofgoo/default.nix
+++ b/pkgs/games/worldofgoo/default.nix
@@ -38,11 +38,11 @@ stdenv.mkDerivation rec {
   sourceRoot = pname;
   phases = [ "unpackPhase installPhase" ];
 
-  libPath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc.lib stdenv.cc.libc SDL2 SDL2_mixer
+  libPath = lib.makeLibraryPath [ stdenv.cc.cc.lib stdenv.cc.libc SDL2 SDL2_mixer
     libogg libvorbis ];
 
   unpackPhase = ''
-    # The game is distributed as a shell script, with a tar of mojosetup, and a 
+    # The game is distributed as a shell script, with a tar of mojosetup, and a
     # zip archive attached to the end. Therefore a simple unzip does the job.
     # However, to avoid unzip errors, we need to strip those out first.
     tail -c +421887 ${src} > ${src}.zip
diff --git a/pkgs/games/xboard/default.nix b/pkgs/games/xboard/default.nix
index 9f3303578da..95542491b99 100644
--- a/pkgs/games/xboard/default.nix
+++ b/pkgs/games/xboard/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, libX11, xorgproto, libXt, libXaw, libSM, libICE, libXmu
+{lib, stdenv, fetchurl, libX11, xorgproto, libXt, libXaw, libSM, libICE, libXmu
 , libXext, gnuchess, texinfo, libXpm, pkgconfig, librsvg, cairo, pango
 , gtk2
 }:
@@ -28,8 +28,8 @@ stdenv.mkDerivation {
     inherit (s) version;
     description = ''GUI for chess engines'';
     homepage = "https://www.gnu.org/software/xboard/";
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.gpl3Plus;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
+    license = lib.licenses.gpl3Plus;
   };
 }
diff --git a/pkgs/games/xonotic/default.nix b/pkgs/games/xonotic/default.nix
index 6f7ee6962bf..54ec25c8cf7 100644
--- a/pkgs/games/xonotic/default.nix
+++ b/pkgs/games/xonotic/default.nix
@@ -38,9 +38,9 @@ let
       aims to become the best possible open-source FPS of its kind.
     '';
     homepage = "https://www.xonotic.org/";
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = with stdenv.lib.maintainers; [ astsmtl zalakain petabyteboy ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    maintainers = with lib.maintainers; [ astsmtl zalakain petabyteboy ];
+    platforms = lib.platforms.linux;
   };
 
   desktopItem = makeDesktopItem {
diff --git a/pkgs/games/xpilot/bloodspilot-client.nix b/pkgs/games/xpilot/bloodspilot-client.nix
index 4de27b1f18d..66f329ed0b9 100644
--- a/pkgs/games/xpilot/bloodspilot-client.nix
+++ b/pkgs/games/xpilot/bloodspilot-client.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libX11, SDL, libGLU, libGL, expat, zlib, SDL_ttf, SDL_image }:
+{ lib, stdenv, fetchurl, libX11, SDL, libGLU, libGL, expat, zlib, SDL_ttf, SDL_image }:
 
 stdenv.mkDerivation rec {
   version = "1.5.0";
@@ -18,8 +18,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = ''A multiplayer space combat game (client part)'';
     homepage = "http://bloodspilot.sf.net/";
-    license = stdenv.lib.licenses.gpl2Plus ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/xskat/default.nix b/pkgs/games/xskat/default.nix
index 5f0f867f183..c84f5222e68 100644
--- a/pkgs/games/xskat/default.nix
+++ b/pkgs/games/xskat/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, libX11, imake, gccmakedep}:
+{lib, stdenv, fetchurl, libX11, imake, gccmakedep}:
 
 stdenv.mkDerivation rec {
   pname = "xskat";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   installTargets = [ "install" "install.man" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = ''Famous german card game'';
     platforms = platforms.unix;
     license = licenses.free;
diff --git a/pkgs/games/xsnow/default.nix b/pkgs/games/xsnow/default.nix
index c64d8bf568f..de07821c36a 100644
--- a/pkgs/games/xsnow/default.nix
+++ b/pkgs/games/xsnow/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libXt, libXpm, libXext, imake, gccmakedep }:
+{ lib, stdenv, fetchurl, libXt, libXpm, libXext, imake, gccmakedep }:
 
 stdenv.mkDerivation rec {
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "An X-windows application that will let it snow on the root, in between and on windows";
     homepage = "http://janswaal.home.xs4all.nl/Xsnow/";
-    license = stdenv.lib.licenses.unfree;
-    maintainers = [ stdenv.lib.maintainers.robberer ];
+    license = lib.licenses.unfree;
+    maintainers = [ lib.maintainers.robberer ];
   };
 }
diff --git a/pkgs/games/xsok/default.nix b/pkgs/games/xsok/default.nix
index 30579e399b8..ddc43518de6 100644
--- a/pkgs/games/xsok/default.nix
+++ b/pkgs/games/xsok/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, libX11, imake, libXt, libXaw, libXpm, libXext
+{lib, stdenv, fetchurl, libX11, imake, libXt, libXaw, libXpm, libXext
 , withNethackLevels ? true
 }:
 stdenv.mkDerivation rec {
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = ["BINDIR=$(out)/bin"];
 
-  postInstall = stdenv.lib.optionalString withNethackLevels ''
+  postInstall = lib.optionalString withNethackLevels ''
     gzip < ${nethackLevels} > "$out/share/games/lib/xsok/Nethack.def.gz"
     echo Nethack > "$out/share/games/lib/xsok/gametypes"
   '';
@@ -39,9 +39,9 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = "A generic Sokoban game for X11";
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
     homepage = "https://tracker.debian.org/pkg/xsok";
   };
 }
diff --git a/pkgs/games/zandronum/fmod.nix b/pkgs/games/zandronum/fmod.nix
index 257dd3751c8..4b09cb170c0 100644
--- a/pkgs/games/zandronum/fmod.nix
+++ b/pkgs/games/zandronum/fmod.nix
@@ -1,7 +1,7 @@
 { stdenv, lib, fetchurl, alsaLib, libpulseaudio, undmg }:
 
 let
-  bits = stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") "64";
+  bits = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") "64";
   libPath = lib.makeLibraryPath [ stdenv.cc.cc alsaLib libpulseaudio ];
 
 in
diff --git a/pkgs/games/zandronum/sqlite.nix b/pkgs/games/zandronum/sqlite.nix
index 7f4556c8751..48dd2be9973 100644
--- a/pkgs/games/zandronum/sqlite.nix
+++ b/pkgs/games/zandronum/sqlite.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://www.sqlite.org/";
     description = "A single C code file, named sqlite3.c, that contains all C code for the core SQLite library and the FTS3 and RTREE extensions";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
     maintainers = [ lib.maintainers.lassulus ];
   };
 }
diff --git a/pkgs/games/zangband/default.nix b/pkgs/games/zangband/default.nix
index 0722e4bbbf9..e8daa9a2025 100644
--- a/pkgs/games/zangband/default.nix
+++ b/pkgs/games/zangband/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ncurses, flex, bison, autoconf, automake, m4, coreutils }:
+{ lib, stdenv, fetchurl, ncurses, flex, bison, autoconf, automake, m4, coreutils }:
 
 stdenv.mkDerivation rec {
   pname = "zangband";
@@ -52,7 +52,7 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "Rogue-like game";
-    license = stdenv.lib.licenses.unfree;
+    license = lib.licenses.unfree;
     broken = true; # broken in runtime, will not get pass character generation
   };
 }
diff --git a/pkgs/games/zod/default.nix b/pkgs/games/zod/default.nix
index d50218af241..b07db62aa15 100644
--- a/pkgs/games/zod/default.nix
+++ b/pkgs/games/zod/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, unrar, unzip, SDL, SDL_image, SDL_ttf, SDL_mixer
+{ lib, fetchurl, stdenv, unrar, unzip, SDL, SDL_image, SDL_ttf, SDL_mixer
 , libmysqlclient, makeWrapper }:
 
 stdenv.mkDerivation {
@@ -40,6 +40,6 @@ stdenv.mkDerivation {
   meta = {
     description = "Multiplayer remake of ZED";
     homepage = "http://zod.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl3Plus; /* Says the web */
+    license = lib.licenses.gpl3Plus; /* Says the web */
   };
 }