* It is now possible to execute a builder using a shell inside the Nix
store, rather than outside (such as /bin/sh).
For instance, the Nix expression for the ATerm library now looks
like this:
{stdenv, fetchurl}:
stdenv.mkDerivation {
name = "aterm-2.0.5";
builder = ./builder.sh;
...
}
where `mkDerivation' is a helper function in `stdenv' that massages
the given attribute set into using the bash shell that is part of
the standard environment:
mkDerivation = attrs: derivation (att s // {
builder = pkgs.bash ~ /bin/sh;
args = ["-e" attrs.builder];
stdenv = (...);
system = (...).system;
});
Note that this makes it unnecessary to set the `stdenv' and `system'
attributes, since `mkDerivation' already does that.
svn path=/nixpkgs/trunk/; revision=866
This commit is contained in:
@@ -1,6 +1,3 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
. $stdenv/setup
|
. $stdenv/setup
|
||||||
|
|
||||||
configureFlags="--with-gcc"
|
configureFlags="--with-gcc"
|
||||||
genericBuild
|
genericBuild
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
{stdenv, fetchurl}:
|
{stdenv, fetchurl}:
|
||||||
|
|
||||||
derivation {
|
stdenv.mkDerivation {
|
||||||
name = "aterm-2.0.5";
|
name = "aterm-2.0.5";
|
||||||
system = stdenv.system;
|
|
||||||
builder = ./builder.sh;
|
builder = ./builder.sh;
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.0.5.tar.gz;
|
url = http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.0.5.tar.gz;
|
||||||
md5 = "68aefb0c10b2ab876b8d3c0b2d0cdb1b";
|
md5 = "68aefb0c10b2ab876b8d3c0b2d0cdb1b";
|
||||||
};
|
};
|
||||||
inherit stdenv;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,36 @@
|
|||||||
{stdenv, glibc, pkgs, genericStdenv, gccWrapper}:
|
{stdenv, glibc, pkgs, genericStdenv, gccWrapper}:
|
||||||
|
|
||||||
genericStdenv {
|
let {
|
||||||
name = "stdenv-nix-linux";
|
|
||||||
preHook = ./prehook.sh;
|
|
||||||
initialPath = (import ../nix/path.nix) {pkgs = pkgs;};
|
|
||||||
|
|
||||||
inherit stdenv;
|
body =
|
||||||
|
|
||||||
gcc = gccWrapper {
|
genericStdenv {
|
||||||
name = pkgs.gcc.name;
|
name = "stdenv-nix-linux";
|
||||||
nativeTools = false;
|
preHook = ./prehook.sh;
|
||||||
nativeGlibc = false;
|
initialPath = (import ../nix/path.nix) {pkgs = pkgs;};
|
||||||
inherit (pkgs) gcc binutils;
|
|
||||||
inherit stdenv glibc;
|
inherit stdenv;
|
||||||
};
|
|
||||||
|
gcc = gccWrapper {
|
||||||
|
name = pkgs.gcc.name;
|
||||||
|
nativeTools = false;
|
||||||
|
nativeGlibc = false;
|
||||||
|
inherit (pkgs) gcc binutils;
|
||||||
|
inherit stdenv glibc;
|
||||||
|
};
|
||||||
|
|
||||||
|
param1 = pkgs.bash;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add a utility function to produce derivations that use this
|
||||||
|
# stdenv and its the bash shell.
|
||||||
|
// {
|
||||||
|
mkDerivation = attrs: derivation (attrs // {
|
||||||
|
builder = pkgs.bash ~ /bin/sh;
|
||||||
|
args = ["-e" attrs.builder];
|
||||||
|
stdenv = body;
|
||||||
|
system = body.system;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
param1 = pkgs.bash;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user