* Use runCommand.

svn path=/nixos/trunk/; revision=7300
This commit is contained in:
Eelco Dolstra 2006-12-10 22:43:04 +00:00
parent acf656125c
commit c063ea2bfa
5 changed files with 33 additions and 55 deletions

View file

@ -44,21 +44,19 @@ rec {
# Some additional utilities needed in stage 1, notably mount. We
# don't want to bring in all of util-linux, so we just copy what we
# need.
extraUtils = pkgs.stdenv.mkDerivation {
name = "extra-utils";
builder = builtins.toFile "builder.sh" "
source $stdenv/setup
extraUtils = pkgs.runCommand "extra-utils"
{ buildInputs = [pkgs.nukeReferences];
inherit (pkgsStatic) utillinux;
inherit (pkgs) splashutils;
e2fsprogs = pkgs.e2fsprogsDiet;
}
"
ensureDir $out/bin
cp $utillinux/bin/mount $utillinux/bin/umount $utillinux/sbin/pivot_root $out/bin
cp -p $e2fsprogs/sbin/fsck* $e2fsprogs/sbin/e2fsck $out/bin
cp $splashutils/bin/splash_helper $out/bin
nuke-refs $out/bin/*
";
buildInputs = [pkgs.nukeReferences];
inherit (pkgsStatic) utillinux;
inherit (pkgs) splashutils;
e2fsprogs = pkgs.e2fsprogsDiet;
};
# The init script of boot stage 1 (loading kernel modules for
@ -99,14 +97,14 @@ rec {
# The installer.
nixosInstaller = import ../installer/nixos-installer.nix {
inherit (pkgs) stdenv substituteAll;
inherit (pkgs) stdenv runCommand substituteAll;
inherit nix;
};
# The services (Upstart) configuration for the system.
upstartJobs = import ../upstart-jobs/gather.nix {
inherit (pkgs) stdenv;
inherit (pkgs) runCommand;
jobs = map makeJob [
# Syslogd.
@ -241,7 +239,7 @@ rec {
makeJob = import ../upstart-jobs/make-job.nix {
inherit (pkgs) stdenv;
inherit (pkgs) runCommand;
};

View file

@ -1,4 +1,4 @@
{stdenv, substituteAll, nix}:
{stdenv, runCommand, substituteAll, nix}:
substituteAll {
src = ./nixos-installer.sh;
@ -8,9 +8,7 @@ substituteAll {
pathsFromGraph = ../helpers/paths-from-graph.sh;
nixClosure = stdenv.mkDerivation {
name = "closure";
exportReferencesGraph = ["refs" nix];
builder = builtins.toFile "builder.sh" "source $stdenv/setup; cp refs $out";
};
nixClosure = runCommand "closure"
{exportReferencesGraph = ["refs" nix];}
"cp refs $out";
}

View file

@ -20,32 +20,23 @@ rec {
# Since the CD is read-only, the mount points must be on disk.
cdMountPoints = pkgs.stdenv.mkDerivation {
name = "mount-points";
builder = builtins.toFile "builder.sh" "
source $stdenv/setup
ensureDir $out
cd $out
mkdir proc sys tmp etc dev var mnt nix nix/var
touch $out/${cdromLabel}
";
};
cdMountPoints = pkgs.runCommand "mount-points" {} "
ensureDir $out
cd $out
mkdir proc sys tmp etc dev var mnt nix nix/var
touch $out/${cdromLabel}
";
# We need a copy of the Nix expressions for Nixpkgs and NixOS on the
# CD. We put them in a tarball because accessing that many small
# files from a slow device like a CD-ROM takes too long.
makeTarball = tarName: input: pkgs.stdenv.mkDerivation {
name = "tarball";
inherit tarName input;
builder = builtins.toFile "builder.sh" "
source $stdenv/setup
ensureDir $out
(cd $input && tar cvfj $out/$tarName . \\
--exclude '*~' --exclude '.svn' \\
--exclude 'pkgs' --exclude 'result')
";
};
makeTarball = tarName: input: pkgs.runCommand "tarball" "
ensureDir $out
(cd ${input} && tar cvfj $out/${tarName} . \\
--exclude '*~' --exclude '.svn' \\
--exclude 'pkgs' --exclude 'result')
";
# Put the current directory in the tarball. !!! This gives us a lot

View file

@ -1,19 +1,13 @@
# Create an etc/event.d directory containing symlinks to the
# specified list of Upstart job files.
{stdenv, jobs}:
{runCommand, jobs}:
stdenv.mkDerivation {
name = "upstart-jobs";
inherit jobs;
builder = builtins.toFile "builder.sh" "
source $stdenv/setup
runCommand "upstart-jobs" {inherit jobs;}
"
ensureDir $out/etc/event.d
for i in $jobs; do
if test -d $i; then
ln -s $i/etc/event.d/* $out/etc/event.d/
fi
done
";
}
"

View file

@ -1,7 +1,4 @@
{stdenv}: job:
{runCommand}: job:
stdenv.mkDerivation {
inherit (job) name job;
builder = builtins.toFile "builder.sh"
"source $stdenv/setup; ensureDir $out/etc/event.d; echo \"$job\" > $out/etc/event.d/$name";
}
runCommand job.name {inherit (job) job;}
"ensureDir $out/etc/event.d; echo \"$job\" > $out/etc/event.d/$name"