From 4af1c79c06bf5b67c5c6f0c395910a3b6dd36fcf Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 30 Dec 2013 11:04:45 -0500 Subject: [PATCH] Remove uses of __overrides feature In addition to replacing use of a feature with IMO confusing semantics, this will also let us cleanly separate out all-packages.nix into category-specific files without changing the structure of the pkgs attrset. Signed-off-by: Shea Levy --- pkgs/desktops/gnome-2/default.nix | 6 ++---- pkgs/top-level/all-packages.nix | 24 +++++++++++------------- pkgs/top-level/perl-packages.nix | 8 +++----- pkgs/top-level/r-packages.nix | 8 +++----- 4 files changed, 19 insertions(+), 27 deletions(-) diff --git a/pkgs/desktops/gnome-2/default.nix b/pkgs/desktops/gnome-2/default.nix index cecd56ad4f27..c2e1c062e9e3 100644 --- a/pkgs/desktops/gnome-2/default.nix +++ b/pkgs/desktops/gnome-2/default.nix @@ -1,7 +1,5 @@ { callPackage, self, stdenv, gettext, gvfs, libunique, overrides ? {} }: -{ - __overrides = overrides; - +let overridden = set // overrides; set = with overridden; { # Backward compatibility. gtkdoc = self.gtk_doc; startupnotification = self.startup_notification; @@ -117,4 +115,4 @@ libglademm = callPackage ./bindings/libglademm { }; -} +}; in overridden diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e1cc29ea961a..611aba1dec00 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -129,19 +129,17 @@ let # The package compositions. Yes, this isn't properly indented. - pkgsFun = pkgs: __overrides: + pkgsFun = pkgs: overrides: with helperFunctions; - let defaultScope = pkgs // pkgs.xorg; in - helperFunctions // rec { - - # `__overrides' is a magic attribute that causes the attributes in - # its value to be added to the surrounding `rec'. We'll remove this - # eventually. - inherit __overrides pkgs; + let defaultScope = pkgs // pkgs.xorg; self = self_ // overrides; + self_ = with self; helperFunctions // { # Make some arguments passed to all-packages.nix available inherit system stdenvType platform; + # Allow callPackage to fill in the pkgs argument + inherit pkgs; + # We use `callPackage' to be able to omit function arguments that # can be obtained from `pkgs' or `pkgs.xorg' (i.e. `defaultScope'). @@ -6033,7 +6031,7 @@ let perlPackages = recurseIntoAttrs (import ./perl-packages.nix { inherit pkgs; - __overrides = (config.perlPackageOverrides or (p: {})) pkgs; + overrides = (config.perlPackageOverrides or (p: {})) pkgs; }); perl510Packages = import ./perl-packages.nix { @@ -6041,7 +6039,7 @@ let perl = perl510; buildPerlPackage = import ../development/perl-modules/generic perl510; }; - __overrides = (config.perl510PackageOverrides or (p: {})) pkgs; + overrides = (config.perl510PackageOverrides or (p: {})) pkgs; }; perl514Packages = import ./perl-packages.nix { @@ -6049,7 +6047,7 @@ let perl = perl514; buildPerlPackage = import ../development/perl-modules/generic perl514; }; - __overrides = (config.perl514PackageOverrides or (p: {})) pkgs; + overrides = (config.perl514PackageOverrides or (p: {})) pkgs; }; perlXMLParser = perlPackages.XMLParser; @@ -6177,7 +6175,7 @@ let rPackages = recurseIntoAttrs (import ./r-packages.nix { inherit pkgs; - __overrides = (config.rPackageOverrides or (p: {})) pkgs; + overrides = (config.rPackageOverrides or (p: {})) pkgs; }); ### SERVERS @@ -10469,4 +10467,4 @@ let adobeReader = adobe-reader; -}; in pkgs +}; in self; in pkgs diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index 99571397ee51..fa8df33edf3b 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -5,16 +5,14 @@ for each package in a separate file: the call to the function would be almost as must code as the function itself. */ -{pkgs, __overrides}: +{pkgs, overrides}: -rec { +let self = _self // overrides; _self = with self; { inherit (pkgs) buildPerlPackage fetchurl stdenv perl fetchsvn gnused; inherit (stdenv.lib) maintainers; - inherit __overrides; - # Helper functions for packages that use Module::Build to build. buildPerlModule = { buildInputs ? [], ... } @ args: buildPerlPackage (args // { @@ -9369,4 +9367,4 @@ rec { }; }; -} +}; in self diff --git a/pkgs/top-level/r-packages.nix b/pkgs/top-level/r-packages.nix index 8280b6c2d53c..f3759c14baac 100644 --- a/pkgs/top-level/r-packages.nix +++ b/pkgs/top-level/r-packages.nix @@ -1,15 +1,13 @@ /* This file defines the composition for CRAN (R) packages. */ -{pkgs, __overrides}: +{pkgs, overrides}: -rec { +let self = _self // overrides; _self = with self; { inherit (pkgs) buildRPackage fetchurl stdenv R; inherit (stdenv.lib) maintainers; - inherit __overrides; - abind = buildRPackage rec { name = "abind-1.4-0"; src = fetchurl { @@ -243,4 +241,4 @@ rec { }; propagatedBuildInputs = [ DBI gsubfn proto chron RSQLite RSQLiteExtfuns ]; }; -} +}; in self