* Started setting up a proper init environment.

svn path=/nixu/trunk/; revision=785
gstqt5
Eelco Dolstra 2004-02-16 09:41:00 +00:00
parent e019265ec9
commit 1f7a8c8ae9
8 changed files with 44 additions and 7 deletions

View File

@ -1,4 +0,0 @@
let {
pkgs = import pkgs/system/i686-linux.nix;
body = pkgs.bash;
}

View File

@ -52,7 +52,7 @@ done) < /tmp/successors
echo setting init symlink...
initPath=$(/nix/bin/nix-store -qn $initExpr)
rm -f $root/init
ln -s $initPath/bin/sh $root/init
ln -s $initPath/bin/init $root/init
echo unmounting...
umount $root

14
init/builder.sh Executable file
View File

@ -0,0 +1,14 @@
#! /bin/sh -e
. $stdenv/setup
mkdir $out
mkdir $out/bin
sed \
-e "s^@bash\@^$bash^g" \
-e "s^@coreutils\@^$coreutils^g" \
-e "s^@findutils\@^$findutils^g" \
< $src > $out/bin/init
chmod +x $out/bin/init

9
init/default.nix Normal file
View File

@ -0,0 +1,9 @@
{stdenv, bash, coreutils, findutils}:
derivation {
name = "init";
system = stdenv.system;
builder = ./builder.sh;
src = ./init.sh;
inherit stdenv bash coreutils findutils;
}

14
init/init.sh Normal file
View File

@ -0,0 +1,14 @@
#! @bash@/bin/sh -e
export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin
echo "--- Nix ---"
#echo "remounting root..."
echo "starting root shell..."
@bash@/bin/sh
echo "shutting down..."
exit 0

View File

@ -18,7 +18,7 @@ fi
# What to copy?
storeexpr=$(nix-instantiate ./bootstrap.nix)
storeexpr=$(echo '(import ./pkgs.nix).init' | nix-instantiate -)
nix-store -rB $storeexpr
nix-store -qn --requisites $storeexpr > $storepaths

4
pkgs.nix Normal file
View File

@ -0,0 +1,4 @@
rec {
inherit (import pkgs/system/i686-linux.nix) stdenv bash coreutils findutils;
init = (import ./init) {inherit stdenv bash coreutils findutils;};
}

2
run.sh
View File

@ -2,4 +2,4 @@
image=/tmp/disk.img
linux ubd0=$image init="/init"
linux ubd0="$image" mem=256M init="/init"