From 2414bfc5b3f162940a2481e4588ccc83c6ef7dd9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 7 Feb 2006 16:48:22 +0000 Subject: [PATCH 01/14] * system -> top-level svn path=/nixpkgs/branches/usability/; revision=4751 --- pkgs/{system => top-level}/all-packages-generic.nix | 0 pkgs/{system => top-level}/all-packages.nix | 0 pkgs/{system => top-level}/i686-linux.nix | 0 pkgs/{system => top-level}/populate-cache.nix | 0 pkgs/{system => top-level}/powerpc-darwin.nix | 0 pkgs/{system => top-level}/stdenvs.nix | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename pkgs/{system => top-level}/all-packages-generic.nix (100%) rename pkgs/{system => top-level}/all-packages.nix (100%) rename pkgs/{system => top-level}/i686-linux.nix (100%) rename pkgs/{system => top-level}/populate-cache.nix (100%) rename pkgs/{system => top-level}/powerpc-darwin.nix (100%) rename pkgs/{system => top-level}/stdenvs.nix (100%) diff --git a/pkgs/system/all-packages-generic.nix b/pkgs/top-level/all-packages-generic.nix similarity index 100% rename from pkgs/system/all-packages-generic.nix rename to pkgs/top-level/all-packages-generic.nix diff --git a/pkgs/system/all-packages.nix b/pkgs/top-level/all-packages.nix similarity index 100% rename from pkgs/system/all-packages.nix rename to pkgs/top-level/all-packages.nix diff --git a/pkgs/system/i686-linux.nix b/pkgs/top-level/i686-linux.nix similarity index 100% rename from pkgs/system/i686-linux.nix rename to pkgs/top-level/i686-linux.nix diff --git a/pkgs/system/populate-cache.nix b/pkgs/top-level/populate-cache.nix similarity index 100% rename from pkgs/system/populate-cache.nix rename to pkgs/top-level/populate-cache.nix diff --git a/pkgs/system/powerpc-darwin.nix b/pkgs/top-level/powerpc-darwin.nix similarity index 100% rename from pkgs/system/powerpc-darwin.nix rename to pkgs/top-level/powerpc-darwin.nix diff --git a/pkgs/system/stdenvs.nix b/pkgs/top-level/stdenvs.nix similarity index 100% rename from pkgs/system/stdenvs.nix rename to pkgs/top-level/stdenvs.nix From 7054f5c11e8d2196e381b269da1cb0df9ca8bf52 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 8 Feb 2006 16:20:43 +0000 Subject: [PATCH 02/14] * These are no longer needed; nix-env can work on all-packages.nix directly. svn path=/nixpkgs/branches/usability/; revision=4764 --- pkgs/top-level/i686-linux.nix | 1 - pkgs/top-level/powerpc-darwin.nix | 1 - 2 files changed, 2 deletions(-) delete mode 100644 pkgs/top-level/i686-linux.nix delete mode 100644 pkgs/top-level/powerpc-darwin.nix diff --git a/pkgs/top-level/i686-linux.nix b/pkgs/top-level/i686-linux.nix deleted file mode 100644 index 4ff2a8cda12..00000000000 --- a/pkgs/top-level/i686-linux.nix +++ /dev/null @@ -1 +0,0 @@ -(import ./all-packages.nix) {system = "i686-linux";} diff --git a/pkgs/top-level/powerpc-darwin.nix b/pkgs/top-level/powerpc-darwin.nix deleted file mode 100644 index 48c9164b14b..00000000000 --- a/pkgs/top-level/powerpc-darwin.nix +++ /dev/null @@ -1 +0,0 @@ -(import ./all-packages.nix) {system = "powerpc-darwin";} From ffe91d36c3ead2e14fae4bcebaef8425df0c5d4c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 8 Feb 2006 17:37:45 +0000 Subject: [PATCH 03/14] * Merge all-packages.nix into all-packages-generic.nix. svn path=/nixpkgs/branches/usability/; revision=4765 --- pkgs/stdenv/linux/default.nix | 16 +++++------ pkgs/top-level/all-packages-generic.nix | 37 ++++++++++++++++++++----- pkgs/top-level/stdenvs.nix | 27 +++++++++--------- 3 files changed, 51 insertions(+), 29 deletions(-) diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 6c369c65841..c5b05a1f198 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -144,8 +144,8 @@ rec { # 2) These are the packages that we can build with the first # stdenv. We only need Glibc (in step 3). stdenvLinuxBoot1Pkgs = allPackages { - stdenv = stdenvLinuxBoot1; - bootCurl = curl; + bootStdenv = stdenvLinuxBoot1; +# bootCurl = curl; }; # 3) Build Glibc with the statically linked tools. The result is the @@ -163,8 +163,8 @@ rec { # 5) The packages that can be built using the second stdenv. stdenvLinuxBoot2Pkgs = allPackages { - stdenv = stdenvLinuxBoot2; - bootCurl = curl; + bootStdenv = stdenvLinuxBoot2; +# bootCurl = curl; }; # 6) Construct a third stdenv identical to the second, except that @@ -178,8 +178,8 @@ rec { # 7) The packages that can be built using the third stdenv. stdenvLinuxBoot3Pkgs = allPackages { - stdenv = stdenvLinuxBoot3; - bootCurl = curl; + bootStdenv = stdenvLinuxBoot3; +# bootCurl = curl; }; # 8) Construct the final stdenv. It uses the Glibc, GCC and @@ -211,8 +211,8 @@ rec { # Reuse the tools built in the previous steps. stdenvLinuxPkgs = allPackages { - stdenv = stdenvLinux; - bootCurl = stdenvLinuxBoot3Pkgs.curl; + bootStdenv = stdenvLinux; +# bootCurl = stdenvLinuxBoot3Pkgs.curl; } // {inherit (stdenvLinuxBoot2Pkgs) binutils gcc;} // {inherit (stdenvLinuxBoot3Pkgs) diff --git a/pkgs/top-level/all-packages-generic.nix b/pkgs/top-level/all-packages-generic.nix index fe11dd3d10b..9b66aacdacc 100644 --- a/pkgs/top-level/all-packages-generic.nix +++ b/pkgs/top-level/all-packages-generic.nix @@ -1,17 +1,27 @@ -# This file evaluates to a function that, when supplied with a system -# identifier and a standard build environment, returns the set of all -# packages provided by the Nix Package Collection. +/* This file composes the Nix Packages collection. That is, it + imports the functions that build the various packages, and calls + them with appropriate arguments. The result is a set of all the + packages in the Nix Packages collection for some particular + platform. */ + -{ stdenv, bootCurl, noSysDirs ? true +{ # The system for which to build the packages. + system ? __currentSystem + +, # The standard environment to use. Only used for bootstrapping. If + # null, the default standard environment is used. + bootStdenv ? null + + # More flags for the bootstrapping of stdenv. +, noSysDirs ? true , gccWithCC ? true , gccWithProfiling ? true + }: + rec { - inherit stdenv; - - ### Symbolic names. useOldXLibs = false; @@ -25,6 +35,19 @@ rec { # `xlibs.xlibs' is a wrapper packages that combines libX11 and a bunch # of other basic X client libraries. x11 = if useOldXLibs then xlibsOld.xlibs else xlibsWrapper; + + + ### STANDARD ENVIRONMENT + + stdenv = if bootStdenv == null then defaultStdenv else bootStdenv; + + defaultStdenv = + (import ./stdenvs.nix { + inherit system; + allPackages = import ./all-packages-generic.nix; + }).stdenv; + + bootCurl = null; ### BUILD SUPPORT diff --git a/pkgs/top-level/stdenvs.nix b/pkgs/top-level/stdenvs.nix index b96c3d17674..fe25421b804 100644 --- a/pkgs/top-level/stdenvs.nix +++ b/pkgs/top-level/stdenvs.nix @@ -5,7 +5,9 @@ # Posix utilities, the GNU C compiler, and so on. On other systems, # we use the native C library. -{system, allPackages}: rec { +{system, allPackages}: + +rec { gccWrapper = import ../build-support/gcc-wrapper; genericStdenv = import ../stdenv/generic; @@ -29,8 +31,7 @@ }; stdenvNativePkgs = allPackages { - stdenv = stdenvNative; - bootCurl = null; + bootStdenv = stdenvNative; noSysDirs = false; }; @@ -43,8 +44,7 @@ }; stdenvNixPkgs = allPackages { - stdenv = stdenvNix; - bootCurl = stdenvNativePkgs.curl; + bootStdenv = stdenvNix; noSysDirs = false; }; @@ -62,8 +62,7 @@ }; stdenvDarwinPkgs = allPackages { - stdenv = stdenvDarwin; - bootCurl = null; + bootStdenv = stdenvDarwin; noSysDirs = false; }; @@ -77,15 +76,15 @@ }; stdenvFreeBSDPkgs = allPackages { - stdenv = stdenvFreeBSD; - bootCurl = null; + bootStdenv = stdenvFreeBSD; noSysDirs = false; }; - stdenvTestPkgs = allPackages { - stdenv = (import ../stdenv/nix-linux-static).stdenvInitial; - bootCurl = (import ../stdenv/nix-linux-static).curl; - noSysDirs = true; - }; + # Select the appropriate stdenv for the platform `system'. + stdenv = + if system == "i686-linux" then stdenvLinux + else if system == "i686-freebsd" then stdenvFreeBSD + else if system == "powerpc-darwin" then stdenvDarwin + else stdenvNative; } From 572eca7368289da6a037073b599cefafb26ef699 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 8 Feb 2006 17:38:17 +0000 Subject: [PATCH 04/14] * Get rid of all-packages.nix. svn path=/nixpkgs/branches/usability/; revision=4766 --- pkgs/top-level/all-packages.nix | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 pkgs/top-level/all-packages.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix deleted file mode 100644 index 55f705ebd43..00000000000 --- a/pkgs/top-level/all-packages.nix +++ /dev/null @@ -1,18 +0,0 @@ -# This file evaluates to a function that, when supplied with a system -# identifier, returns the set of all packages provided by the Nix -# Package Collection. It does this by supplying -# `all-packages-generic.nix' with one of the standard build -# environments defined in `stdenvs.nix'. - -{system ? __currentSystem}: let { - allPackages = import ./all-packages-generic.nix; - - stdenvs = import ./stdenvs.nix {inherit system allPackages;}; - - # Select the right instantiation. - body = - if system == "i686-linux" then stdenvs.stdenvLinuxPkgs - else if system == "i686-freebsd" then stdenvs.stdenvFreeBSDPkgs - else if system == "powerpc-darwin" then stdenvs.stdenvDarwinPkgs - else stdenvs.stdenvNativePkgs; -} From 6b9360e5db7d408c7609d20b6cce58a74d0cfdbd Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 8 Feb 2006 17:39:57 +0000 Subject: [PATCH 05/14] * all-packages-generic.nix -> all-packages.nix. svn path=/nixpkgs/branches/usability/; revision=4767 --- pkgs/top-level/{all-packages-generic.nix => all-packages.nix} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename pkgs/top-level/{all-packages-generic.nix => all-packages.nix} (99%) diff --git a/pkgs/top-level/all-packages-generic.nix b/pkgs/top-level/all-packages.nix similarity index 99% rename from pkgs/top-level/all-packages-generic.nix rename to pkgs/top-level/all-packages.nix index 9b66aacdacc..bf3fd7ca20a 100644 --- a/pkgs/top-level/all-packages-generic.nix +++ b/pkgs/top-level/all-packages.nix @@ -44,7 +44,7 @@ rec { defaultStdenv = (import ./stdenvs.nix { inherit system; - allPackages = import ./all-packages-generic.nix; + allPackages = import ./all-packages.nix; }).stdenv; bootCurl = null; From 6f2a205e8779c4ffa56dde6d4d8b376387c013e9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 9 Feb 2006 14:18:52 +0000 Subject: [PATCH 06/14] * Rename. svn path=/nixpkgs/branches/usability/; revision=4773 --- pkgs/top-level/{populate-cache.nix => build-for-release.nix} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename pkgs/top-level/{populate-cache.nix => build-for-release.nix} (100%) diff --git a/pkgs/top-level/populate-cache.nix b/pkgs/top-level/build-for-release.nix similarity index 100% rename from pkgs/top-level/populate-cache.nix rename to pkgs/top-level/build-for-release.nix From 29c64c6c6768ea1594a85d1544ee9c64a16d534e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 9 Feb 2006 15:55:20 +0000 Subject: [PATCH 07/14] * Move top-level/stdenvs.nix to the stdenv/ directory. svn path=/nixpkgs/branches/usability/; revision=4774 --- pkgs/{top-level/stdenvs.nix => stdenv/default.nix} | 14 +++++++------- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) rename pkgs/{top-level/stdenvs.nix => stdenv/default.nix} (86%) diff --git a/pkgs/top-level/stdenvs.nix b/pkgs/stdenv/default.nix similarity index 86% rename from pkgs/top-level/stdenvs.nix rename to pkgs/stdenv/default.nix index fe25421b804..b66d770782c 100644 --- a/pkgs/top-level/stdenvs.nix +++ b/pkgs/stdenv/default.nix @@ -10,11 +10,11 @@ rec { gccWrapper = import ../build-support/gcc-wrapper; - genericStdenv = import ../stdenv/generic; + genericStdenv = import ./generic; # Trivial environment used for building other environments. - stdenvInitial = (import ../stdenv/initial) { + stdenvInitial = (import ./initial) { name = "stdenv-initial"; inherit system; }; @@ -25,7 +25,7 @@ rec { # i.e., the stuff in /bin, /usr/bin, etc. This environment should # be used with care, since many Nix packages will not build properly # with it (e.g., because they require GNU Make). - stdenvNative = (import ../stdenv/native) { + stdenvNative = (import ./native) { stdenv = stdenvInitial; inherit genericStdenv gccWrapper; }; @@ -37,7 +37,7 @@ rec { # The Nix build environment. - stdenvNix = (import ../stdenv/nix) { + stdenvNix = (import ./nix) { stdenv = stdenvNative; pkgs = stdenvNativePkgs; inherit genericStdenv gccWrapper; @@ -50,13 +50,13 @@ rec { # Linux standard environment. - inherit (import ../stdenv/linux {inherit allPackages;}) + inherit (import ./linux {inherit allPackages;}) stdenvLinux stdenvLinuxPkgs; # Darwin (Mac OS X) standard environment. Very simple for now # (essentially it's just the native environment). - stdenvDarwin = (import ../stdenv/darwin) { + stdenvDarwin = (import ./darwin) { stdenv = stdenvInitial; inherit genericStdenv gccWrapper; }; @@ -70,7 +70,7 @@ rec { # FreeBSD standard environment. Right now this is more or less the # same as the native environemnt. Eventually we'll want a pure # environment similar to stdenvLinux. - stdenvFreeBSD = (import ../stdenv/freebsd) { + stdenvFreeBSD = (import ./freebsd) { stdenv = stdenvInitial; inherit genericStdenv gccWrapper; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bf3fd7ca20a..a88ebc862de 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -42,7 +42,7 @@ rec { stdenv = if bootStdenv == null then defaultStdenv else bootStdenv; defaultStdenv = - (import ./stdenvs.nix { + (import ../stdenv { inherit system; allPackages = import ./all-packages.nix; }).stdenv; From 07bc3fbf002a802c5e0c57c9700c4c8b693ff212 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 9 Feb 2006 17:04:18 +0000 Subject: [PATCH 08/14] * Push packages from the final stdenv bootstrapping phase to all-packages. That is, an attribute like "bash" in all-packages.nix should evaluate to the "bash" used to build stdenv, it shouldn't build a new one. Hm, this would be a lot cleaner if we had lazy_rec ;-) svn path=/nixpkgs/branches/usability/; revision=4775 --- pkgs/stdenv/generic/default.nix | 11 ++++- pkgs/stdenv/linux/default.nix | 60 ++++++++++++------------- pkgs/top-level/all-packages.nix | 79 ++++++++++++++++++--------------- 3 files changed, 83 insertions(+), 67 deletions(-) diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index b25703eb9af..5bb63f1b815 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -1,5 +1,6 @@ { stdenv, name, preHook ? null, postHook ? null, initialPath, gcc, shell , param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? "" +, extraAttrs ? {} }: let { @@ -24,6 +25,7 @@ let { # Add a utility function to produce derivations that use this # stdenv and its shell. // { + mkDerivation = attrs: derivation (attrs // { builder = if attrs ? realBuilder then attrs.realBuilder else shell; args = if attrs ? args then attrs.args else @@ -31,6 +33,13 @@ let { stdenv = body; system = body.system; }); - }; + + } + + # Propagate any extra attributes. For instance, we use this to + # "lift" packages like curl from the final stdenv for Linux to + # all-packages.nix for that platform (meaning that it has a line + # like curl = if stdenv ? curl then stdenv.curl else ...). + // extraAttrs; } diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index c5b05a1f198..3fc3c16e01f 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -114,22 +114,26 @@ rec { # This function builds the various standard environments used during # the bootstrap. - stdenvBootFun = {glibc, gcc, binutils, staticGlibc}: (import ../generic) { - name = "stdenv-linux-boot"; - param1 = if staticGlibc then "static" else "dynamic"; - preHook = ./prehook.sh; - stdenv = stdenvInitial; - shell = ./tools/bash; - gcc = (import ../../build-support/gcc-wrapper) { + stdenvBootFun = + {glibc, gcc, binutils, staticGlibc, extraAttrs ? {}}: + + import ../generic { + name = "stdenv-linux-boot"; + param1 = if staticGlibc then "static" else "dynamic"; + preHook = ./prehook.sh; stdenv = stdenvInitial; - nativeTools = false; - nativeGlibc = false; - inherit gcc glibc binutils; + shell = ./tools/bash; + gcc = (import ../../build-support/gcc-wrapper) { + stdenv = stdenvInitial; + nativeTools = false; + nativeGlibc = false; + inherit gcc glibc binutils; + }; + initialPath = [ + staticTools + ]; + inherit extraAttrs; }; - initialPath = [ - staticTools - ]; - }; # Create the first "real" standard environment. This one consists @@ -139,13 +143,13 @@ rec { # Use the statically linked, downloaded glibc/gcc/binutils. inherit glibc gcc binutils; staticGlibc = true; + extraAttrs = {inherit curl;}; }; # 2) These are the packages that we can build with the first # stdenv. We only need Glibc (in step 3). stdenvLinuxBoot1Pkgs = allPackages { bootStdenv = stdenvLinuxBoot1; -# bootCurl = curl; }; # 3) Build Glibc with the statically linked tools. The result is the @@ -159,12 +163,12 @@ rec { glibc = stdenvLinuxGlibc; staticGlibc = false; inherit gcc binutils; + extraAttrs = {inherit curl;}; }; # 5) The packages that can be built using the second stdenv. stdenvLinuxBoot2Pkgs = allPackages { bootStdenv = stdenvLinuxBoot2; -# bootCurl = curl; }; # 6) Construct a third stdenv identical to the second, except that @@ -174,12 +178,12 @@ rec { glibc = stdenvLinuxGlibc; staticGlibc = false; inherit (stdenvLinuxBoot2Pkgs) gcc binutils; + extraAttrs = {inherit curl;}; }; # 7) The packages that can be built using the third stdenv. stdenvLinuxBoot3Pkgs = allPackages { bootStdenv = stdenvLinuxBoot3; -# bootCurl = curl; }; # 8) Construct the final stdenv. It uses the Glibc, GCC and @@ -205,20 +209,14 @@ rec { }; shell = stdenvLinuxBoot3Pkgs.bash ~ /bin/sh; + + extraAttrs = { + curl = stdenvLinuxBoot3Pkgs.realCurl; + inherit (stdenvLinuxBoot2Pkgs) binutils /* gcc */; + inherit (stdenvLinuxBoot3Pkgs) + gzip bzip2 bash coreutils diffutils findutils gawk + gnumake gnused gnutar gnugrep patch patchelf; + }; }; - # 8) Finally, the set of components built using the Linux stdenv. - # Reuse the tools built in the previous steps. - stdenvLinuxPkgs = - allPackages { - bootStdenv = stdenvLinux; -# bootCurl = stdenvLinuxBoot3Pkgs.curl; - } // - {inherit (stdenvLinuxBoot2Pkgs) binutils gcc;} // - {inherit (stdenvLinuxBoot3Pkgs) - gzip bzip2 bash coreutils diffutils findutils gawk - gnumake gnused gnutar gnugrep curl patch patchelf; - } // - {glibc = stdenvLinuxGlibc;}; - } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a88ebc862de..a91948607c3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -37,6 +37,10 @@ rec { x11 = if useOldXLibs then xlibsOld.xlibs else xlibsWrapper; + ### Helper functions. + useFromStdenv = hasIt: it: alternative: if hasIt then it else alternative; + + ### STANDARD ENVIRONMENT stdenv = if bootStdenv == null then defaultStdenv else bootStdenv; @@ -47,14 +51,11 @@ rec { allPackages = import ./all-packages.nix; }).stdenv; - bootCurl = null; - ### BUILD SUPPORT fetchurl = (import ../build-support/fetchurl) { - inherit stdenv; - curl = bootCurl; + inherit stdenv curl; }; fetchsvn = (import ../build-support/fetchsvn) { @@ -76,17 +77,19 @@ rec { inherit fetchurl stdenv flex; }; - coreutils = (import ../tools/misc/coreutils) { + coreutils = useFromStdenv (stdenv ? coreutils) stdenv.coreutils + (import ../tools/misc/coreutils { inherit fetchurl stdenv; - }; + }); coreutilsDiet = (import ../tools/misc/coreutils-diet) { inherit fetchurl stdenv dietgcc perl; }; - findutils = (import ../tools/misc/findutils) { + findutils = useFromStdenv (stdenv ? findutils) stdenv.findutils + (import ../tools/misc/findutils { inherit fetchurl stdenv coreutils; - }; + }); findutilsWrapper = (import ../tools/misc/findutils-wrapper) { inherit stdenv findutils; @@ -121,27 +124,29 @@ rec { inherit fetchurl stdenv unzip jdk; }; - diffutils = (import ../tools/text/diffutils) { + diffutils = useFromStdenv (stdenv ? diffutils) stdenv.diffutils + (import ../tools/text/diffutils { inherit fetchurl stdenv coreutils; - }; + }); gnupatch = (import ../tools/text/gnupatch) { inherit fetchurl stdenv; }; - patch = if stdenv.system == "powerpc-darwin" then null else gnupatch; + patch = useFromStdenv (stdenv ? patch) stdenv.patch + (if stdenv.system == "powerpc-darwin" then null else gnupatch); - gnused = (import ../tools/text/gnused) { + gnused = useFromStdenv (stdenv ? gnused) stdenv.gnused (import ../tools/text/gnused { inherit fetchurl stdenv; - }; + }); - gnugrep = (import ../tools/text/gnugrep) { + gnugrep = useFromStdenv (stdenv ? gnugrep) stdenv.gnugrep (import ../tools/text/gnugrep { inherit fetchurl stdenv pcre; - }; + }); - gawk = (import ../tools/text/gawk) { + gawk = useFromStdenv (stdenv ? gawk) stdenv.gawk (import ../tools/text/gawk { inherit fetchurl stdenv; - }; + }); groff = (import ../tools/text/groff) { inherit fetchurl stdenv; @@ -181,9 +186,9 @@ rec { inherit fetchurl stdenv; }; - gnutar = (import ../tools/archivers/gnutar) { + gnutar = useFromStdenv (stdenv ? gnutar) stdenv.gnutar (import ../tools/archivers/gnutar { inherit fetchurl stdenv; - }; + }); gnutarDiet = (import ../tools/archivers/gnutar-diet) { inherit fetchurl stdenv dietgcc; @@ -197,13 +202,13 @@ rec { inherit fetchurl stdenv; }; - gzip = (import ../tools/compression/gzip) { + gzip = useFromStdenv (stdenv ? gzip) stdenv.gzip (import ../tools/compression/gzip { inherit fetchurl stdenv; - }; + }); - bzip2 = (import ../tools/compression/bzip2) { + bzip2 = useFromStdenv (stdenv ? bzip2) stdenv.bzip2 (import ../tools/compression/bzip2 { inherit fetchurl stdenv; - }; + }); zdelta = (import ../tools/compression/zdelta) { inherit fetchurl stdenv; @@ -221,7 +226,9 @@ rec { inherit fetchurl stdenv; }; - curl = (import ../tools/networking/curl) { + curl = useFromStdenv (stdenv ? curl) stdenv.curl realCurl; + + realCurl = (import ../tools/networking/curl) { inherit fetchurl stdenv zlib; }; @@ -331,9 +338,9 @@ rec { ### SHELLS - bash = (import ../shells/bash) { + bash = useFromStdenv (stdenv ? bash) stdenv.bash (import ../shells/bash { inherit fetchurl stdenv; - }; + }); tcsh = (import ../shells/tcsh) { inherit fetchurl stdenv ncurses; @@ -346,9 +353,10 @@ rec { ### DEVELOPMENT - binutils = (import ../development/tools/misc/binutils) { + binutils = useFromStdenv (stdenv ? binutils) stdenv.binutils + (import ../development/tools/misc/binutils { inherit fetchurl stdenv noSysDirs; - }; + }); binutilsMips = (import ../development/tools/misc/binutils-cross) { inherit fetchurl stdenv noSysDirs; @@ -365,7 +373,8 @@ rec { cross = "sparc-linux"; }; - patchelf = (import ../development/tools/misc/patchelf) { + patchelf = useFromStdenv (stdenv ? patchelf) stdenv.patchelf + (import ../development/tools/misc/patchelf) { inherit fetchurl stdenv; }; @@ -458,9 +467,10 @@ rec { inherit fetchurl stdenv readline ncurses g77 perl flex; }; - gnumake = (import ../development/tools/build-managers/gnumake) { + gnumake = useFromStdenv (stdenv ? gnumake) stdenv.gnumake + (import ../development/tools/build-managers/gnumake { inherit fetchurl stdenv; - }; + }); mk = (import ../development/tools/build-managers/mk) { inherit fetchurl stdenv; @@ -2233,14 +2243,12 @@ rec { }; #nixStatic = (import ../misc/nix-static) { - # inherit fetchurl stdenv aterm perl; - # curl = bootCurl; /* !!! ugly */ + # inherit fetchurl stdenv aterm perl curl; # bdb = db4; #}; nix = (import ../misc/nix) { - inherit fetchurl stdenv aterm perl; - curl = bootCurl; /* !!! ugly */ + inherit fetchurl stdenv aterm perl curl; bdb = db4; }; @@ -2272,4 +2280,5 @@ rec { joe = (import ../applications/editors/joe) { inherit stdenv fetchurl; }; + } From 2c98c029014b35790d4b48a4c82aa42d375e8c5b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 8 Mar 2006 15:00:18 +0000 Subject: [PATCH 09/14] * Indent consistently. svn path=/nixpkgs/branches/usability/; revision=4995 --- pkgs/top-level/all-packages.nix | 85 ++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a91948607c3..34b97fc8c5f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -78,18 +78,18 @@ rec { }; coreutils = useFromStdenv (stdenv ? coreutils) stdenv.coreutils - (import ../tools/misc/coreutils { - inherit fetchurl stdenv; - }); + (import ../tools/misc/coreutils { + inherit fetchurl stdenv; + }); coreutilsDiet = (import ../tools/misc/coreutils-diet) { inherit fetchurl stdenv dietgcc perl; }; findutils = useFromStdenv (stdenv ? findutils) stdenv.findutils - (import ../tools/misc/findutils { - inherit fetchurl stdenv coreutils; - }); + (import ../tools/misc/findutils { + inherit fetchurl stdenv coreutils; + }); findutilsWrapper = (import ../tools/misc/findutils-wrapper) { inherit stdenv findutils; @@ -125,9 +125,9 @@ rec { }; diffutils = useFromStdenv (stdenv ? diffutils) stdenv.diffutils - (import ../tools/text/diffutils { - inherit fetchurl stdenv coreutils; - }); + (import ../tools/text/diffutils { + inherit fetchurl stdenv coreutils; + }); gnupatch = (import ../tools/text/gnupatch) { inherit fetchurl stdenv; @@ -136,17 +136,20 @@ rec { patch = useFromStdenv (stdenv ? patch) stdenv.patch (if stdenv.system == "powerpc-darwin" then null else gnupatch); - gnused = useFromStdenv (stdenv ? gnused) stdenv.gnused (import ../tools/text/gnused { - inherit fetchurl stdenv; - }); + gnused = useFromStdenv (stdenv ? gnused) stdenv.gnused + (import ../tools/text/gnused { + inherit fetchurl stdenv; + }); - gnugrep = useFromStdenv (stdenv ? gnugrep) stdenv.gnugrep (import ../tools/text/gnugrep { - inherit fetchurl stdenv pcre; - }); + gnugrep = useFromStdenv (stdenv ? gnugrep) stdenv.gnugrep + (import ../tools/text/gnugrep { + inherit fetchurl stdenv pcre; + }); - gawk = useFromStdenv (stdenv ? gawk) stdenv.gawk (import ../tools/text/gawk { - inherit fetchurl stdenv; - }); + gawk = useFromStdenv (stdenv ? gawk) stdenv.gawk + (import ../tools/text/gawk { + inherit fetchurl stdenv; + }); groff = (import ../tools/text/groff) { inherit fetchurl stdenv; @@ -186,9 +189,10 @@ rec { inherit fetchurl stdenv; }; - gnutar = useFromStdenv (stdenv ? gnutar) stdenv.gnutar (import ../tools/archivers/gnutar { - inherit fetchurl stdenv; - }); + gnutar = useFromStdenv (stdenv ? gnutar) stdenv.gnutar + (import ../tools/archivers/gnutar { + inherit fetchurl stdenv; + }); gnutarDiet = (import ../tools/archivers/gnutar-diet) { inherit fetchurl stdenv dietgcc; @@ -202,13 +206,15 @@ rec { inherit fetchurl stdenv; }; - gzip = useFromStdenv (stdenv ? gzip) stdenv.gzip (import ../tools/compression/gzip { - inherit fetchurl stdenv; - }); + gzip = useFromStdenv (stdenv ? gzip) stdenv.gzip + (import ../tools/compression/gzip { + inherit fetchurl stdenv; + }); - bzip2 = useFromStdenv (stdenv ? bzip2) stdenv.bzip2 (import ../tools/compression/bzip2 { - inherit fetchurl stdenv; - }); + bzip2 = useFromStdenv (stdenv ? bzip2) stdenv.bzip2 + (import ../tools/compression/bzip2 { + inherit fetchurl stdenv; + }); zdelta = (import ../tools/compression/zdelta) { inherit fetchurl stdenv; @@ -338,9 +344,10 @@ rec { ### SHELLS - bash = useFromStdenv (stdenv ? bash) stdenv.bash (import ../shells/bash { - inherit fetchurl stdenv; - }); + bash = useFromStdenv (stdenv ? bash) stdenv.bash + (import ../shells/bash { + inherit fetchurl stdenv; + }); tcsh = (import ../shells/tcsh) { inherit fetchurl stdenv ncurses; @@ -354,9 +361,9 @@ rec { ### DEVELOPMENT binutils = useFromStdenv (stdenv ? binutils) stdenv.binutils - (import ../development/tools/misc/binutils { - inherit fetchurl stdenv noSysDirs; - }); + (import ../development/tools/misc/binutils { + inherit fetchurl stdenv noSysDirs; + }); binutilsMips = (import ../development/tools/misc/binutils-cross) { inherit fetchurl stdenv noSysDirs; @@ -374,9 +381,9 @@ rec { }; patchelf = useFromStdenv (stdenv ? patchelf) stdenv.patchelf - (import ../development/tools/misc/patchelf) { - inherit fetchurl stdenv; - }; + (import ../development/tools/misc/patchelf { + inherit fetchurl stdenv; + }); gnum4 = (import ../development/tools/misc/gnum4) { inherit fetchurl stdenv; @@ -468,9 +475,9 @@ rec { }; gnumake = useFromStdenv (stdenv ? gnumake) stdenv.gnumake - (import ../development/tools/build-managers/gnumake { - inherit fetchurl stdenv; - }); + (import ../development/tools/build-managers/gnumake { + inherit fetchurl stdenv; + }); mk = (import ../development/tools/build-managers/mk) { inherit fetchurl stdenv; From 03aef934d154834fe246c23f7196f7eb36c236a7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 8 Mar 2006 15:34:05 +0000 Subject: [PATCH 10/14] * Fix "infinite recursion" errors on FreeBSD and Darwin. svn path=/nixpkgs/branches/usability/; revision=4997 --- pkgs/stdenv/darwin/default.nix | 5 +++++ pkgs/stdenv/freebsd/default.nix | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index b07a694276e..772b8973e6c 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -16,4 +16,9 @@ genericStdenv { }; shell = "/bin/sh"; + + extraAttrs = { + # Curl should be in /usr/bin or so. + curl = null; + }; } diff --git a/pkgs/stdenv/freebsd/default.nix b/pkgs/stdenv/freebsd/default.nix index 2fa92f7d95b..a94533edfaf 100644 --- a/pkgs/stdenv/freebsd/default.nix +++ b/pkgs/stdenv/freebsd/default.nix @@ -16,4 +16,9 @@ genericStdenv { }; shell = "/bin/bash"; + + extraAttrs = { + # Curl should be in /usr/bin or so. + curl = null; + }; } From a2d161eb4c152cc48c85372325cd6ceece492f14 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 8 Mar 2006 15:38:58 +0000 Subject: [PATCH 11/14] * Barf if curl is not properly set. svn path=/nixpkgs/branches/usability/; revision=4998 --- pkgs/top-level/all-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 34b97fc8c5f..c720f94257f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -232,7 +232,7 @@ rec { inherit fetchurl stdenv; }; - curl = useFromStdenv (stdenv ? curl) stdenv.curl realCurl; + curl = if stdenv ? curl then stdenv.curl else (assert false; null); realCurl = (import ../tools/networking/curl) { inherit fetchurl stdenv zlib; From 4c63a4a97a56d992ccc83e77ce477d3b22906240 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 8 Mar 2006 16:03:47 +0000 Subject: [PATCH 12/14] * Don't pass Blackdown to firefox-wrapper unless it is actually built. svn path=/nixpkgs/branches/usability/; revision=4999 --- pkgs/development/compilers/blackdown/default.nix | 2 +- pkgs/top-level/all-packages.nix | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/blackdown/default.nix b/pkgs/development/compilers/blackdown/default.nix index 43ed19a1098..b83c3124e8a 100644 --- a/pkgs/development/compilers/blackdown/default.nix +++ b/pkgs/development/compilers/blackdown/default.nix @@ -6,4 +6,4 @@ if stdenv.system == "i686-linux" inherit stdenv fetchurl; } else - false + null diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c720f94257f..4d95325c1e0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1887,9 +1887,8 @@ rec { plugins = [ MPlayerPlugin flashplayer - blackdown # RealPlayer # disabled by default for legal reasons - ]; + ] ++ (if blackdown != null then [blackdown] else []); }; firefoxWrapper = wrapFirefox firefox; From baec8f5b38e83a456eebdf742834efc2c22386c6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 10 Mar 2006 16:12:46 +0000 Subject: [PATCH 13/14] * stdenv.mkDerivation now takes an optional attribute "meta" that contains arbitrary information about a package, like this: meta = { homepage = "http://gcc.gnu.org/"; license = "GPL/LGPL"; description = "GNU Compiler Collection, 4.0.x"; }; The "meta" attribute is not passed to the actual derivation operation, so it's not a dependency --- changes to "meta" attributes don't trigger a recompilation. Now we have to standardise some useful attributes ;-) svn path=/nixpkgs/branches/usability/; revision=5024 --- .../browsers/firefox-wrapper/default.nix | 4 +++ .../networking/browsers/firefox/default.nix | 4 +++ .../gcc-cross-wrapper/default.nix | 3 +++ pkgs/build-support/gcc-wrapper/default.nix | 3 +++ .../compilers/gcc-4.0-cross/default.nix | 6 +++++ .../development/compilers/gcc-4.0/default.nix | 6 +++++ .../development/libraries/aterm/aterm-2.4.nix | 5 ++++ pkgs/stdenv/generic/default.nix | 26 ++++++++++++++----- 8 files changed, 50 insertions(+), 7 deletions(-) diff --git a/pkgs/applications/networking/browsers/firefox-wrapper/default.nix b/pkgs/applications/networking/browsers/firefox-wrapper/default.nix index c806d88c80a..909a52d0a41 100644 --- a/pkgs/applications/networking/browsers/firefox-wrapper/default.nix +++ b/pkgs/applications/networking/browsers/firefox-wrapper/default.nix @@ -11,4 +11,8 @@ stdenv.mkDerivation { # Let each plugin tell us (through its `mozillaPlugin') attribute # where to find the plugin in its tree. plugins = map (x: x ~ x.mozillaPlugin) plugins; + + meta = { + description = firefox.meta.description + " (with various plugins)"; + }; } diff --git a/pkgs/applications/networking/browsers/firefox/default.nix b/pkgs/applications/networking/browsers/firefox/default.nix index a620a2b39b3..55ef8813e4b 100644 --- a/pkgs/applications/networking/browsers/firefox/default.nix +++ b/pkgs/applications/networking/browsers/firefox/default.nix @@ -15,4 +15,8 @@ stdenv.mkDerivation { inherit gtk; patches = [./writable-copies.patch]; + + meta = { + description = "Mozilla Firefox - the browser, reloaded"; + }; } diff --git a/pkgs/build-support/gcc-cross-wrapper/default.nix b/pkgs/build-support/gcc-cross-wrapper/default.nix index 0ceab44ee27..09f7f006928 100644 --- a/pkgs/build-support/gcc-cross-wrapper/default.nix +++ b/pkgs/build-support/gcc-cross-wrapper/default.nix @@ -27,4 +27,7 @@ stdenv.mkDerivation { langCC = if nativeTools then true else gcc.langCC; langF77 = if nativeTools then false else gcc.langF77; shell = if shell == "" then stdenv.shell else shell; + meta = if gcc != null then gcc.meta else + { description = "System C compiler wrapper"; + }; } diff --git a/pkgs/build-support/gcc-wrapper/default.nix b/pkgs/build-support/gcc-wrapper/default.nix index 4296aef67c8..22d02395129 100644 --- a/pkgs/build-support/gcc-wrapper/default.nix +++ b/pkgs/build-support/gcc-wrapper/default.nix @@ -27,4 +27,7 @@ stdenv.mkDerivation { langCC = if nativeTools then true else gcc.langCC; langF77 = if nativeTools then false else gcc.langF77; shell = if shell == "" then stdenv.shell else shell; + meta = if gcc != null then gcc.meta else + { description = "System C compiler wrapper"; + }; } diff --git a/pkgs/development/compilers/gcc-4.0-cross/default.nix b/pkgs/development/compilers/gcc-4.0-cross/default.nix index a31353e2d23..ecae99ceeee 100644 --- a/pkgs/development/compilers/gcc-4.0-cross/default.nix +++ b/pkgs/development/compilers/gcc-4.0-cross/default.nix @@ -26,4 +26,10 @@ stdenv.mkDerivation { buildInputs = [binutilsCross]; inherit kernelHeadersCross binutilsCross; platform = cross; + + meta = { + homepage = "http://gcc.gnu.org/"; + license = "GPL/LGPL"; + description = "GNU Compiler Collection, 4.0.x (cross-compiler for " + cross + ")"; + }; } diff --git a/pkgs/development/compilers/gcc-4.0/default.nix b/pkgs/development/compilers/gcc-4.0/default.nix index bed212e964b..8363c10edb4 100644 --- a/pkgs/development/compilers/gcc-4.0/default.nix +++ b/pkgs/development/compilers/gcc-4.0/default.nix @@ -15,4 +15,10 @@ stdenv.mkDerivation { # !!! apply only if noSysDirs is set patches = [./no-sys-dirs.patch]; inherit noSysDirs langC langCC langF77 profiledCompiler; + + meta = { + homepage = "http://gcc.gnu.org/"; + license = "GPL/LGPL"; + description = "GNU Compiler Collection, 4.0.x"; + }; } diff --git a/pkgs/development/libraries/aterm/aterm-2.4.nix b/pkgs/development/libraries/aterm/aterm-2.4.nix index a4a802471fe..c367b4b9054 100644 --- a/pkgs/development/libraries/aterm/aterm-2.4.nix +++ b/pkgs/development/libraries/aterm/aterm-2.4.nix @@ -6,4 +6,9 @@ stdenv.mkDerivation { url = http://nix.cs.uu.nl/dist/tarballs/aterm-2.4.2.tar.gz; md5 = "18617081dd112d85e6c4b1b552628114"; }; + meta = { + homepage = http://www.cwi.nl/htbin/sen1/twiki/bin/view/SEN1/ATerm; + license = "LGPL"; + description = "Library for manipulation of term data structures in C"; + }; } diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 5bb63f1b815..90770e9dddc 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -26,13 +26,25 @@ let { # stdenv and its shell. // { - mkDerivation = attrs: derivation (attrs // { - builder = if attrs ? realBuilder then attrs.realBuilder else shell; - args = if attrs ? args then attrs.args else - ["-e" (if attrs ? builder then attrs.builder else ./default-builder.sh)]; - stdenv = body; - system = body.system; - }); + mkDerivation = attrs: + (derivation ( + (removeAttrs attrs ["meta"]) + // + { + builder = if attrs ? realBuilder then attrs.realBuilder else shell; + args = if attrs ? args then attrs.args else + ["-e" (if attrs ? builder then attrs.builder else ./default-builder.sh)]; + stdenv = body; + system = body.system; + }) + ) + // + # The meta attribute is passed in the resulting attribute set, + # but it's not part of the actual derivation, i.e., it's not + # passed to the builder and is not a dependency. But since we + # include it in the result, it *is* available to nix-env for + # queries. + { meta = if attrs ? meta then attrs.meta else {}; }; } From 211f29fe28426337eb05eb86ab52885cbc58ab0f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Mar 2006 16:47:34 +0000 Subject: [PATCH 14/14] * Recurse into xorg, gnome, gtkLibs (i.e., they show up in nix-env operations). svn path=/nixpkgs/branches/usability/; revision=5085 --- pkgs/top-level/all-packages.nix | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4d95325c1e0..95dd5e034dd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -40,6 +40,10 @@ rec { ### Helper functions. useFromStdenv = hasIt: it: alternative: if hasIt then it else alternative; + # Applying this to an attribute set will cause nix-env to look + # inside the set for derivations. + recurseIntoAttrs = attrs: attrs // {recurseForDerivations = true;}; + ### STANDARD ENVIRONMENT @@ -1036,7 +1040,7 @@ rec { inherit fetchurl stdenv pkgconfig x11 fontconfig freetype zlib libpng; }; - gtkLibs = gtkLibs28; + gtkLibs = recurseIntoAttrs gtkLibs28; gtkLibs28 = import ../development/libraries/gtk-libs-2.8 { inherit fetchurl stdenv pkgconfig gettext perl x11 @@ -1127,13 +1131,13 @@ rec { inherit fetchurl stdenv; }; - gnome = import ../development/libraries/gnome { + gnome = recurseIntoAttrs (import ../development/libraries/gnome { inherit fetchurl stdenv pkgconfig audiofile flex bison popt zlib libxml2 libxslt perl perlXMLParser docbook_xml_dtd_42 gettext x11 libtiff libjpeg libpng gtkLibs; inherit (xlibs) libXmu; - }; + }); wxGTK = wxGTK26; @@ -1559,10 +1563,10 @@ rec { inherit fetchurl stdenv apacheHttpd python; }; - xorg = import ../servers/x11/xorg { + xorg = recurseIntoAttrs (import ../servers/x11/xorg { inherit fetchurl stdenv pkgconfig freetype fontconfig expat libdrm libpng zlib perl mesa; - }; + }); postgresql = (import ../servers/sql/postgresql) { inherit fetchurl stdenv readline ncurses zlib;