Get rid of all with { inherit... } and just used let inherit...

The old forms presumably predates, or were made in ignorance of,
`let inherit`. This way is better style as the scoping as more lexical,
something which Nix can (or might already!) take advantage of.
This commit is contained in:
John Ericson 2017-02-08 20:52:13 -05:00
parent da79d1f01f
commit 4c0d7da183
19 changed files with 22 additions and 24 deletions

View File

@ -1,12 +1,12 @@
# Operations on attribute sets. # Operations on attribute sets.
with { let
inherit (builtins) head tail length; inherit (builtins) head tail length;
inherit (import ./trivial.nix) or; inherit (import ./trivial.nix) or;
inherit (import ./default.nix) fold; inherit (import ./default.nix) fold;
inherit (import ./strings.nix) concatStringsSep; inherit (import ./strings.nix) concatStringsSep;
inherit (import ./lists.nix) concatMap concatLists all deepSeqList; inherit (import ./lists.nix) concatMap concatLists all deepSeqList;
}; in
rec { rec {
inherit (builtins) attrNames listToAttrs hasAttr isAttrs getAttr; inherit (builtins) attrNames listToAttrs hasAttr isAttrs getAttr;

View File

@ -6,7 +6,7 @@ with import ./attrsets.nix;
with import ./options.nix; with import ./options.nix;
with import ./trivial.nix; with import ./trivial.nix;
with import ./strings.nix; with import ./strings.nix;
with {inherit (import ./modules.nix) mergeDefinitions filterOverrides; }; let inherit (import ./modules.nix) mergeDefinitions filterOverrides; in
rec { rec {

View File

@ -4,8 +4,6 @@
with stdenv.lib; with stdenv.lib;
with { inherit (stdenv.lib) optionalString optional optionals; };
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "${pname}-${stdenv.lib.optionalString contribPlugins "full-"}${version}"; name = "${pname}-${stdenv.lib.optionalString contribPlugins "full-"}${version}";
version = "16.01"; version = "16.01";

View File

@ -10,7 +10,7 @@ let
version = "2.92"; version = "2.92";
in in
with { inherit (stdenv.lib) optional optionals optionalString; }; let inherit (stdenv.lib) optional optionals optionalString; in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "transmission-" + optionalString enableGTK3 "gtk-" + version; name = "transmission-" + optionalString enableGTK3 "gtk-" + version;

View File

@ -22,7 +22,7 @@ let
primary-src = import ./default-primary-src.nix { inherit fetchurl; }; primary-src = import ./default-primary-src.nix { inherit fetchurl; };
in in
with { inherit (primary-src) major minor subdir version; }; let inherit (primary-src) major minor subdir version; in
let let
lib = stdenv.lib; lib = stdenv.lib;

View File

@ -22,7 +22,7 @@ let
primary-src = import ./still-primary-src.nix { inherit fetchurl; }; primary-src = import ./still-primary-src.nix { inherit fetchurl; };
in in
with { inherit (primary-src) major minor subdir version; }; let inherit (primary-src) major minor subdir version; in
let let
lib = stdenv.lib; lib = stdenv.lib;

View File

@ -9,7 +9,7 @@
assert glSupport -> mesa_noglu != null; assert glSupport -> mesa_noglu != null;
with { inherit (stdenv.lib) optional optionals; }; let inherit (stdenv.lib) optional optionals; in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "cairo-1.14.8"; name = "cairo-1.14.8";

View File

@ -9,11 +9,11 @@
useEncumberedCode ? true, useEncumberedCode ? true,
}: }:
with { inherit (stdenv.lib) optional optionals optionalString; }; let
inherit (stdenv.lib) optional optionals optionalString;
version = "2.7.1"; name = "freetype-" + version;
let version = "2.7.1"; name = "freetype-" + version; in in stdenv.mkDerivation {
stdenv.mkDerivation {
inherit name; inherit name;
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -1,6 +1,6 @@
{ stdenv, fetchurl, m4, cxx ? true, withStatic ? true }: { stdenv, fetchurl, m4, cxx ? true, withStatic ? true }:
with { inherit (stdenv.lib) optional optionalString; }; let inherit (stdenv.lib) optional optionalString; in
let self = stdenv.mkDerivation rec { let self = stdenv.mkDerivation rec {
name = "gmp-5.1.3"; name = "gmp-5.1.3";

View File

@ -1,6 +1,6 @@
{ stdenv, fetchurl, m4, cxx ? true, withStatic ? false }: { stdenv, fetchurl, m4, cxx ? true, withStatic ? false }:
with { inherit (stdenv.lib) optional optionalString; }; let inherit (stdenv.lib) optional optionalString; in
let self = stdenv.mkDerivation rec { let self = stdenv.mkDerivation rec {
name = "gmp-6.1.1"; name = "gmp-6.1.1";

View File

@ -17,7 +17,7 @@
assert faacSupport -> enableUnfree; assert faacSupport -> enableUnfree;
with { inherit (stdenv.lib) optional optionals hasPrefix; }; let inherit (stdenv.lib) optional optionals hasPrefix; in
/* ToDo: /* ToDo:
- more deps, inspiration: http://packages.ubuntu.com/raring/libav-tools - more deps, inspiration: http://packages.ubuntu.com/raring/libav-tools

View File

@ -1,7 +1,7 @@
{ fetchurl, stdenv, pkgconfig, intltool, gettext, glib, libxml2, zlib, bzip2 { fetchurl, stdenv, pkgconfig, intltool, gettext, glib, libxml2, zlib, bzip2
, python, perl, gdk_pixbuf, libiconv, libintlOrEmpty }: , python, perl, gdk_pixbuf, libiconv, libintlOrEmpty }:
with { inherit (stdenv.lib) optionals; }; let inherit (stdenv.lib) optionals; in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libgsf-1.14.41"; name = "libgsf-1.14.41";

View File

@ -13,7 +13,7 @@ assert enableAsioLib -> boost != null;
assert enableGetAssets -> libxml2 != null; assert enableGetAssets -> libxml2 != null;
assert enableJemalloc -> jemalloc != null; assert enableJemalloc -> jemalloc != null;
with { inherit (stdenv.lib) optional; }; let inherit (stdenv.lib) optional; in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "nghttp2-${version}"; name = "nghttp2-${version}";

View File

@ -7,7 +7,7 @@
}: }:
{ platformVersions, abiVersions, useGoogleAPIs, useExtraSupportLibs ? false, useGooglePlayServices ? false }: { platformVersions, abiVersions, useGoogleAPIs, useExtraSupportLibs ? false, useGooglePlayServices ? false }:
with { inherit (stdenv.lib) makeLibraryPath; }; let inherit (stdenv.lib) makeLibraryPath; in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "android-sdk-${version}"; name = "android-sdk-${version}";

View File

@ -4,7 +4,7 @@
let basename = "binutils-2.28"; in let basename = "binutils-2.28"; in
with { inherit (stdenv.lib) optional optionals optionalString; }; let inherit (stdenv.lib) optional optionals optionalString; in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = basename + optionalString (cross != null) "-${cross.config}"; name = basename + optionalString (cross != null) "-${cross.config}";

View File

@ -1,7 +1,7 @@
{ stdenv, config, fetchurl, libX11, libXext, libXinerama, libXrandr { stdenv, config, fetchurl, libX11, libXext, libXinerama, libXrandr
, libXrender, fontconfig, freetype, openal }: , libXrender, fontconfig, freetype, openal }:
with { inherit (stdenv.lib) makeLibraryPath; }; let inherit (stdenv.lib) makeLibraryPath; in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "oilrush"; name = "oilrush";

View File

@ -1,6 +1,6 @@
{ stdenv, fetchFromGitHub, openssl, libevent }: { stdenv, fetchFromGitHub, openssl, libevent }:
with { inherit (stdenv.lib) optional; }; let inherit (stdenv.lib) optional; in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "coturn-${version}"; name = "coturn-${version}";

View File

@ -2,7 +2,7 @@
, systemd, nettle, libedit, zlib, libiconv, fetchpatch , systemd, nettle, libedit, zlib, libiconv, fetchpatch
}: }:
with { inherit (stdenv.lib) optional optionals; }; let inherit (stdenv.lib) optional optionals; in
# Note: ATM only the libraries have been tested in nixpkgs. # Note: ATM only the libraries have been tested in nixpkgs.
stdenv.mkDerivation rec { stdenv.mkDerivation rec {

View File

@ -12,7 +12,7 @@
# (--enable-unsupported could be used to force the build) # (--enable-unsupported could be used to force the build)
assert !cpp || mpi == null; assert !cpp || mpi == null;
with { inherit (stdenv.lib) optional optionals; }; let inherit (stdenv.lib) optional optionals; in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "1.8.18"; version = "1.8.18";