Skip to content

Commit

Permalink
* Through the magic of functional programming, let stdenv export a
Browse files Browse the repository at this point in the history
  function to regenerate itself with a different setup script.  This
  is useful for experimenting with changes to the setup script in
  specific packages without triggering a rebuild of everything.

* stdenv/generic/setup-latest.sh is a branch of setup.sh containing
  pending changes that will be merged into setup.sh eventually.

* setup-latest.sh: don't use tar's "z" and "j" flags.  Rather, call
  gzip and bunzip2 directly.

svn path=/nixpkgs/trunk/; revision=6066
  • Loading branch information
edolstra committed Aug 7, 2006
1 parent f587be2 commit f1166e0
Show file tree
Hide file tree
Showing 3 changed files with 736 additions and 42 deletions.
97 changes: 55 additions & 42 deletions pkgs/stdenv/generic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,69 @@

let {

body =
stdenvGenerator = setupScript: rec {

stdenv.mkDerivation {
inherit name;
# The stdenv that we are producing.
result =

builder = ./builder.sh;
stdenv.mkDerivation {
inherit name;

substitute = ../../build-support/substitute/substitute.sh;
builder = ./builder.sh;

setup = ./setup.sh;
substitute = ../../build-support/substitute/substitute.sh;

inherit preHook postHook initialPath gcc shell;
setup = setupScript;

# TODO: make this more elegant.
inherit param1 param2 param3 param4 param5;
}
inherit preHook postHook initialPath gcc shell;

// {
# TODO: make this more elegant.
inherit param1 param2 param3 param4 param5;
}

// {

# Add a utility function to produce derivations that use this
# stdenv and its shell.
mkDerivation = attrs:
(derivation (
(removeAttrs attrs ["meta"])
# Add a utility function to produce derivations that use this
# stdenv and its shell.
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 = result;
system = result.system;
})
)
//
{
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 {}; };

# Utility value: is this a Darwin system?
isDarwin = body.system == "i686-darwin" || body.system == "powerpc-darwin";

}

# 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;
# 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 {}; };

# Utility value: is this a Darwin system?
isDarwin = result.system == "i686-darwin" || result.system == "powerpc-darwin";

# Utility function: allow stdenv to be easily regenerated with
# a different setup script. (See all-packages.nix for an
# example.)
regenerate = stdenvGenerator;

}

# 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;

}.result;


body = stdenvGenerator ./setup.sh;

}
Loading

0 comments on commit f1166e0

Please sign in to comment.