diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index f68901087747..c9e01d1773f2 100644 --- a/configuration/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -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; }; diff --git a/installer/nixos-installer.nix b/installer/nixos-installer.nix index 783a48f40a99..651efeabeb52 100644 --- a/installer/nixos-installer.nix +++ b/installer/nixos-installer.nix @@ -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"; } diff --git a/instances/rescue-cd.nix b/instances/rescue-cd.nix index a8a888369119..bfe4dca3fd11 100644 --- a/instances/rescue-cd.nix +++ b/instances/rescue-cd.nix @@ -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 diff --git a/upstart-jobs/gather.nix b/upstart-jobs/gather.nix index 914c78e7a89d..471931673602 100644 --- a/upstart-jobs/gather.nix +++ b/upstart-jobs/gather.nix @@ -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 - "; -} + " diff --git a/upstart-jobs/make-job.nix b/upstart-jobs/make-job.nix index 3995a8f21aa0..630ae1d83e16 100644 --- a/upstart-jobs/make-job.nix +++ b/upstart-jobs/make-job.nix @@ -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"