From e019265ec958f836b0290d07afbf5fe2e1c3d14a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 14 Feb 2004 22:56:51 +0000 Subject: [PATCH 0001/5331] * Scripts to set up and run the absolute minimal pure Nix environment; that is, an operating system environment in which there is (essentially) only a store. The script `make-disk.sh' creates an ext2 disk image, creates a Nix store in it, and copies the closure of the bash package (from nixpkgs) to it. The script `run.sh' then starts bash in a UML virtual machine. The contents of the image after creation look like this: $ ls -l drwxr-xr-x 2 root root 1024 2004-02-14 19:13 dev lrwxrwxrwx 1 root root 61 2004-02-14 23:34 init -> /nix/store/e40873ece7a010752ad72b4262b23d28-bash-2.05b/bin/sh drwx------ 2 root root 12288 2004-02-14 19:13 lost+found drwxr-xr-x 4 root root 1024 2004-02-14 19:13 nix drwxr-xr-x 2 root root 1024 2004-02-14 19:13 proc drwxrwxrwt 2 root root 1024 2004-02-14 19:13 tmp The next step is to add all the other stuff that goes into a working system (coreutils, etc.). BTW, if you don't have `ls' you can still list directories by doing `echo *' :-) Nix itself should also be Nixified so that it can be put into the store. svn path=/nixu/trunk/; revision=783 --- bootstrap.nix | 4 ++++ fill-disk.sh | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ make-disk.sh | 34 +++++++++++++++++++++++++++ run.sh | 5 ++++ 4 files changed, 107 insertions(+) create mode 100644 bootstrap.nix create mode 100755 fill-disk.sh create mode 100755 make-disk.sh create mode 100755 run.sh diff --git a/bootstrap.nix b/bootstrap.nix new file mode 100644 index 00000000000..bd141c96ff8 --- /dev/null +++ b/bootstrap.nix @@ -0,0 +1,4 @@ +let { + pkgs = import pkgs/system/i686-linux.nix; + body = pkgs.bash; +} \ No newline at end of file diff --git a/fill-disk.sh b/fill-disk.sh new file mode 100755 index 00000000000..8c09c788e9d --- /dev/null +++ b/fill-disk.sh @@ -0,0 +1,64 @@ +#! /bin/sh -e + +initExpr=$1 + +make_dir() { + mode=$1 + name=$2 + echo creating $name... + if ! test -d $root/$name; then mkdir $root/$name; fi + chmod $mode $root/$name +} + +root=/tmp/mnt + +echo mounting... +mount -t ext2 /dev/discs/disc0/disc $root + +make_dir 00755 /dev +make_dir 00755 /proc +make_dir 01777 /tmp +make_dir 00755 /nix +make_dir 00755 /nix/store +make_dir 00755 /nix/var +make_dir 00755 /nix/var/nix +make_dir 00755 /nix/var/nix/db +make_dir 00755 /nix/var/log +make_dir 00755 /nix/var/log/nix + +export NIX_ROOT=$root + +echo initialising Nix DB... +/nix/bin/nix-store --init + +echo verifying Nix DB... +/nix/bin/nix-store --verify + +echo registering valid paths... +(while read storepath; do + echo PATH $storepath + if ! /nix/bin/nix-store --isvalid $storepath 2> /dev/null; then + (unset NIX_ROOT; /nix/bin/nix-store --dump $storepath) | /nix/bin/nix-store --restore $storepath + /nix/bin/nix-store --validpath $storepath + fi +done) < /tmp/storepaths + +echo registering successors... +(while read line; do + echo SUCC $line + /nix/bin/nix-store --successor $line +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 + +echo unmounting... +umount $root + +echo syncing... +sync + +echo halting... +/sbin/halt -d -f diff --git a/make-disk.sh b/make-disk.sh new file mode 100755 index 00000000000..e891159f9e8 --- /dev/null +++ b/make-disk.sh @@ -0,0 +1,34 @@ +#! /bin/sh -e + +image=/tmp/disk.img +size=$(expr 256 \* 1024 \* 1024) +storepaths=/tmp/storepaths +successors=/tmp/successors + +if ! test -f $image; then + + echo creating empty disk of $size bytes in $image... + # Note: this is a sparse file. + dd if=/dev/zero of=$image bs=1 seek=$(expr $size - 1) count=1 + + echo creating disk image in $image... + /sbin/mke2fs -F $image + +fi + + +# What to copy? +storeexpr=$(nix-instantiate ./bootstrap.nix) +nix-store -rB $storeexpr +nix-store -qn --requisites $storeexpr > $storepaths + +(while read storepath; do + nix-store -q --predecessors $storepath | (while read predecessor; do + echo $predecessor $storepath + done) +done) < $storepaths > $successors + +# Fill the disk with the minimal Nix store. +if ! test -d /tmp/mnt; then mkdir /tmp/mnt; fi +linux ubd0=$image root=/dev/root rootflags=/ rootfstype=hostfs init="$(pwd)/fill-disk.sh $storeexpr" + diff --git a/run.sh b/run.sh new file mode 100755 index 00000000000..19c329f67b1 --- /dev/null +++ b/run.sh @@ -0,0 +1,5 @@ +#! /bin/sh -e + +image=/tmp/disk.img + +linux ubd0=$image init="/init" -- GitLab From 1f7a8c8ae9fd84a60d8c02fd5c24bcfef52c3f80 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 16 Feb 2004 09:41:00 +0000 Subject: [PATCH 0002/5331] * Started setting up a proper init environment. svn path=/nixu/trunk/; revision=785 --- bootstrap.nix | 4 ---- fill-disk.sh | 2 +- init/builder.sh | 14 ++++++++++++++ init/default.nix | 9 +++++++++ init/init.sh | 14 ++++++++++++++ make-disk.sh | 2 +- pkgs.nix | 4 ++++ run.sh | 2 +- 8 files changed, 44 insertions(+), 7 deletions(-) delete mode 100644 bootstrap.nix create mode 100755 init/builder.sh create mode 100644 init/default.nix create mode 100644 init/init.sh create mode 100644 pkgs.nix diff --git a/bootstrap.nix b/bootstrap.nix deleted file mode 100644 index bd141c96ff8..00000000000 --- a/bootstrap.nix +++ /dev/null @@ -1,4 +0,0 @@ -let { - pkgs = import pkgs/system/i686-linux.nix; - body = pkgs.bash; -} \ No newline at end of file diff --git a/fill-disk.sh b/fill-disk.sh index 8c09c788e9d..b3c852ddb20 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -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 diff --git a/init/builder.sh b/init/builder.sh new file mode 100755 index 00000000000..5809ad62a30 --- /dev/null +++ b/init/builder.sh @@ -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 diff --git a/init/default.nix b/init/default.nix new file mode 100644 index 00000000000..82bbb460db0 --- /dev/null +++ b/init/default.nix @@ -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; +} diff --git a/init/init.sh b/init/init.sh new file mode 100644 index 00000000000..bb17ef5208f --- /dev/null +++ b/init/init.sh @@ -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 diff --git a/make-disk.sh b/make-disk.sh index e891159f9e8..fb2c3a38545 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -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 diff --git a/pkgs.nix b/pkgs.nix new file mode 100644 index 00000000000..b9fc7a22273 --- /dev/null +++ b/pkgs.nix @@ -0,0 +1,4 @@ +rec { + inherit (import pkgs/system/i686-linux.nix) stdenv bash coreutils findutils; + init = (import ./init) {inherit stdenv bash coreutils findutils;}; +} diff --git a/run.sh b/run.sh index 19c329f67b1..5f6a9e34fe9 100755 --- a/run.sh +++ b/run.sh @@ -2,4 +2,4 @@ image=/tmp/disk.img -linux ubd0=$image init="/init" +linux ubd0="$image" mem=256M init="/init" -- GitLab From 1e87e75d079c4d80bf6cba8b2d986894121b217f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 18 Feb 2004 10:56:07 +0000 Subject: [PATCH 0003/5331] * Use sysvinit's init to start the system. This has the happy side-effect of initialising the console properly (i.e., enabling Ctrl-[C, Z]). svn path=/nixu/trunk/; revision=801 --- fill-disk.sh | 20 +++++++++++++++++--- init/builder.sh | 4 ++++ init/default.nix | 4 ++-- init/init.sh | 25 ++++++++++++++++++++++--- make-disk.sh | 21 +++++++++++++-------- pkgs.nix | 9 +++++++-- 6 files changed, 65 insertions(+), 18 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index b3c852ddb20..8c9e3b6c8fd 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,7 @@ #! /bin/sh -e -initExpr=$1 +sysvinitPath=$1 +initPath=$2 make_dir() { mode=$1 @@ -18,6 +19,8 @@ mount -t ext2 /dev/discs/disc0/disc $root make_dir 00755 /dev make_dir 00755 /proc make_dir 01777 /tmp +make_dir 00755 /etc # global non-constant configuration +make_dir 00755 /var make_dir 00755 /nix make_dir 00755 /nix/store make_dir 00755 /nix/var @@ -25,6 +28,13 @@ make_dir 00755 /nix/var/nix make_dir 00755 /nix/var/nix/db make_dir 00755 /nix/var/log make_dir 00755 /nix/var/log/nix +make_dir 00755 /mnt +make_dir 00755 /mnt/host +make_dir 00755 /home +make_dir 00755 /home/root + +rm -f $root/etc/mtab +ln -s /proc/mounts $root/etc/mtab export NIX_ROOT=$root @@ -50,9 +60,13 @@ echo registering successors... done) < /tmp/successors echo setting init symlink... -initPath=$(/nix/bin/nix-store -qn $initExpr) rm -f $root/init -ln -s $initPath/bin/init $root/init +ln -s $sysvinitPath/sbin/init $root/init + +echo setting up inittab... +rm -f $root/etc/inittab +echo "id:2:initdefault:" >> $root/etc/inittab +echo "si::bootwait:$initPath/bin/init" >> $root/etc/inittab echo unmounting... umount $root diff --git a/init/builder.sh b/init/builder.sh index 5809ad62a30..a12da5342b1 100755 --- a/init/builder.sh +++ b/init/builder.sh @@ -9,6 +9,10 @@ sed \ -e "s^@bash\@^$bash^g" \ -e "s^@coreutils\@^$coreutils^g" \ -e "s^@findutils\@^$findutils^g" \ + -e "s^@utillinux\@^$utillinux^g" \ + -e "s^@sysvinit\@^$sysvinit^g" \ + -e "s^@e2fsprogs\@^$e2fsprogs^g" \ + -e "s^@nix\@^$nix^g" \ < $src > $out/bin/init chmod +x $out/bin/init diff --git a/init/default.nix b/init/default.nix index 82bbb460db0..c49891d593f 100644 --- a/init/default.nix +++ b/init/default.nix @@ -1,9 +1,9 @@ -{stdenv, bash, coreutils, findutils}: +{stdenv, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs, nix}: derivation { name = "init"; system = stdenv.system; builder = ./builder.sh; src = ./init.sh; - inherit stdenv bash coreutils findutils; + inherit stdenv bash coreutils findutils utillinux sysvinit e2fsprogs nix; } diff --git a/init/init.sh b/init/init.sh index bb17ef5208f..c5007b44f2d 100644 --- a/init/init.sh +++ b/init/init.sh @@ -1,14 +1,33 @@ #! @bash@/bin/sh -e -export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin +trap "echo 'ignoring TERM signal'" SIGTERM +trap "echo 'ignoring INT signal'" SIGINT + +export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin echo "--- Nix ---" -#echo "remounting root..." +echo "mounting /proc..." +mount -n -t proc none /proc + +echo "checking /dev/root..." +e2fsck -y /dev/root || test "$?" -le 1 + +echo "remounting / writable..." +mount -n -o remount,rw /dev/root / + +echo "mounting /mnt/host..." +mount -n -t hostfs none /mnt/host echo "starting root shell..." @bash@/bin/sh +echo "remounting / read-only..." +mount -n -o remount,rw /dev/root / || echo "(failed)" # ignore errors + +echo "syncing..." +sync || echo "(failed)" # ignore errors + echo "shutting down..." -exit 0 +halt -d -f diff --git a/make-disk.sh b/make-disk.sh index fb2c3a38545..498753d6fbb 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -2,7 +2,7 @@ image=/tmp/disk.img size=$(expr 256 \* 1024 \* 1024) -storepaths=/tmp/storepaths +storePaths=/tmp/storepaths successors=/tmp/successors if ! test -f $image; then @@ -16,19 +16,24 @@ if ! test -f $image; then fi - # What to copy? -storeexpr=$(echo '(import ./pkgs.nix).init' | nix-instantiate -) -nix-store -rB $storeexpr -nix-store -qn --requisites $storeexpr > $storepaths +storeExpr=$(echo '(import ./pkgs.nix).everything' | nix-instantiate -) +nix-store -rB $storeExpr +nix-store -qn --requisites $storeExpr > $storePaths (while read storepath; do nix-store -q --predecessors $storepath | (while read predecessor; do echo $predecessor $storepath done) -done) < $storepaths > $successors +done) < $storePaths > $successors + +# Location of sysvinit? +sysvinitPath=$(nix-store -qn $(echo '(import ./pkgs.nix).sysvinit' | nix-instantiate -)) + +# Location of Nix init? +initPath=$(nix-store -qn $(echo '(import ./pkgs.nix).init' | nix-instantiate -)) # Fill the disk with the minimal Nix store. if ! test -d /tmp/mnt; then mkdir /tmp/mnt; fi -linux ubd0=$image root=/dev/root rootflags=/ rootfstype=hostfs init="$(pwd)/fill-disk.sh $storeexpr" - +linux ubd0=$image root=/dev/root rootflags=/ rootfstype=hostfs \ + init="$(pwd)/fill-disk.sh $sysvinitPath $initPath" diff --git a/pkgs.nix b/pkgs.nix index b9fc7a22273..d0314a6b300 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,4 +1,9 @@ rec { - inherit (import pkgs/system/i686-linux.nix) stdenv bash coreutils findutils; - init = (import ./init) {inherit stdenv bash coreutils findutils;}; + inherit (import pkgs/system/i686-linux.nix) + stdenv bash coreutils findutils utillinux sysvinit e2fsprogs nix; + + init = (import ./init) + {inherit stdenv bash coreutils findutils utillinux sysvinit e2fsprogs nix;}; + + everything = [init sysvinit]; } -- GitLab From 008ef42267aa9a675cc71b314babf2cc42243c7e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 18 Feb 2004 14:12:49 +0000 Subject: [PATCH 0004/5331] * init -> boot, to prevent confusion. svn path=/nixu/trunk/; revision=802 --- {init => boot}/builder.sh | 0 {init => boot}/default.nix | 0 {init => boot}/init.sh | 3 --- 3 files changed, 3 deletions(-) rename {init => boot}/builder.sh (100%) rename {init => boot}/default.nix (100%) rename {init => boot}/init.sh (89%) diff --git a/init/builder.sh b/boot/builder.sh similarity index 100% rename from init/builder.sh rename to boot/builder.sh diff --git a/init/default.nix b/boot/default.nix similarity index 100% rename from init/default.nix rename to boot/default.nix diff --git a/init/init.sh b/boot/init.sh similarity index 89% rename from init/init.sh rename to boot/init.sh index c5007b44f2d..e34a516c6de 100644 --- a/init/init.sh +++ b/boot/init.sh @@ -1,8 +1,5 @@ #! @bash@/bin/sh -e -trap "echo 'ignoring TERM signal'" SIGTERM -trap "echo 'ignoring INT signal'" SIGINT - export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin echo "--- Nix ---" -- GitLab From 3514c5658b7a8d618ef3babdf54377bf17406689 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 18 Feb 2004 14:56:32 +0000 Subject: [PATCH 0005/5331] * Proper sysvinit boot/halt. At runlevel 2, creates login shells at virtual consoles 0 and 1. To shutdown, do `init 0' (`halt' and `shutdown' don't work because they call /sbin/init). svn path=/nixu/trunk/; revision=803 --- boot/{init.sh => boot.sh} | 13 +------------ boot/builder.sh | 24 +++++++++++++----------- boot/default.nix | 6 ++++-- boot/halt.sh | 12 ++++++++++++ boot/login.sh | 15 +++++++++++++++ fill-disk.sh | 7 +++++-- make-disk.sh | 6 +++--- pkgs.nix | 4 ++-- 8 files changed, 55 insertions(+), 32 deletions(-) rename boot/{init.sh => boot.sh} (65%) create mode 100644 boot/halt.sh create mode 100644 boot/login.sh diff --git a/boot/init.sh b/boot/boot.sh similarity index 65% rename from boot/init.sh rename to boot/boot.sh index e34a516c6de..3f17ea32ac0 100644 --- a/boot/init.sh +++ b/boot/boot.sh @@ -16,15 +16,4 @@ mount -n -o remount,rw /dev/root / echo "mounting /mnt/host..." mount -n -t hostfs none /mnt/host -echo "starting root shell..." - -@bash@/bin/sh - -echo "remounting / read-only..." -mount -n -o remount,rw /dev/root / || echo "(failed)" # ignore errors - -echo "syncing..." -sync || echo "(failed)" # ignore errors - -echo "shutting down..." -halt -d -f +echo "boot done." diff --git a/boot/builder.sh b/boot/builder.sh index a12da5342b1..902940dc907 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -5,14 +5,16 @@ mkdir $out mkdir $out/bin -sed \ - -e "s^@bash\@^$bash^g" \ - -e "s^@coreutils\@^$coreutils^g" \ - -e "s^@findutils\@^$findutils^g" \ - -e "s^@utillinux\@^$utillinux^g" \ - -e "s^@sysvinit\@^$sysvinit^g" \ - -e "s^@e2fsprogs\@^$e2fsprogs^g" \ - -e "s^@nix\@^$nix^g" \ - < $src > $out/bin/init - -chmod +x $out/bin/init +for i in $boot $halt $login; do + dst=$out/bin/$(basename $i | cut -c34-) + sed \ + -e "s^@bash\@^$bash^g" \ + -e "s^@coreutils\@^$coreutils^g" \ + -e "s^@findutils\@^$findutils^g" \ + -e "s^@utillinux\@^$utillinux^g" \ + -e "s^@sysvinit\@^$sysvinit^g" \ + -e "s^@e2fsprogs\@^$e2fsprogs^g" \ + -e "s^@nix\@^$nix^g" \ + < $i > $dst + chmod +x $dst +done \ No newline at end of file diff --git a/boot/default.nix b/boot/default.nix index c49891d593f..8f6820c5e4a 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,9 +1,11 @@ {stdenv, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs, nix}: derivation { - name = "init"; + name = "boot"; system = stdenv.system; builder = ./builder.sh; - src = ./init.sh; + boot = ./boot.sh; + halt = ./halt.sh; + login = ./login.sh; inherit stdenv bash coreutils findutils utillinux sysvinit e2fsprogs nix; } diff --git a/boot/halt.sh b/boot/halt.sh new file mode 100644 index 00000000000..19e89045854 --- /dev/null +++ b/boot/halt.sh @@ -0,0 +1,12 @@ +#! @bash@/bin/sh -e + +export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin + +echo "remounting / read-only..." +mount -n -o remount,rw /dev/root / || echo "(failed)" # ignore errors + +echo "syncing..." +sync || echo "(failed)" # ignore errors + +echo "shutting down..." +halt -d -f diff --git a/boot/login.sh b/boot/login.sh new file mode 100644 index 00000000000..74e14b64de6 --- /dev/null +++ b/boot/login.sh @@ -0,0 +1,15 @@ +#! @bash@/bin/sh -e + +tty=$1 + +exec < $tty > $tty 2>&1 + +export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin + +echo +echo "=== Welcome to Nix! ===" + +export HOME=/home/root +cd $HOME + +exec @bash@/bin/sh diff --git a/fill-disk.sh b/fill-disk.sh index 8c9e3b6c8fd..b50088e16e0 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,7 +1,7 @@ #! /bin/sh -e sysvinitPath=$1 -initPath=$2 +bootPath=$2 make_dir() { mode=$1 @@ -66,7 +66,10 @@ ln -s $sysvinitPath/sbin/init $root/init echo setting up inittab... rm -f $root/etc/inittab echo "id:2:initdefault:" >> $root/etc/inittab -echo "si::bootwait:$initPath/bin/init" >> $root/etc/inittab +echo "si::bootwait:$bootPath/bin/boot.sh" >> $root/etc/inittab +echo "ht:06:wait:$bootPath/bin/halt.sh" >> $root/etc/inittab +echo "1:2345:respawn:$bootPath/bin/login.sh /dev/ttys/0" >> $root/etc/inittab +echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab echo unmounting... umount $root diff --git a/make-disk.sh b/make-disk.sh index 498753d6fbb..00e3cb28de1 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -30,10 +30,10 @@ done) < $storePaths > $successors # Location of sysvinit? sysvinitPath=$(nix-store -qn $(echo '(import ./pkgs.nix).sysvinit' | nix-instantiate -)) -# Location of Nix init? -initPath=$(nix-store -qn $(echo '(import ./pkgs.nix).init' | nix-instantiate -)) +# Location of Nix boot scripts? +bootPath=$(nix-store -qn $(echo '(import ./pkgs.nix).boot' | nix-instantiate -)) # Fill the disk with the minimal Nix store. if ! test -d /tmp/mnt; then mkdir /tmp/mnt; fi linux ubd0=$image root=/dev/root rootflags=/ rootfstype=hostfs \ - init="$(pwd)/fill-disk.sh $sysvinitPath $initPath" + init="$(pwd)/fill-disk.sh $sysvinitPath $bootPath" diff --git a/pkgs.nix b/pkgs.nix index d0314a6b300..d0df974d902 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -2,8 +2,8 @@ rec { inherit (import pkgs/system/i686-linux.nix) stdenv bash coreutils findutils utillinux sysvinit e2fsprogs nix; - init = (import ./init) + boot = (import ./boot) {inherit stdenv bash coreutils findutils utillinux sysvinit e2fsprogs nix;}; - everything = [init sysvinit]; + everything = [boot sysvinit]; } -- GitLab From 91a5fe9eb05718f7e4b5adc68fc6f65fe34f10a6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 19 Feb 2004 12:49:00 +0000 Subject: [PATCH 0006/5331] * Networking now works in the UML machine. Masquerading for the tun device should be enabled on the host in order for the UML machine to be able to talk to the Internet. svn path=/nixu/trunk/; revision=806 --- boot/boot.sh | 14 +++++++++++++- boot/builder.sh | 6 ++++-- boot/default.nix | 7 +++++-- boot/env.sh | 1 + boot/halt.sh | 2 +- boot/login.sh | 4 ++-- fill-disk.sh | 11 ++++++++++- pkgs.nix | 7 ++++--- run.sh | 4 +++- 9 files changed, 43 insertions(+), 13 deletions(-) create mode 100644 boot/env.sh diff --git a/boot/boot.sh b/boot/boot.sh index 3f17ea32ac0..191c081c753 100644 --- a/boot/boot.sh +++ b/boot/boot.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin +. @out@/bin/env.sh echo "--- Nix ---" @@ -16,4 +16,16 @@ mount -n -o remount,rw /dev/root / echo "mounting /mnt/host..." mount -n -t hostfs none /mnt/host +echo "setting up hostname..." +hostname uml + +echo "enabling loopback interface..." +ifconfig lo 127.0.0.1 + +echo "enabling ethernet interface..." +ifconfig eth0 $(cat /etc/networking/local-ip) up + +echo "setting up routing table..." +route add default gw $(cat /etc/networking/gateway-ip) + echo "boot done." diff --git a/boot/builder.sh b/boot/builder.sh index 902940dc907..8748d8875e5 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -5,7 +5,7 @@ mkdir $out mkdir $out/bin -for i in $boot $halt $login; do +for i in $boot $halt $login $env; do dst=$out/bin/$(basename $i | cut -c34-) sed \ -e "s^@bash\@^$bash^g" \ @@ -14,7 +14,9 @@ for i in $boot $halt $login; do -e "s^@utillinux\@^$utillinux^g" \ -e "s^@sysvinit\@^$sysvinit^g" \ -e "s^@e2fsprogs\@^$e2fsprogs^g" \ + -e "s^@nettools\@^$nettools^g" \ -e "s^@nix\@^$nix^g" \ + -e "s^@out\@^$out^g" \ < $i > $dst chmod +x $dst -done \ No newline at end of file +done diff --git a/boot/default.nix b/boot/default.nix index 8f6820c5e4a..6ecd30758b8 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,4 +1,5 @@ -{stdenv, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs, nix}: +{ stdenv, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs +, nettools, nix}: derivation { name = "boot"; @@ -7,5 +8,7 @@ derivation { boot = ./boot.sh; halt = ./halt.sh; login = ./login.sh; - inherit stdenv bash coreutils findutils utillinux sysvinit e2fsprogs nix; + env = ./env.sh; + inherit stdenv bash coreutils findutils utillinux sysvinit + e2fsprogs nettools nix; } diff --git a/boot/env.sh b/boot/env.sh new file mode 100644 index 00000000000..75504da38b7 --- /dev/null +++ b/boot/env.sh @@ -0,0 +1 @@ +export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin: diff --git a/boot/halt.sh b/boot/halt.sh index 19e89045854..8ec9e64535b 100644 --- a/boot/halt.sh +++ b/boot/halt.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin +. @out@/bin/env.sh echo "remounting / read-only..." mount -n -o remount,rw /dev/root / || echo "(failed)" # ignore errors diff --git a/boot/login.sh b/boot/login.sh index 74e14b64de6..9222b2aba13 100644 --- a/boot/login.sh +++ b/boot/login.sh @@ -1,11 +1,11 @@ #! @bash@/bin/sh -e +. @out@/bin/env.sh + tty=$1 exec < $tty > $tty 2>&1 -export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin - echo echo "=== Welcome to Nix! ===" diff --git a/fill-disk.sh b/fill-disk.sh index b50088e16e0..6dc0449f73e 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -69,7 +69,16 @@ echo "id:2:initdefault:" >> $root/etc/inittab echo "si::bootwait:$bootPath/bin/boot.sh" >> $root/etc/inittab echo "ht:06:wait:$bootPath/bin/halt.sh" >> $root/etc/inittab echo "1:2345:respawn:$bootPath/bin/login.sh /dev/ttys/0" >> $root/etc/inittab -echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab +#echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab + +echo setting up networking information... +make_dir 00755 /etc/networking +echo 192.168.150.1 > $root/etc/networking/local-ip +echo 192.168.150.3 > $root/etc/networking/gateway-ip +cp /etc/resolv.conf $root/etc +rm -f $root/etc/hosts +echo "127.0.0.1 localhost" >> $root/etc/hosts +echo "192.168.150.1 uml" >> $root/etc/hosts echo unmounting... umount $root diff --git a/pkgs.nix b/pkgs.nix index d0df974d902..3b6fcb7646e 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,9 +1,10 @@ rec { inherit (import pkgs/system/i686-linux.nix) - stdenv bash coreutils findutils utillinux sysvinit e2fsprogs nix; + stdenv bash coreutils findutils utillinux sysvinit e2fsprogs + nettools nix; - boot = (import ./boot) - {inherit stdenv bash coreutils findutils utillinux sysvinit e2fsprogs nix;}; + boot = (import ./boot) {inherit stdenv bash coreutils findutils + utillinux sysvinit e2fsprogs nettools nix;}; everything = [boot sysvinit]; } diff --git a/run.sh b/run.sh index 5f6a9e34fe9..9a51834e0d2 100755 --- a/run.sh +++ b/run.sh @@ -2,4 +2,6 @@ image=/tmp/disk.img -linux ubd0="$image" mem=256M init="/init" +linux ubd0="$image" mem=256M \ + eth0=tuntap,tap4,,192.168.150.1 \ + init="/init" -- GitLab From 656ea85e60047fb5af644214ecb37c97e16f34a6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 16 Jul 2004 15:41:47 +0000 Subject: [PATCH 0007/5331] * Ignore failure to set up networking. * Unmount, don't remount / on halt. svn path=/nixu/trunk/; revision=1169 --- boot/boot.sh | 6 ++++-- boot/halt.sh | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/boot/boot.sh b/boot/boot.sh index 191c081c753..a6ce1f2d67a 100644 --- a/boot/boot.sh +++ b/boot/boot.sh @@ -1,5 +1,7 @@ #! @bash@/bin/sh -e +set -e + . @out@/bin/env.sh echo "--- Nix ---" @@ -23,9 +25,9 @@ echo "enabling loopback interface..." ifconfig lo 127.0.0.1 echo "enabling ethernet interface..." -ifconfig eth0 $(cat /etc/networking/local-ip) up +ifconfig eth0 $(cat /etc/networking/local-ip) up || true echo "setting up routing table..." -route add default gw $(cat /etc/networking/gateway-ip) +route add default gw $(cat /etc/networking/gateway-ip) || true echo "boot done." diff --git a/boot/halt.sh b/boot/halt.sh index 8ec9e64535b..c6e000b92b6 100644 --- a/boot/halt.sh +++ b/boot/halt.sh @@ -2,8 +2,8 @@ . @out@/bin/env.sh -echo "remounting / read-only..." -mount -n -o remount,rw /dev/root / || echo "(failed)" # ignore errors +echo "unmount file systems..." +umount -avt noproc,nonfs,nosmbfs,nodevfs || echo "(failed)" # ignore errors echo "syncing..." sync || echo "(failed)" # ignore errors -- GitLab From 23f6a57f7a5df2589385cc70e303d6ff21d2c805 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 6 Aug 2004 13:10:44 +0000 Subject: [PATCH 0008/5331] add an installation guide svn path=/nixu/trunk/; revision=1240 --- INSTALL | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 INSTALL diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000000..dfa2ef6bece --- /dev/null +++ b/INSTALL @@ -0,0 +1,72 @@ +Setting up and running Nix UML ("nixu") + +It is possible to run Nix inside a User Mode Linux environment (UML). The Nix +expressions for this can be found at +https://svn.cs.uu.nl:12443/repos/trace/nixu/. + + + Installation on SuSE Linux 9 + +Download the latest nixpkgs collection and checkout the nixu trunk with +subversion. Install the uml and uml-utilities packages with Nix and run the +"make-disk.sh" script which can be found in nixu. After it has built +everything (or downloaded everything from the nixpkgs cache which can be +used with nix-pull) you can use the "run.sh" script to start the UML. + + + Installation on Fedora Core 1 + +Installing the Nix UML on Fedora Core 1 is a bit tricky. Nix relies on +Berkeley DB and there are issues with Berkeley DB and NPTL kernels (New POSIX +Thread Library) on Red Hat based systems. Since the system we build inside +UML does not use NPTL we cannot use the Nix we use on the host system to +fill the disk once we've booted our the kernel of our UML. + +The solution is as follows: + +- install all packages via the nix-pull mechanisms with the MANIFEST from + the official nix-pkgs site to avoid that impure builds link against the + NPTL glibc on the host system. +- install Nix in Nix +- in the nixu scripts edit make-disk.sh and fill-disk.sh. + In make-disk.sh prefix all nix-* commands with the absolute path to the + host-Nix installation bin directory (for example: /nix/bin). In + fill-disk.sh replace all /nix/bin paths with a relative path to the Nix + installed with Nix (for example: /usr/home/nix/.nix-profile/bin). + +This should fix the installation problems and the Nix UML should boot +flawlessly. + + + Nix UML and 2.6 kernel + +Installing the current Nix UML packages with a 2.4 kernel on a 2.6 +kernel based host system will most likely fail. Linux kernel 2.6 uses NPTL +by default, but UML itself seems to be broken somewhat so halfway the system +seems to hang. + +Installing a 2.6 based UML with Nix is not trivial and is not advised. + + + Adding packages to the UML Nix installation + +Packages can be added the the Nix UML installation by editing a few files. +The first file packages should be added to is 'pkgs.nix'. The other files +that should be edited all reside in the "boot" directory. In default.nix +the packages should be added as an argument (first line) and given as an +argument to the builder (line starting with "inherit"). In "builder.sh" +there is a giant sed expression which subsitutes all occurences of the +names of the packages in the files with the right value. If the programs +that are added need to be added to $PATH the file "env.sh" has to be +edited. + +Another option is to enable networking in the UML and use nix-pull to get +all the right packages. One thing you have to make sure is that the packages +you want to install are indeed defined in the nix files. + + + Differences with a normal UML + +A lot of packages are still missing from the current UML. User management +is completely lacking, init scripts and system configuration (/etc) are +not there yet. -- GitLab From eb5fbd58d801b7abdf0cecb7cbd4faea651f9f8d Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 6 Aug 2004 13:45:41 +0000 Subject: [PATCH 0009/5331] - add instructions to add users - nix-pull does not work yet svn path=/nixu/trunk/; revision=1241 --- INSTALL | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/INSTALL b/INSTALL index dfa2ef6bece..a7408dc89c9 100644 --- a/INSTALL +++ b/INSTALL @@ -48,6 +48,25 @@ seems to hang. Installing a 2.6 based UML with Nix is not trivial and is not advised. + Using the Nix UML + +By default, the Nix UML comes with very little configuration. Apart from the +networking information and mount information, there is nothing. One of the +first things to do is to add user and group information, otherwise a lot +of tools won't work. There are empty passwd, shadow and group files. Due +to some limitations in Nix it is only possible to modify the password file +as root. + +- add a root user: + +useradd root + +- edit /etc/passwd and change the UID to 0 ("vim" is provided) +- add a root group: + +groupadd root + + Adding packages to the UML Nix installation Packages can be added the the Nix UML installation by editing a few files. @@ -55,14 +74,13 @@ The first file packages should be added to is 'pkgs.nix'. The other files that should be edited all reside in the "boot" directory. In default.nix the packages should be added as an argument (first line) and given as an argument to the builder (line starting with "inherit"). In "builder.sh" -there is a giant sed expression which subsitutes all occurences of the -names of the packages in the files with the right value. If the programs -that are added need to be added to $PATH the file "env.sh" has to be -edited. - -Another option is to enable networking in the UML and use nix-pull to get -all the right packages. One thing you have to make sure is that the packages -you want to install are indeed defined in the nix files. +there is a sed expression which subsitutes all occurences of the names of +the packages in the files with the right value. If the programs that are +added need to be added to $PATH the file "env.sh" has to be edited and the +UML has to be recreated. + +Another option would be to enable networking in the UML and use nix-pull to +get all the right packages, however this does not work yet. Differences with a normal UML -- GitLab From 8c3de58259a59df042b3cc52d93f68681849bdcc Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 6 Aug 2004 13:50:42 +0000 Subject: [PATCH 0010/5331] add a directory, touch a few files svn path=/nixu/trunk/; revision=1242 --- fill-disk.sh | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 6dc0449f73e..89a5f992ade 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -11,6 +11,12 @@ make_dir() { chmod $mode $root/$name } + +touch_file() { + name=$1 + echo creating $name... + if ! test -d $root/$name; then touch $root/$name; fi +} root=/tmp/mnt echo mounting... @@ -20,6 +26,7 @@ make_dir 00755 /dev make_dir 00755 /proc make_dir 01777 /tmp make_dir 00755 /etc # global non-constant configuration +make_dir 00755 /etc-secret # global non-constant configuration make_dir 00755 /var make_dir 00755 /nix make_dir 00755 /nix/store @@ -33,30 +40,36 @@ make_dir 00755 /mnt/host make_dir 00755 /home make_dir 00755 /home/root +touch_file /etc/passwd +touch_file /etc/shadow +touch_file /etc/group + rm -f $root/etc/mtab ln -s /proc/mounts $root/etc/mtab export NIX_ROOT=$root +NIX_CMD_PATH=/usr/home/nix/.nix-profile/bin echo initialising Nix DB... -/nix/bin/nix-store --init +#/nix/bin/nix-store --init +$NIX_CMD_PATH/nix-store --init echo verifying Nix DB... -/nix/bin/nix-store --verify +$NIX_CMD_PATH/nix-store --verify echo registering valid paths... (while read storepath; do echo PATH $storepath - if ! /nix/bin/nix-store --isvalid $storepath 2> /dev/null; then - (unset NIX_ROOT; /nix/bin/nix-store --dump $storepath) | /nix/bin/nix-store --restore $storepath - /nix/bin/nix-store --validpath $storepath + if ! $NIX_CMD_PATH/nix-store --isvalid $storepath 2> /dev/null; then + (unset NIX_ROOT; $NIX_CMD_PATH/nix-store --dump $storepath) | $NIX_CMD_PATH/nix-store --restore $storepath + $NIX_CMD_PATH/nix-store --validpath $storepath fi done) < /tmp/storepaths echo registering successors... (while read line; do echo SUCC $line - /nix/bin/nix-store --successor $line + $NIX_CMD_PATH/nix-store --successor $line done) < /tmp/successors echo setting init symlink... -- GitLab From 85bbb5e447cc42e01f558bb9fe39c54471e11e23 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 6 Aug 2004 13:52:39 +0000 Subject: [PATCH 0011/5331] add a whole bunch of packages to make NixU a bit more useful: - ssh - shadowutils - ping - vim - less - strace - ... svn path=/nixu/trunk/; revision=1243 --- boot/builder.sh | 12 ++++++++++++ boot/default.nix | 6 ++++-- boot/env.sh | 2 +- make-disk.sh | 15 +++++++++------ pkgs.nix | 6 +++--- run.sh | 2 +- 6 files changed, 30 insertions(+), 13 deletions(-) diff --git a/boot/builder.sh b/boot/builder.sh index 8748d8875e5..63dbe39c081 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -16,6 +16,18 @@ for i in $boot $halt $login $env; do -e "s^@e2fsprogs\@^$e2fsprogs^g" \ -e "s^@nettools\@^$nettools^g" \ -e "s^@nix\@^$nix^g" \ + -e "s^@wget\@^$wget^g" \ + -e "s^@which\@^$which^g" \ + -e "s^@subversion\@^$subversion^g" \ + -e "s^@vim\@^$vim^g" \ + -e "s^@screen\@^$screen^g" \ + -e "s^@less\@^$less^g" \ + -e "s^@openssh\@^$openssh^g" \ + -e "s^@binutils\@^$binutils^g" \ + -e "s^@strace\@^$strace^g" \ + -e "s^@shadowutils\@^$shadowutils^g" \ + -e "s^@iputils\@^$iputils^g" \ + -e "s^@gnumake\@^$gnumake^g" \ -e "s^@out\@^$out^g" \ < $i > $dst chmod +x $dst diff --git a/boot/default.nix b/boot/default.nix index 6ecd30758b8..84507a004ac 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,5 +1,6 @@ { stdenv, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs -, nettools, nix}: +, nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh +, binutils, strace, shadowutils, iputils, gnumake}: derivation { name = "boot"; @@ -10,5 +11,6 @@ derivation { login = ./login.sh; env = ./env.sh; inherit stdenv bash coreutils findutils utillinux sysvinit - e2fsprogs nettools nix; + e2fsprogs nettools nix subversion gcc wget which vim less screen + openssh binutils strace shadowutils iputils gnumake; } diff --git a/boot/env.sh b/boot/env.sh index 75504da38b7..627305570f6 100644 --- a/boot/env.sh +++ b/boot/env.sh @@ -1 +1 @@ -export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin: +export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin diff --git a/make-disk.sh b/make-disk.sh index 00e3cb28de1..3e55795a480 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -17,21 +17,24 @@ if ! test -f $image; then fi # What to copy? -storeExpr=$(echo '(import ./pkgs.nix).everything' | nix-instantiate -) -nix-store -rB $storeExpr -nix-store -qn --requisites $storeExpr > $storePaths + +NIX_CMD_PATH=/nix/bin + +storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -) +$NIX_CMD_PATH/nix-store -rB $storeExpr +$NIX_CMD_PATH/nix-store -qn --requisites $storeExpr > $storePaths (while read storepath; do - nix-store -q --predecessors $storepath | (while read predecessor; do + $NIX_CMD_PATH/nix-store -q --predecessors $storepath | (while read predecessor; do echo $predecessor $storepath done) done) < $storePaths > $successors # Location of sysvinit? -sysvinitPath=$(nix-store -qn $(echo '(import ./pkgs.nix).sysvinit' | nix-instantiate -)) +sysvinitPath=$($NIX_CMD_PATH/nix-store -qn $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -)) # Location of Nix boot scripts? -bootPath=$(nix-store -qn $(echo '(import ./pkgs.nix).boot' | nix-instantiate -)) +bootPath=$($NIX_CMD_PATH/nix-store -qn $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -)) # Fill the disk with the minimal Nix store. if ! test -d /tmp/mnt; then mkdir /tmp/mnt; fi diff --git a/pkgs.nix b/pkgs.nix index 3b6fcb7646e..1ffa835f584 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,10 +1,10 @@ rec { - inherit (import pkgs/system/i686-linux.nix) + inherit (import /usr/home/nix/nixpkgs-0.6pre1121/pkgs/system/i686-linux.nix) stdenv bash coreutils findutils utillinux sysvinit e2fsprogs - nettools nix; + nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake; boot = (import ./boot) {inherit stdenv bash coreutils findutils - utillinux sysvinit e2fsprogs nettools nix;}; + utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake;}; everything = [boot sysvinit]; } diff --git a/run.sh b/run.sh index 9a51834e0d2..50728feca25 100755 --- a/run.sh +++ b/run.sh @@ -3,5 +3,5 @@ image=/tmp/disk.img linux ubd0="$image" mem=256M \ - eth0=tuntap,tap4,,192.168.150.1 \ + eth0=tuntap,tap1,,192.168.150.3 \ init="/init" -- GitLab From 9a9cc067442a6ae02e30816113548cb2f7ad4ffd Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 6 Aug 2004 14:07:57 +0000 Subject: [PATCH 0012/5331] workaround for nix-pull svn path=/nixu/trunk/; revision=1244 --- INSTALL | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/INSTALL b/INSTALL index a7408dc89c9..c7920b55e5e 100644 --- a/INSTALL +++ b/INSTALL @@ -80,11 +80,11 @@ added need to be added to $PATH the file "env.sh" has to be edited and the UML has to be recreated. Another option would be to enable networking in the UML and use nix-pull to -get all the right packages, however this does not work yet. +get all the right packages, however this does not work yet out of the box. +A small trick is to symlink /bin/sh to the current version of "sh": +# mkdir /bin +# cd /bin +# ln -s `which ssh` sh - Differences with a normal UML - -A lot of packages are still missing from the current UML. User management -is completely lacking, init scripts and system configuration (/etc) are -not there yet. +We're looking for a more permanent solution to fix this. -- GitLab From d40375a0bfc10ee2b26bb90742bf36cbb4fe00a8 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 6 Aug 2004 16:38:43 +0000 Subject: [PATCH 0013/5331] fix typo svn path=/nixu/trunk/; revision=1245 --- INSTALL | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/INSTALL b/INSTALL index c7920b55e5e..79098f8b07c 100644 --- a/INSTALL +++ b/INSTALL @@ -83,8 +83,7 @@ Another option would be to enable networking in the UML and use nix-pull to get all the right packages, however this does not work yet out of the box. A small trick is to symlink /bin/sh to the current version of "sh": -# mkdir /bin # cd /bin -# ln -s `which ssh` sh +# ln -s `which sh` sh We're looking for a more permanent solution to fix this. -- GitLab From 511b3fd83f636127bc45f3a7c6c8522b31669d45 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 6 Aug 2004 17:22:24 +0000 Subject: [PATCH 0014/5331] add more packages that are necessary for a complete build svn path=/nixu/trunk/; revision=1246 --- boot/builder.sh | 5 +++++ boot/default.nix | 6 ++++-- boot/env.sh | 2 +- fill-disk.sh | 5 +++-- make-disk.sh | 2 +- pkgs.nix | 7 +++++-- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/boot/builder.sh b/boot/builder.sh index 63dbe39c081..d09eaa11d58 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -28,6 +28,11 @@ for i in $boot $halt $login $env; do -e "s^@shadowutils\@^$shadowutils^g" \ -e "s^@iputils\@^$iputils^g" \ -e "s^@gnumake\@^$gnumake^g" \ + -e "s^@curl\@^$curl^g" \ + -e "s^@gnused\@^$gnused^g" \ + -e "s^@gnutar\@^$gnutar^g" \ + -e "s^@gnugrep\@^$gnugrep^g" \ + -e "s^@gzip\@^$gzip^g" \ -e "s^@out\@^$out^g" \ < $i > $dst chmod +x $dst diff --git a/boot/default.nix b/boot/default.nix index 84507a004ac..062fe2a4714 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,6 +1,7 @@ { stdenv, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh -, binutils, strace, shadowutils, iputils, gnumake}: +, binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep +, gnutar, gzip}: derivation { name = "boot"; @@ -12,5 +13,6 @@ derivation { env = ./env.sh; inherit stdenv bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen - openssh binutils strace shadowutils iputils gnumake; + openssh binutils strace shadowutils iputils gnumake curl gnused + gnutar gnugrep gzip; } diff --git a/boot/env.sh b/boot/env.sh index 627305570f6..33a6d1eb3ce 100644 --- a/boot/env.sh +++ b/boot/env.sh @@ -1 +1 @@ -export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin +export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin diff --git a/fill-disk.sh b/fill-disk.sh index 89a5f992ade..0873badcff8 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -14,7 +14,7 @@ make_dir() { touch_file() { name=$1 - echo creating $name... + echo touching $name... if ! test -d $root/$name; then touch $root/$name; fi } root=/tmp/mnt @@ -22,11 +22,12 @@ root=/tmp/mnt echo mounting... mount -t ext2 /dev/discs/disc0/disc $root +make_dir 00755 /bin make_dir 00755 /dev make_dir 00755 /proc make_dir 01777 /tmp make_dir 00755 /etc # global non-constant configuration -make_dir 00755 /etc-secret # global non-constant configuration +make_dir 00755 /etc-secret make_dir 00755 /var make_dir 00755 /nix make_dir 00755 /nix/store diff --git a/make-disk.sh b/make-disk.sh index 3e55795a480..87e761110cd 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -1,7 +1,7 @@ #! /bin/sh -e image=/tmp/disk.img -size=$(expr 256 \* 1024 \* 1024) +size=$(expr 2048 \* 1024 \* 1024) storePaths=/tmp/storepaths successors=/tmp/successors diff --git a/pkgs.nix b/pkgs.nix index 1ffa835f584..cb80054bca3 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,10 +1,13 @@ rec { inherit (import /usr/home/nix/nixpkgs-0.6pre1121/pkgs/system/i686-linux.nix) stdenv bash coreutils findutils utillinux sysvinit e2fsprogs - nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake; + nettools nix subversion gcc wget which vim less screen openssh binutils + strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip; boot = (import ./boot) {inherit stdenv bash coreutils findutils - utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake;}; + utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim + less screen openssh binutils strace shadowutils iputils gnumake curl + gnused gnutar gnugrep gzip;}; everything = [boot sysvinit]; } -- GitLab From f763a7c40ade67009759562e79fbb0c9050b4431 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 9 Nov 2004 10:28:21 +0000 Subject: [PATCH 0015/5331] change to new packages, with new nix, new bash, new everything! It's shiny and new! svn path=/nixu/trunk/; revision=1730 --- fill-disk.sh | 8 +++++--- make-disk.sh | 4 ++-- pkgs.nix | 2 +- run.sh | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 0873badcff8..969dfea25bf 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -49,7 +49,9 @@ rm -f $root/etc/mtab ln -s /proc/mounts $root/etc/mtab export NIX_ROOT=$root -NIX_CMD_PATH=/usr/home/nix/.nix-profile/bin +#NIX_CMD_PATH=/usr/home/nix/.nix-profile/bin +#NIX_CMD_PATH=/home/armijn/.nix-profile/bin +NIX_CMD_PATH=/nix/bin echo initialising Nix DB... #/nix/bin/nix-store --init @@ -65,13 +67,13 @@ echo registering valid paths... (unset NIX_ROOT; $NIX_CMD_PATH/nix-store --dump $storepath) | $NIX_CMD_PATH/nix-store --restore $storepath $NIX_CMD_PATH/nix-store --validpath $storepath fi -done) < /tmp/storepaths +done) < /tmp/mystorepaths echo registering successors... (while read line; do echo SUCC $line $NIX_CMD_PATH/nix-store --successor $line -done) < /tmp/successors +done) < /tmp/mysuccessors echo setting init symlink... rm -f $root/init diff --git a/make-disk.sh b/make-disk.sh index 87e761110cd..9ea97636bbd 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -2,8 +2,8 @@ image=/tmp/disk.img size=$(expr 2048 \* 1024 \* 1024) -storePaths=/tmp/storepaths -successors=/tmp/successors +storePaths=/tmp/mystorepaths +successors=/tmp/mysuccessors if ! test -f $image; then diff --git a/pkgs.nix b/pkgs.nix index cb80054bca3..5660e111f37 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,5 +1,5 @@ rec { - inherit (import /usr/home/nix/nixpkgs-0.6pre1121/pkgs/system/i686-linux.nix) + inherit (import /home/armijn/pkgs/system/i686-linux.nix) stdenv bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip; diff --git a/run.sh b/run.sh index 50728feca25..e6ec1e005e2 100755 --- a/run.sh +++ b/run.sh @@ -3,5 +3,5 @@ image=/tmp/disk.img linux ubd0="$image" mem=256M \ - eth0=tuntap,tap1,,192.168.150.3 \ + eth0=tuntap,tap1 \ init="/init" -- GitLab From c29ea5dd01c2a66c252423b26d4774b40a935fad Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 7 Dec 2004 17:38:55 +0000 Subject: [PATCH 0016/5331] add gcc to the default PATH in nixu svn path=/nixu/trunk/; revision=1840 --- boot/builder.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/boot/builder.sh b/boot/builder.sh index d09eaa11d58..6adf93e99ee 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -33,6 +33,7 @@ for i in $boot $halt $login $env; do -e "s^@gnutar\@^$gnutar^g" \ -e "s^@gnugrep\@^$gnugrep^g" \ -e "s^@gzip\@^$gzip^g" \ + -e "s^@gcc\@^$gcc^g" \ -e "s^@out\@^$out^g" \ < $i > $dst chmod +x $dst -- GitLab From 1e607c92215a1a66fb5b665314dd4d3a6d8a06fb Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 5 Jul 2005 13:52:49 +0000 Subject: [PATCH 0017/5331] rewrite nixu scripts to use nix-push. Install the whole NixU environment in two main steps: 1 - first build everything (nix-push) 2 - install everything on a seperate disk/machine (nix-pull) svn path=/nixu/trunk/; revision=3291 --- boot/builder.sh | 1 + boot/default.nix | 8 ++++---- boot/env.sh | 2 +- make-disk.sh | 40 +++++++--------------------------------- pkgs.nix | 10 +++++----- 5 files changed, 18 insertions(+), 43 deletions(-) diff --git a/boot/builder.sh b/boot/builder.sh index 6adf93e99ee..e86d2d41668 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -34,6 +34,7 @@ for i in $boot $halt $login $env; do -e "s^@gnugrep\@^$gnugrep^g" \ -e "s^@gzip\@^$gzip^g" \ -e "s^@gcc\@^$gcc^g" \ + -e "s^@mingetty\@^$mingetty^g" \ -e "s^@out\@^$out^g" \ < $i > $dst chmod +x $dst diff --git a/boot/default.nix b/boot/default.nix index 062fe2a4714..76125381301 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,7 +1,7 @@ -{ stdenv, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs +{ stdenv, kernel, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep -, gnutar, gzip}: +, gnutar, gzip, mingetty}: derivation { name = "boot"; @@ -11,8 +11,8 @@ derivation { halt = ./halt.sh; login = ./login.sh; env = ./env.sh; - inherit stdenv bash coreutils findutils utillinux sysvinit + inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused - gnutar gnugrep gzip; + gnutar gnugrep gzip mingetty; } diff --git a/boot/env.sh b/boot/env.sh index 33a6d1eb3ce..322a2cd2216 100644 --- a/boot/env.sh +++ b/boot/env.sh @@ -1 +1 @@ -export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin +export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingetty@/sbin diff --git a/make-disk.sh b/make-disk.sh index 9ea97636bbd..fc8b075d152 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -1,42 +1,16 @@ #! /bin/sh -e -image=/tmp/disk.img -size=$(expr 2048 \* 1024 \* 1024) -storePaths=/tmp/mystorepaths -successors=/tmp/mysuccessors - -if ! test -f $image; then - - echo creating empty disk of $size bytes in $image... - # Note: this is a sparse file. - dd if=/dev/zero of=$image bs=1 seek=$(expr $size - 1) count=1 - - echo creating disk image in $image... - /sbin/mke2fs -F $image - -fi - -# What to copy? +archivesDir=/tmp/arch +manifest=${archivesDir}/MANIFEST NIX_CMD_PATH=/nix/bin -storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -) -$NIX_CMD_PATH/nix-store -rB $storeExpr -$NIX_CMD_PATH/nix-store -qn --requisites $storeExpr > $storePaths - -(while read storepath; do - $NIX_CMD_PATH/nix-store -q --predecessors $storepath | (while read predecessor; do - echo $predecessor $storepath - done) -done) < $storePaths > $successors +storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) +$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) +$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) # Location of sysvinit? -sysvinitPath=$($NIX_CMD_PATH/nix-store -qn $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -)) +#sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -)) # Location of Nix boot scripts? -bootPath=$($NIX_CMD_PATH/nix-store -qn $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -)) - -# Fill the disk with the minimal Nix store. -if ! test -d /tmp/mnt; then mkdir /tmp/mnt; fi -linux ubd0=$image root=/dev/root rootflags=/ rootfstype=hostfs \ - init="$(pwd)/fill-disk.sh $sysvinitPath $bootPath" +#bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -)) diff --git a/pkgs.nix b/pkgs.nix index 5660e111f37..9a3aa3c2c88 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,13 +1,13 @@ rec { - inherit (import /home/armijn/pkgs/system/i686-linux.nix) - stdenv bash coreutils findutils utillinux sysvinit e2fsprogs + inherit (import /nixpkgs/trunk/pkgs/system/i686-linux.nix) + stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils - strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip; + strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingetty; - boot = (import ./boot) {inherit stdenv bash coreutils findutils + boot = (import ./boot) {inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl - gnused gnutar gnugrep gzip;}; + gnused gnutar gnugrep gzip mingetty;}; everything = [boot sysvinit]; } -- GitLab From b31d4e8079802b9ec07ff97955b483ec215f3afe Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 5 Jul 2005 14:39:12 +0000 Subject: [PATCH 0018/5331] copy nixpkgs, so it reflects what was built. This code uses a simple "cp -a" so there is a race condition (nixpkgs being altered after the build). However, with a bit of care and "policy" this should work ;-) Also push all packages we want to push at once. svn path=/nixu/trunk/; revision=3292 --- make-disk.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index fc8b075d152..44564a58362 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -2,15 +2,18 @@ archivesDir=/tmp/arch manifest=${archivesDir}/MANIFEST +nixpkgs=/nixpkgs/trunk/pkgs NIX_CMD_PATH=/nix/bin storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) -$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) -$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) +$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) +#$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) # Location of sysvinit? #sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -)) # Location of Nix boot scripts? #bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -)) + +cp -a ${nixpkgs} ${archivesDir} -- GitLab From 1054efb792d6574e902dcabdf34391b4681485a9 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 6 Jul 2005 14:42:41 +0000 Subject: [PATCH 0019/5331] apart from nixpkgs also copy the NixU scripts svn path=/nixu/trunk/; revision=3298 --- make-disk.sh | 8 ++++++-- pkgs.nix | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index 44564a58362..00fb5d205ba 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -2,7 +2,9 @@ archivesDir=/tmp/arch manifest=${archivesDir}/MANIFEST -nixpkgs=/nixpkgs/trunk/pkgs +nixpkgs=/nixpkgs2/trunk/pkgs + +rm -rf ${archivesDir}/* NIX_CMD_PATH=/nix/bin @@ -16,4 +18,6 @@ $NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) # Location of Nix boot scripts? #bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -)) -cp -a ${nixpkgs} ${archivesDir} +cp -fa ${nixpkgs} ${archivesDir} +mkdir ${archivesDir}/scripts +cp -fa * ${archivesDir}/scripts diff --git a/pkgs.nix b/pkgs.nix index 9a3aa3c2c88..eb55e1a772c 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,5 +1,5 @@ rec { - inherit (import /nixpkgs/trunk/pkgs/system/i686-linux.nix) + inherit (import /nixpkgs2/trunk/pkgs/system/i686-linux.nix) stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingetty; -- GitLab From 9380bf77d880d8e345dd70f63048e237e6755e35 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 6 Jul 2005 16:00:20 +0000 Subject: [PATCH 0020/5331] rewrite make-disk.sh and have it parameterize fill-disk.sh with the location of sysvinit and the boot scripts that will be used. svn path=/nixu/trunk/; revision=3299 --- fill-disk.sh | 43 ++++++++++++++++--------------------------- make-disk.sh | 12 +++++++++--- 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 969dfea25bf..3839119efbf 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,7 +1,7 @@ #! /bin/sh -e -sysvinitPath=$1 -bootPath=$2 +sysvinitPath=@sysvinitPath@ +bootPath=@bootPath@ make_dir() { mode=$1 @@ -49,8 +49,6 @@ rm -f $root/etc/mtab ln -s /proc/mounts $root/etc/mtab export NIX_ROOT=$root -#NIX_CMD_PATH=/usr/home/nix/.nix-profile/bin -#NIX_CMD_PATH=/home/armijn/.nix-profile/bin NIX_CMD_PATH=/nix/bin echo initialising Nix DB... @@ -60,20 +58,20 @@ $NIX_CMD_PATH/nix-store --init echo verifying Nix DB... $NIX_CMD_PATH/nix-store --verify -echo registering valid paths... -(while read storepath; do - echo PATH $storepath - if ! $NIX_CMD_PATH/nix-store --isvalid $storepath 2> /dev/null; then - (unset NIX_ROOT; $NIX_CMD_PATH/nix-store --dump $storepath) | $NIX_CMD_PATH/nix-store --restore $storepath - $NIX_CMD_PATH/nix-store --validpath $storepath - fi -done) < /tmp/mystorepaths - -echo registering successors... -(while read line; do - echo SUCC $line - $NIX_CMD_PATH/nix-store --successor $line -done) < /tmp/mysuccessors +#echo registering valid paths... +#(while read storepath; do +# echo PATH $storepath +# if ! $NIX_CMD_PATH/nix-store --isvalid $storepath 2> /dev/null; then +# (unset NIX_ROOT; $NIX_CMD_PATH/nix-store --dump $storepath) | $NIX_CMD_PATH/nix-store --restore $storepath +# $NIX_CMD_PATH/nix-store --validpath $storepath +# fi +#done) < /tmp/mystorepaths + +#echo registering successors... +#(while read line; do +# echo SUCC $line +# $NIX_CMD_PATH/nix-store --successor $line +#done) < /tmp/mysuccessors echo setting init symlink... rm -f $root/init @@ -95,12 +93,3 @@ cp /etc/resolv.conf $root/etc rm -f $root/etc/hosts echo "127.0.0.1 localhost" >> $root/etc/hosts echo "192.168.150.1 uml" >> $root/etc/hosts - -echo unmounting... -umount $root - -echo syncing... -sync - -echo halting... -/sbin/halt -d -f diff --git a/make-disk.sh b/make-disk.sh index 00fb5d205ba..09017bcaa7c 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -3,6 +3,7 @@ archivesDir=/tmp/arch manifest=${archivesDir}/MANIFEST nixpkgs=/nixpkgs2/trunk/pkgs +fill_disk=$archivesDir/scripts/fill-disk.sh rm -rf ${archivesDir}/* @@ -10,14 +11,19 @@ NIX_CMD_PATH=/nix/bin storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) $NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) -#$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) # Location of sysvinit? -#sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -)) +sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -)) # Location of Nix boot scripts? -#bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -)) +bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -)) + +echo "bootPath: ${bootPath}" cp -fa ${nixpkgs} ${archivesDir} mkdir ${archivesDir}/scripts cp -fa * ${archivesDir}/scripts +sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ + -e "s^@bootPath\@^$bootPath^g" \ + < $fill_disk > $fill_disk.tmp +mv $fill_disk.tmp $fill_disk -- GitLab From 59456f93669ef50767bd258a3b32fada892252e6 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 8 Jul 2005 10:06:41 +0000 Subject: [PATCH 0021/5331] run the Nix scripts for installing everything from the Nix built Nix. svn path=/nixu/trunk/; revision=3303 --- fill-disk.sh | 5 +---- make-disk.sh | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 3839119efbf..180676dd055 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -19,9 +19,6 @@ touch_file() { } root=/tmp/mnt -echo mounting... -mount -t ext2 /dev/discs/disc0/disc $root - make_dir 00755 /bin make_dir 00755 /dev make_dir 00755 /proc @@ -49,7 +46,7 @@ rm -f $root/etc/mtab ln -s /proc/mounts $root/etc/mtab export NIX_ROOT=$root -NIX_CMD_PATH=/nix/bin +NIX_CMD_PATH=@NIX_CMD_PATH@/bin echo initialising Nix DB... #/nix/bin/nix-store --init diff --git a/make-disk.sh b/make-disk.sh index 09017bcaa7c..6c3843bb56e 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -18,12 +18,15 @@ sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' # Location of Nix boot scripts? bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -)) -echo "bootPath: ${bootPath}" +#echo "bootPath: ${bootPath}" + +nix=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) cp -fa ${nixpkgs} ${archivesDir} mkdir ${archivesDir}/scripts cp -fa * ${archivesDir}/scripts sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@bootPath\@^$bootPath^g" \ + -e "s^@NIX_CMD_PATH\@^$nix^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk -- GitLab From 5432cd148be8b69a3643404553d50c3a713b81d8 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 11 Jul 2005 17:59:19 +0000 Subject: [PATCH 0022/5331] copy the right packages into the diskimage, copy nixpkgs svn path=/nixu/trunk/; revision=3313 --- fill-disk.sh | 7 +++++++ make-disk.sh | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 180676dd055..3bd450e3cb5 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -33,6 +33,7 @@ make_dir 00755 /nix/var/nix make_dir 00755 /nix/var/nix/db make_dir 00755 /nix/var/log make_dir 00755 /nix/var/log/nix +make_dir 00755 /nixpkgs make_dir 00755 /mnt make_dir 00755 /mnt/host make_dir 00755 /home @@ -55,6 +56,12 @@ $NIX_CMD_PATH/nix-store --init echo verifying Nix DB... $NIX_CMD_PATH/nix-store --verify +echo copying nixpkgs... +cp -fa ../pkgs $root/nixpkgs + +echo adding packages... +$NIX_CMD_PATH/nix-pull file:///$(manifest) + #echo registering valid paths... #(while read storepath; do # echo PATH $storepath diff --git a/make-disk.sh b/make-disk.sh index 6c3843bb56e..7a0b04f23f3 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -5,6 +5,7 @@ manifest=${archivesDir}/MANIFEST nixpkgs=/nixpkgs2/trunk/pkgs fill_disk=$archivesDir/scripts/fill-disk.sh +chmod -R +w ${archivesDir}/* rm -rf ${archivesDir}/* NIX_CMD_PATH=/nix/bin @@ -18,11 +19,16 @@ sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' # Location of Nix boot scripts? bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -)) -#echo "bootPath: ${bootPath}" - nix=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) +#nixDeps=$($NIX_CMD_PATH/nix-store -qR $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) + +nixDeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) + +echo $nixDeps + cp -fa ${nixpkgs} ${archivesDir} +cp -fa --parents ${nixDeps} ${archivesDir} mkdir ${archivesDir}/scripts cp -fa * ${archivesDir}/scripts sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -- GitLab From c05605e316f0293852dde3df6e652caed989a302 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 14 Jul 2005 16:57:39 +0000 Subject: [PATCH 0023/5331] disable NIX_ROOT, use things like NIX_STATE_DIR instead svn path=/nixu/trunk/; revision=3338 --- fill-disk.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 3bd450e3cb5..2bb88f33142 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -3,6 +3,14 @@ sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ +if ! test -n "$1" +then + echo "need URL for manifest!" + exit +else + manifest=$1 +fi + make_dir() { mode=$1 name=$2 @@ -31,6 +39,7 @@ make_dir 00755 /nix/store make_dir 00755 /nix/var make_dir 00755 /nix/var/nix make_dir 00755 /nix/var/nix/db +make_dir 00755 /nix/var/nix/manifests make_dir 00755 /nix/var/log make_dir 00755 /nix/var/log/nix make_dir 00755 /nixpkgs @@ -44,9 +53,10 @@ touch_file /etc/shadow touch_file /etc/group rm -f $root/etc/mtab -ln -s /proc/mounts $root/etc/mtab +#ln -s /proc/mounts $root/etc/mtab -export NIX_ROOT=$root +#export NIX_ROOT=$root +export NIX_STATE_DIR=$root/nix/var/nix NIX_CMD_PATH=@NIX_CMD_PATH@/bin echo initialising Nix DB... @@ -60,7 +70,7 @@ echo copying nixpkgs... cp -fa ../pkgs $root/nixpkgs echo adding packages... -$NIX_CMD_PATH/nix-pull file:///$(manifest) +$NIX_CMD_PATH/nix-pull $manifest #echo registering valid paths... #(while read storepath; do -- GitLab From 8122aebd1908bd03ac059f1f89cbc65bac4c3d99 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 18 Jul 2005 09:47:42 +0000 Subject: [PATCH 0024/5331] add grub svn path=/nixu/trunk/; revision=3353 --- boot/builder.sh | 1 + boot/default.nix | 4 ++-- boot/env.sh | 2 +- make-disk.sh | 2 +- pkgs.nix | 5 +++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/boot/builder.sh b/boot/builder.sh index e86d2d41668..5ebfadcbcf7 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -35,6 +35,7 @@ for i in $boot $halt $login $env; do -e "s^@gzip\@^$gzip^g" \ -e "s^@gcc\@^$gcc^g" \ -e "s^@mingetty\@^$mingetty^g" \ + -e "s^@grub\@^$grub^g" \ -e "s^@out\@^$out^g" \ < $i > $dst chmod +x $dst diff --git a/boot/default.nix b/boot/default.nix index 76125381301..5320404b733 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,7 +1,7 @@ { stdenv, kernel, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep -, gnutar, gzip, mingetty}: +, gnutar, gzip, mingetty, grub}: derivation { name = "boot"; @@ -14,5 +14,5 @@ derivation { inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused - gnutar gnugrep gzip mingetty; + gnutar gnugrep gzip mingetty grub; } diff --git a/boot/env.sh b/boot/env.sh index 322a2cd2216..6ec13130b66 100644 --- a/boot/env.sh +++ b/boot/env.sh @@ -1 +1 @@ -export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingetty@/sbin +export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingetty@/sbin:@grub@/bin:@grub@/sbin diff --git a/make-disk.sh b/make-disk.sh index 7a0b04f23f3..2548f0e7788 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -5,7 +5,7 @@ manifest=${archivesDir}/MANIFEST nixpkgs=/nixpkgs2/trunk/pkgs fill_disk=$archivesDir/scripts/fill-disk.sh -chmod -R +w ${archivesDir}/* +chmod -f -R +w ${archivesDir}/* rm -rf ${archivesDir}/* NIX_CMD_PATH=/nix/bin diff --git a/pkgs.nix b/pkgs.nix index eb55e1a772c..42fbfef6476 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -2,12 +2,13 @@ rec { inherit (import /nixpkgs2/trunk/pkgs/system/i686-linux.nix) stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils - strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingetty; + strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip + mingetty grub; boot = (import ./boot) {inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl - gnused gnutar gnugrep gzip mingetty;}; + gnused gnutar gnugrep gzip mingetty grub;}; everything = [boot sysvinit]; } -- GitLab From 5c6d52dbd86b8ee9bad8a628aa2b5bc281b2969c Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 19 Jul 2005 15:39:32 +0000 Subject: [PATCH 0025/5331] - add more directories - make /dev/null inside a chroot to install svn path=/nixu/trunk/; revision=3366 --- fill-disk.sh | 24 +++++++++++++++++++++--- make-disk.sh | 3 ++- pkgs.nix | 2 +- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 2bb88f33142..57459727b9b 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -43,11 +43,14 @@ make_dir 00755 /nix/var/nix/manifests make_dir 00755 /nix/var/log make_dir 00755 /nix/var/log/nix make_dir 00755 /nixpkgs +make_dir 00755 /nixpkgs/trunk make_dir 00755 /mnt make_dir 00755 /mnt/host make_dir 00755 /home make_dir 00755 /home/root +mknod $root/dev/null c 1 3 + touch_file /etc/passwd touch_file /etc/shadow touch_file /etc/group @@ -55,8 +58,10 @@ touch_file /etc/group rm -f $root/etc/mtab #ln -s /proc/mounts $root/etc/mtab -#export NIX_ROOT=$root +export NIX_DATA_DIR=$root/nix/share +export NIX_LOG_DIR=$root/nix/log/nix export NIX_STATE_DIR=$root/nix/var/nix +export NIX_CONF_DIR=$root/nix/etc NIX_CMD_PATH=@NIX_CMD_PATH@/bin echo initialising Nix DB... @@ -67,11 +72,24 @@ echo verifying Nix DB... $NIX_CMD_PATH/nix-store --verify echo copying nixpkgs... -cp -fa ../pkgs $root/nixpkgs +cp -fa ../pkgs $root/nixpkgs/trunk + +make_dir 0755 /tmp/scripts +cp -fa ../scripts $/tmp/scripts -echo adding packages... +echo adding manifest $NIX_CMD_PATH/nix-pull $manifest +echo adding packages +export NIX_ROOT=$root +unset NIX_DATA_DIR +unset NIX_LOG_DIR +unset NIX_STATE_DIR +unset NIX_CONF_DIR + +storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) +$NIX_CMD_PATH/nix-store -r $storeExpr + #echo registering valid paths... #(while read storepath; do # echo PATH $storepath diff --git a/make-disk.sh b/make-disk.sh index 2548f0e7788..71aa7939495 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -11,7 +11,8 @@ rm -rf ${archivesDir}/* NIX_CMD_PATH=/nix/bin storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) -$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) +#$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) +$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $storeExpr $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) # Location of sysvinit? sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -)) diff --git a/pkgs.nix b/pkgs.nix index 42fbfef6476..c74ec7589a5 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,5 +1,5 @@ rec { - inherit (import /nixpkgs2/trunk/pkgs/system/i686-linux.nix) + inherit (import /nixpkgs/trunk/pkgs/system/i686-linux.nix) stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip -- GitLab From 200251da1a131ee18576cedeacfb845fa5e94af6 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 19 Jul 2005 16:00:34 +0000 Subject: [PATCH 0026/5331] fix tpyos svn path=/nixu/trunk/; revision=3367 --- fill-disk.sh | 2 +- make-disk.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 57459727b9b..1e3a4e2938c 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -75,7 +75,7 @@ echo copying nixpkgs... cp -fa ../pkgs $root/nixpkgs/trunk make_dir 0755 /tmp/scripts -cp -fa ../scripts $/tmp/scripts +cp -fa ../scripts $root/tmp/scripts echo adding manifest $NIX_CMD_PATH/nix-pull $manifest diff --git a/make-disk.sh b/make-disk.sh index 71aa7939495..1f6d177d2f1 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -11,8 +11,8 @@ rm -rf ${archivesDir}/* NIX_CMD_PATH=/nix/bin storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) -#$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) -$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $storeExpr $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) +$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) +#$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $storeExpr $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) # Location of sysvinit? sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -)) -- GitLab From 62882b6d0a788e63b6122f37e7659f554f193baf Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 19 Jul 2005 16:02:17 +0000 Subject: [PATCH 0027/5331] use right path svn path=/nixu/trunk/; revision=3368 --- fill-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fill-disk.sh b/fill-disk.sh index 1e3a4e2938c..99bc0ac0486 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -75,7 +75,7 @@ echo copying nixpkgs... cp -fa ../pkgs $root/nixpkgs/trunk make_dir 0755 /tmp/scripts -cp -fa ../scripts $root/tmp/scripts +cp -fa ../scripts $root/tmp echo adding manifest $NIX_CMD_PATH/nix-pull $manifest -- GitLab From 001302e0f8de18c1967aff4a38c0600aee4f928d Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 19 Jul 2005 16:55:44 +0000 Subject: [PATCH 0028/5331] touch something to keep chmod happy svn path=/nixu/trunk/; revision=3370 --- make-disk.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/make-disk.sh b/make-disk.sh index 1f6d177d2f1..7427fd77c9a 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -2,9 +2,10 @@ archivesDir=/tmp/arch manifest=${archivesDir}/MANIFEST -nixpkgs=/nixpkgs2/trunk/pkgs +nixpkgs=/nixpkgs/trunk/pkgs fill_disk=$archivesDir/scripts/fill-disk.sh +touch ${archivesDir}/blah chmod -f -R +w ${archivesDir}/* rm -rf ${archivesDir}/* -- GitLab From 7bbee5b669449fb9bfb6091ab1ed0016c4e40eb6 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 29 Jul 2005 14:47:24 +0000 Subject: [PATCH 0029/5331] some docs svn path=/nixu/trunk/; revision=3467 --- storepaths_format | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 storepaths_format diff --git a/storepaths_format b/storepaths_format new file mode 100644 index 00000000000..8d789e8592b --- /dev/null +++ b/storepaths_format @@ -0,0 +1,8 @@ +/nix/store/abcd- +2 +/nix/store/1234- +/nix/store/5678- + +Amount of dependencies determined by: + +nix-store -q --references p -- GitLab From d623c357b56e5bb96593387de68073b5fecd9d36 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 29 Jul 2005 14:52:54 +0000 Subject: [PATCH 0030/5331] bit more doc (to make braaaaaain failure recovery easier) svn path=/nixu/trunk/; revision=3468 --- storepaths_format | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/storepaths_format b/storepaths_format index 8d789e8592b..dbb20caa111 100644 --- a/storepaths_format +++ b/storepaths_format @@ -6,3 +6,7 @@ Amount of dependencies determined by: nix-store -q --references p + +or better (for a large expression) + +nix-store -q --requisites p -- GitLab From 8f7215a7792edec0f8da730d69ae6401f13299ba Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 29 Jul 2005 16:54:36 +0000 Subject: [PATCH 0031/5331] various improvements + stubs for later work, definitely not production ready svn path=/nixu/trunk/; revision=3473 --- fill-disk.sh | 38 ++++++++++++++++++++++++++++++++------ make-disk.sh | 33 ++++++++++++++++++++++++++++----- 2 files changed, 60 insertions(+), 11 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 99bc0ac0486..5dfb264884c 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -5,10 +5,10 @@ bootPath=@bootPath@ if ! test -n "$1" then - echo "need URL for manifest!" + echo "need harddisk device for installing!" exit else - manifest=$1 + device=$1 fi make_dir() { @@ -27,6 +27,17 @@ touch_file() { } root=/tmp/mnt +mkdir -p /tmp/mnt + +mount $device /tmp/mnt + +mkdir -p /nix +mkdir -p /nixpkgs/trunk/pkgs + +# temporary hack +mount --bind /mnt/cdrom1/nix /nix +mount --bind /mnt/cdrom1/pkgs /nixpkgs/trunk/pkgs + make_dir 00755 /bin make_dir 00755 /dev make_dir 00755 /proc @@ -77,8 +88,8 @@ cp -fa ../pkgs $root/nixpkgs/trunk make_dir 0755 /tmp/scripts cp -fa ../scripts $root/tmp -echo adding manifest -$NIX_CMD_PATH/nix-pull $manifest +#echo adding manifest +#$NIX_CMD_PATH/nix-pull $manifest echo adding packages export NIX_ROOT=$root @@ -87,8 +98,21 @@ unset NIX_LOG_DIR unset NIX_STATE_DIR unset NIX_CONF_DIR -storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) -$NIX_CMD_PATH/nix-store -r $storeExpr +#storeExpr=$(echo '(import /tmp/scripts/pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) +#storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) +#$NIX_CMD_PATH/nix-store -r $storeExpr +#echo $storeExpr +#storeExpr2=$($NIX_CMD_PATH/nix-store -qR $($NIX_CMD_PATH/nix-store -r $storeExpr)) +#echo storeExpr $storeExpr +#echo $($NIX_CMD_PATH/nix-store -qR --include-outputs $storeExpr) + +echo copying store + +(while read storepaths; do + cp -fa $storepaths $root/nix/store +done) < /mnt/cdrom1/mystorepaths + +#cp -fa ../nix/store/* $root/nix/store #echo registering valid paths... #(while read storepath; do @@ -105,6 +129,8 @@ $NIX_CMD_PATH/nix-store -r $storeExpr # $NIX_CMD_PATH/nix-store --successor $line #done) < /tmp/mysuccessors +exit + echo setting init symlink... rm -f $root/init ln -s $sysvinitPath/sbin/init $root/init diff --git a/make-disk.sh b/make-disk.sh index 7427fd77c9a..a229616b8ff 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -1,9 +1,13 @@ #! /bin/sh -e +declare -a deps + archivesDir=/tmp/arch manifest=${archivesDir}/MANIFEST nixpkgs=/nixpkgs/trunk/pkgs fill_disk=$archivesDir/scripts/fill-disk.sh +storePaths=$archivesDir/mystorepaths +validatePaths=$archivesDir/validatepaths touch ${archivesDir}/blah chmod -f -R +w ${archivesDir}/* @@ -12,8 +16,7 @@ rm -rf ${archivesDir}/* NIX_CMD_PATH=/nix/bin storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) -$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) -#$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $storeExpr $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) +#$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) # Location of sysvinit? sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -)) @@ -25,12 +28,32 @@ nix=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PAT #nixDeps=$($NIX_CMD_PATH/nix-store -qR $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) -nixDeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) +#nixDeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) +echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) >> $storePaths + +#echo $nixDeps > $storePaths + +utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))) + +(while read storepath; do + cp -fa --parents ${storepath} ${archivesDir} +done) < $storePaths + +echo utillinux $utilLinux -echo $nixDeps +for i in $utilLinux; do + echo i $i + deps=( $($NIX_CMD_PATH/nix-store -q --references $i) ) + echo length ${#deps[@]} + if test "${#deps[@]}" = 0 + then + echo zarro + fi +done cp -fa ${nixpkgs} ${archivesDir} -cp -fa --parents ${nixDeps} ${archivesDir} +#cp -fa --parents ${nixDeps} ${archivesDir} +cp -fau --parents ${utilLinux} ${archivesDir} mkdir ${archivesDir}/scripts cp -fa * ${archivesDir}/scripts sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -- GitLab From cc0935ebe8ba2cf7b4395faad739a17cfdaab91a Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 31 Jul 2005 13:11:44 +0000 Subject: [PATCH 0032/5331] - added some more comments, generate ISO file - added stubs for making a bootable CD with isolinux. Still missing are kernel, boot configuration and more svn path=/nixu/trunk/; revision=3480 --- make-disk.sh | 20 ++++++++++++++++++++ pkgs.nix | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/make-disk.sh b/make-disk.sh index a229616b8ff..9d3f1124117 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -26,6 +26,8 @@ bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_C nix=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) +syslinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).syslinux' | $NIX_CMD_PATH/nix-instantiate -)) + #nixDeps=$($NIX_CMD_PATH/nix-store -qR $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) #nixDeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) @@ -51,9 +53,17 @@ for i in $utilLinux; do fi done +echo copying nixpkgs + cp -fa ${nixpkgs} ${archivesDir} + +echo copying packges from store + #cp -fa --parents ${nixDeps} ${archivesDir} cp -fau --parents ${utilLinux} ${archivesDir} + +echo copying scripts + mkdir ${archivesDir}/scripts cp -fa * ${archivesDir}/scripts sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ @@ -61,3 +71,13 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@NIX_CMD_PATH\@^$nix^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk + +echo copying bootimage + +mkdir ${archivesDir}/isolinux +cp ${syslinux}/lib/syslinux/isolinux.bin ${archivesDir}/isolinux +chmod u+w ${archivesDir}/isolinux/* +mkisofs -rJ -o /tmp/nix-pull.iso -b isolinux/isolinux.bin -c isolinux/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table \ + ${archivesDir} + diff --git a/pkgs.nix b/pkgs.nix index c74ec7589a5..5ec423bbdb1 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -3,7 +3,7 @@ rec { stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip - mingetty grub; + mingetty grub syslinux; boot = (import ./boot) {inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim -- GitLab From ec898a881eb9a3f33f5fc2c5f9098dd8863d5dfa Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 31 Jul 2005 15:25:39 +0000 Subject: [PATCH 0033/5331] build kernel and copy it to the diskimage. Now all there is left is an initial ramdisk. svn path=/nixu/trunk/; revision=3481 --- make-disk.sh | 20 ++++++++++++++++++-- pkgs.nix | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index 9d3f1124117..4ef319bcb08 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -1,5 +1,6 @@ #! /bin/sh -e +# deps is an array declare -a deps archivesDir=/tmp/arch @@ -8,7 +9,9 @@ nixpkgs=/nixpkgs/trunk/pkgs fill_disk=$archivesDir/scripts/fill-disk.sh storePaths=$archivesDir/mystorepaths validatePaths=$archivesDir/validatepaths +bootiso=/tmp/nixos.iso +# keep chmod happy touch ${archivesDir}/blah chmod -f -R +w ${archivesDir}/* rm -rf ${archivesDir}/* @@ -28,6 +31,8 @@ nix=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PAT syslinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).syslinux' | $NIX_CMD_PATH/nix-instantiate -)) +kernel=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) + #nixDeps=$($NIX_CMD_PATH/nix-store -qR $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) #nixDeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) @@ -77,7 +82,18 @@ echo copying bootimage mkdir ${archivesDir}/isolinux cp ${syslinux}/lib/syslinux/isolinux.bin ${archivesDir}/isolinux chmod u+w ${archivesDir}/isolinux/* -mkisofs -rJ -o /tmp/nix-pull.iso -b isolinux/isolinux.bin -c isolinux/boot.cat \ + +echo copying kernel + +# By following the symlink we don't have to know the version number +# of the kernel here. +cp -L $kernel/vmlinuz ${archivesDir}/isolinux/linux + +# echo making ramdisk +# todo! + +echo creating ISO image + +mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin -c isolinux/boot.cat \ -no-emul-boot -boot-load-size 4 -boot-info-table \ ${archivesDir} - diff --git a/pkgs.nix b/pkgs.nix index 5ec423bbdb1..28c45b7d44f 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -10,5 +10,5 @@ rec { less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingetty grub;}; - everything = [boot sysvinit]; + everything = [boot sysvinit kernel]; } -- GitLab From 16de9c1c61d6b02762cbd66dbaa23d13cf3e9b24 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 31 Jul 2005 19:01:59 +0000 Subject: [PATCH 0034/5331] add configuration for isolinux svn path=/nixu/trunk/; revision=3482 --- isolinux.cfg | 6 ++++++ make-disk.sh | 3 +++ 2 files changed, 9 insertions(+) create mode 100755 isolinux.cfg diff --git a/isolinux.cfg b/isolinux.cfg new file mode 100755 index 00000000000..1b69bafd4a9 --- /dev/null +++ b/isolinux.cfg @@ -0,0 +1,6 @@ +default linux +prompt 1 +timeout 600 +label linux + kernel vmlinuz + append root=/dev/hdc diff --git a/make-disk.sh b/make-disk.sh index 4ef319bcb08..a82632703ce 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -81,6 +81,7 @@ echo copying bootimage mkdir ${archivesDir}/isolinux cp ${syslinux}/lib/syslinux/isolinux.bin ${archivesDir}/isolinux +cp isolinux.cfg ${archivesDir}/isolinux chmod u+w ${archivesDir}/isolinux/* echo copying kernel @@ -91,6 +92,8 @@ cp -L $kernel/vmlinuz ${archivesDir}/isolinux/linux # echo making ramdisk # todo! +mkdir ${archivesDir}/sbin +ln -s /scripts/fill-disk.sh ${archivesDir}/sbin/init echo creating ISO image -- GitLab From 96776b9065a0a2c61d4dfa44db06f4b14b3f1ba4 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 31 Jul 2005 19:04:58 +0000 Subject: [PATCH 0035/5331] use "vmlinuz" instead of "linux", small cosmetic thing svn path=/nixu/trunk/; revision=3483 --- make-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-disk.sh b/make-disk.sh index a82632703ce..4e76b5aac69 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -88,7 +88,7 @@ echo copying kernel # By following the symlink we don't have to know the version number # of the kernel here. -cp -L $kernel/vmlinuz ${archivesDir}/isolinux/linux +cp -L $kernel/vmlinuz ${archivesDir}/isolinux # echo making ramdisk # todo! -- GitLab From b9617c9541eda51df5f10d917d4f193f23977662 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 31 Jul 2005 20:40:57 +0000 Subject: [PATCH 0036/5331] we need parted in the installer and on the target disk for sure... svn path=/nixu/trunk/; revision=3487 --- boot/default.nix | 4 ++-- pkgs.nix | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/boot/default.nix b/boot/default.nix index 5320404b733..52a7fd1d028 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,7 +1,7 @@ { stdenv, kernel, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep -, gnutar, gzip, mingetty, grub}: +, gnutar, gzip, mingetty, grub, parted}: derivation { name = "boot"; @@ -14,5 +14,5 @@ derivation { inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused - gnutar gnugrep gzip mingetty grub; + gnutar gnugrep gzip mingetty grub parted; } diff --git a/pkgs.nix b/pkgs.nix index 28c45b7d44f..d404a71e496 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -3,12 +3,12 @@ rec { stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip - mingetty grub syslinux; + mingetty grub syslinux parted; boot = (import ./boot) {inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl - gnused gnutar gnugrep gzip mingetty grub;}; + gnused gnutar gnugrep gzip mingetty grub parted;}; everything = [boot sysvinit kernel]; } -- GitLab From 9c56696e75fec0130f03c39fdef7a3869e29bbdb Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 1 Aug 2005 17:30:45 +0000 Subject: [PATCH 0037/5331] support for initrd. Right now the image is *WAY* too big, so it boots with a kernel panic. initrd should be brought back to a few megabytes instead so it can be safely unzipped in memory. Ideas: - klibc instead of glibc - leave out a lot of packages in the initrd: - gcc - linux-headers - ... - have a minimal "stage 1", which mounts the CD (figure out how) and remounts part of the CD on /nix and /nixpkgs svn path=/nixu/trunk/; revision=3502 --- fill-disk.sh | 11 ++++++----- isolinux.cfg | 2 +- make-disk.sh | 33 +++++++++++++++++++++++++++++++-- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 5dfb264884c..2f5ac0e117d 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,4 +1,5 @@ -#! /bin/sh -e +#! @bash@ -e +## #! /bin/sh -e sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ @@ -31,12 +32,12 @@ mkdir -p /tmp/mnt mount $device /tmp/mnt -mkdir -p /nix -mkdir -p /nixpkgs/trunk/pkgs +# mkdir -p /nix +# mkdir -p /nixpkgs/trunk/pkgs # temporary hack -mount --bind /mnt/cdrom1/nix /nix -mount --bind /mnt/cdrom1/pkgs /nixpkgs/trunk/pkgs +# mount --bind /mnt/cdrom1/nix /nix +# mount --bind /mnt/cdrom1/pkgs /nixpkgs/trunk/pkgs make_dir 00755 /bin make_dir 00755 /dev diff --git a/isolinux.cfg b/isolinux.cfg index 1b69bafd4a9..40bd0186880 100755 --- a/isolinux.cfg +++ b/isolinux.cfg @@ -3,4 +3,4 @@ prompt 1 timeout 600 label linux kernel vmlinuz - append root=/dev/hdc + append initrd=initram.img ramdisk_size=1000000 diff --git a/make-disk.sh b/make-disk.sh index 4e76b5aac69..b44861a27a6 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -10,6 +10,8 @@ fill_disk=$archivesDir/scripts/fill-disk.sh storePaths=$archivesDir/mystorepaths validatePaths=$archivesDir/validatepaths bootiso=/tmp/nixos.iso +#initrd=/tmp/initrd.img +initrd=/tmp/initram.img # keep chmod happy touch ${archivesDir}/blah @@ -42,6 +44,8 @@ echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).ni utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))) +bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)) + (while read storepath; do cp -fa --parents ${storepath} ${archivesDir} done) < $storePaths @@ -58,6 +62,18 @@ for i in $utilLinux; do fi done +echo creating directories for bootimage + +mkdir ${archivesDir}/bin +mkdir ${archivesDir}/sbin +mkdir -p ${archivesDir}/usr/bin +mkdir -p ${archivesDir}/usr/sbin +mkdir ${archivesDir}/tmp +mkdir ${archivesDir}/proc +mkdir ${archivesDir}/var +mkdir ${archivesDir}/etc +mkdir ${archivesDir}/dev + echo copying nixpkgs cp -fa ${nixpkgs} ${archivesDir} @@ -67,6 +83,8 @@ echo copying packges from store #cp -fa --parents ${nixDeps} ${archivesDir} cp -fau --parents ${utilLinux} ${archivesDir} +echo bash $bash + echo copying scripts mkdir ${archivesDir}/scripts @@ -74,6 +92,7 @@ cp -fa * ${archivesDir}/scripts sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@bootPath\@^$bootPath^g" \ -e "s^@NIX_CMD_PATH\@^$nix^g" \ + -e "s^@bash\@^$bash^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk @@ -92,8 +111,18 @@ cp -L $kernel/vmlinuz ${archivesDir}/isolinux # echo making ramdisk # todo! -mkdir ${archivesDir}/sbin -ln -s /scripts/fill-disk.sh ${archivesDir}/sbin/init +# mkdir ${archivesDir}/sbin +# ln -s /scripts/fill-disk.sh ${archivesDir}/sbin/init +ln -s /scripts/fill-disk.sh ${archivesDir}/init + +echo creating ramdisk + +rm -f ${initrd} +(cd ${archivesDir}; find . |cpio -c -o) | gzip -9 > ${initrd} + +#mkcramfs ${archivesDir} /tmp/initramdisk.img + +cp ${initrd} ${archivesDir}/isolinux echo creating ISO image -- GitLab From e6b3f223f628971ca54447c7a43f3ad54f5299a2 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 2 Aug 2005 12:29:23 +0000 Subject: [PATCH 0038/5331] whoops, not just query for, but actually *build* syslinux :o svn path=/nixu/trunk/; revision=3511 --- make-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-disk.sh b/make-disk.sh index b44861a27a6..3825221a91c 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -31,7 +31,7 @@ bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_C nix=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) -syslinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).syslinux' | $NIX_CMD_PATH/nix-instantiate -)) +syslinux=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).syslinux' | $NIX_CMD_PATH/nix-instantiate -)) kernel=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) -- GitLab From 45492df16b60102c9bc796ba26fcc091c632d2d0 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 3 Aug 2005 12:00:42 +0000 Subject: [PATCH 0039/5331] reduce the size of the initrd a lot svn path=/nixu/trunk/; revision=3514 --- fill-disk.sh | 8 +++++++- make-disk.sh | 41 +++++++++++++++++++++++++++++------------ 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 2f5ac0e117d..1e4e7a45f44 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,9 +1,15 @@ #! @bash@ -e -## #! /bin/sh -e + +export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ +mknod /dev/null c 1 3 +mknod /dev/console c 5 1 + +echo "blaat" + if ! test -n "$1" then echo "need harddisk device for installing!" diff --git a/make-disk.sh b/make-disk.sh index 3825221a91c..6bcfebcf7d9 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -12,6 +12,7 @@ validatePaths=$archivesDir/validatepaths bootiso=/tmp/nixos.iso #initrd=/tmp/initrd.img initrd=/tmp/initram.img +initdir=${archivesDir}/initdir # keep chmod happy touch ${archivesDir}/blah @@ -45,6 +46,9 @@ echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).ni utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))) bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)) +coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -)) +findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutils' | $NIX_CMD_PATH/nix-instantiate -)) +utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)) (while read storepath; do cp -fa --parents ${storepath} ${archivesDir} @@ -64,15 +68,16 @@ done echo creating directories for bootimage -mkdir ${archivesDir}/bin -mkdir ${archivesDir}/sbin -mkdir -p ${archivesDir}/usr/bin -mkdir -p ${archivesDir}/usr/sbin -mkdir ${archivesDir}/tmp -mkdir ${archivesDir}/proc -mkdir ${archivesDir}/var -mkdir ${archivesDir}/etc -mkdir ${archivesDir}/dev +mkdir ${initdir} +mkdir ${initdir}/bin +mkdir ${initdir}/sbin +mkdir -p ${initdir}/usr/bin +mkdir -p ${initdir}/usr/sbin +mkdir ${initdir}/tmp +mkdir ${initdir}/proc +mkdir ${initdir}/var +mkdir ${initdir}/etc +mkdir ${initdir}/dev echo copying nixpkgs @@ -83,7 +88,7 @@ echo copying packges from store #cp -fa --parents ${nixDeps} ${archivesDir} cp -fau --parents ${utilLinux} ${archivesDir} -echo bash $bash +bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))) echo copying scripts @@ -93,6 +98,9 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@bootPath\@^$bootPath^g" \ -e "s^@NIX_CMD_PATH\@^$nix^g" \ -e "s^@bash\@^$bash^g" \ + -e "s^@findutils\@^$findutils^g" \ + -e "s^@coreutils\@^$coreutils^g" \ + -e "s^@utillinux\@^$utillinux^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk @@ -113,12 +121,21 @@ cp -L $kernel/vmlinuz ${archivesDir}/isolinux # todo! # mkdir ${archivesDir}/sbin # ln -s /scripts/fill-disk.sh ${archivesDir}/sbin/init -ln -s /scripts/fill-disk.sh ${archivesDir}/init +# ln -s /scripts/fill-disk.sh ${archivesDir}/init echo creating ramdisk rm -f ${initrd} -(cd ${archivesDir}; find . |cpio -c -o) | gzip -9 > ${initrd} +cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init +cp ${bash}/bin/* ${initdir}/bin +#cp /nix/store/570hmhmx3v57605cqg9yfvvyh0nnb8k8-bash ${initdir}/bin/sh +chmod u+x ${initdir}/init +cp -fau --parents ${bashdeps} ${initdir} + +#mknod ${initdir}/dev/null c 1 3 +#mknod ${initdir}/dev/console c 5 1 + +(cd ${archivesDir}/initdisk; find . |cpio -c -o) | gzip -9 > ${initrd} #mkcramfs ${archivesDir} /tmp/initramdisk.img -- GitLab From 93bcd71b157387637c625029de5268104117db4c Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 3 Aug 2005 17:59:23 +0000 Subject: [PATCH 0040/5331] This update fixes a few critical errors: - cd to the right directory when making the initramfs image (stupid stupid stupid mistake, cost me a day of work!) - make a bunch of devices inside the ramdisk - copy the kernel and all modules to the CD image - set the #! line in fill-disk to the right place (as in, append /bin/sh, another stupidity, which was luckily easily spot after fixing the first mistake, which was far more important) svn path=/nixu/trunk/; revision=3523 --- fill-disk.sh | 45 ++++++++++++++++++++++++++++++++++++++++++--- isolinux.cfg | 2 +- make-disk.sh | 21 ++++++++++----------- 3 files changed, 53 insertions(+), 15 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 1e4e7a45f44..d7860316e4a 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,12 +1,51 @@ -#! @bash@ -e +#! @bash@/bin/sh -e export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ -mknod /dev/null c 1 3 -mknod /dev/console c 5 1 +mount -t proc proc /proc +mount -t sysfs sys /sys + +#mount -t /dev/hdc /installimage + +# make a complete /dev filesystem +# ripped permissions and everything from anaconda (loader2/devices.h) + +# consoles + +mknod -m 0600 /dev/console c 5 1 +mknod -m 0600 /dev/ttyS0 c 4 64 +mknod -m 0600 /dev/ttyS1 c 4 65 +mknod -m 0600 /dev/ttyS2 c 4 66 +mknod -m 0600 /dev/ttyS3 c 4 67 + +# base UNIX devices +mknod -m 0600 /dev/mem c 1 1 +mknod -m 0666 /dev/null c 1 3 +mknod -m 0666 /dev/zero c 1 5 + +# tty +mknod -m 0600 /dev/tty c 5 0 +mknod -m 0600 /dev/tty0 c 4 0 +mknod -m 0600 /dev/tty1 c 4 1 +mknod -m 0600 /dev/tty2 c 4 2 +mknod -m 0600 /dev/tty3 c 4 3 +mknod -m 0600 /dev/tty4 c 4 4 +mknod -m 0600 /dev/tty5 c 4 5 +mknod -m 0600 /dev/tty6 c 4 6 +mknod -m 0600 /dev/tty7 c 4 7 +mknod -m 0600 /dev/tty8 c 4 8 +mknod -m 0600 /dev/tty9 c 4 9 + +mkdir -m 0755 /dev/pts +mknod -m 0666 /dev/ptmx c 5 2 + +# random + +mknod -m 0644 /dev/random c 1 8 +mknod -m 0644 /dev/urandom c 1 9 echo "blaat" diff --git a/isolinux.cfg b/isolinux.cfg index 40bd0186880..f46570c89ff 100755 --- a/isolinux.cfg +++ b/isolinux.cfg @@ -3,4 +3,4 @@ prompt 1 timeout 600 label linux kernel vmlinuz - append initrd=initram.img ramdisk_size=1000000 + append initrd=initram.img init=/bin/sh diff --git a/make-disk.sh b/make-disk.sh index 6bcfebcf7d9..0877d3ecf83 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -70,14 +70,16 @@ echo creating directories for bootimage mkdir ${initdir} mkdir ${initdir}/bin +mkdir ${initdir}/dev +mkdir ${initdir}/etc +mkdir ${initdir}/installimage +mkdir ${initdir}/proc mkdir ${initdir}/sbin +mkdir ${initdir}/sys +mkdir ${initdir}/tmp mkdir -p ${initdir}/usr/bin mkdir -p ${initdir}/usr/sbin -mkdir ${initdir}/tmp -mkdir ${initdir}/proc mkdir ${initdir}/var -mkdir ${initdir}/etc -mkdir ${initdir}/dev echo copying nixpkgs @@ -87,6 +89,7 @@ echo copying packges from store #cp -fa --parents ${nixDeps} ${archivesDir} cp -fau --parents ${utilLinux} ${archivesDir} +#cp -fau --parents ${kernel} ${archivesDir} bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))) @@ -128,16 +131,12 @@ echo creating ramdisk rm -f ${initrd} cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init cp ${bash}/bin/* ${initdir}/bin -#cp /nix/store/570hmhmx3v57605cqg9yfvvyh0nnb8k8-bash ${initdir}/bin/sh +#cp -f /nix/store/570hmhmx3v57605cqg9yfvvyh0nnb8k8-bash ${initdir}/bin/sh chmod u+x ${initdir}/init cp -fau --parents ${bashdeps} ${initdir} -#mknod ${initdir}/dev/null c 1 3 -#mknod ${initdir}/dev/console c 5 1 - -(cd ${archivesDir}/initdisk; find . |cpio -c -o) | gzip -9 > ${initrd} - -#mkcramfs ${archivesDir} /tmp/initramdisk.img +#(cd ${initdir}; find . |cpio -c -o) | gzip -9 > ${initrd} +(cd ${archivesDir}/initdir; find . |cpio -c -o) | gzip -9 > ${initrd} cp ${initrd} ${archivesDir}/isolinux -- GitLab From 81bfae51f72885a411ea422d2a12bd0747982753 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 3 Aug 2005 18:14:47 +0000 Subject: [PATCH 0041/5331] - set timeout for isolinux to 1 minute - copy util-linux to ramdisk TODO: - do this with other tools as well in a bit more generic way svn path=/nixu/trunk/; revision=3524 --- isolinux.cfg | 2 +- make-disk.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/isolinux.cfg b/isolinux.cfg index f46570c89ff..180b144eeb5 100755 --- a/isolinux.cfg +++ b/isolinux.cfg @@ -1,6 +1,6 @@ default linux prompt 1 -timeout 600 +timeout 60 label linux kernel vmlinuz append initrd=initram.img init=/bin/sh diff --git a/make-disk.sh b/make-disk.sh index 0877d3ecf83..ba964d09c0e 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -134,6 +134,7 @@ cp ${bash}/bin/* ${initdir}/bin #cp -f /nix/store/570hmhmx3v57605cqg9yfvvyh0nnb8k8-bash ${initdir}/bin/sh chmod u+x ${initdir}/init cp -fau --parents ${bashdeps} ${initdir} +cp -fau --parents ${utilLinux} ${initdir} #(cd ${initdir}; find . |cpio -c -o) | gzip -9 > ${initrd} (cd ${archivesDir}/initdir; find . |cpio -c -o) | gzip -9 > ${initrd} -- GitLab From 8151b78162e48b31e88c23b6b8fc8d964d9fb119 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 4 Aug 2005 14:45:27 +0000 Subject: [PATCH 0042/5331] add necessary packages. Now it works and we have to decide: - either add the device with mknod - use hotplug to build all devices dynamically svn path=/nixu/trunk/; revision=3525 --- fill-disk.sh | 22 +++++++++++++--------- make-disk.sh | 7 ++++--- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index d7860316e4a..f384d15d7ec 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -15,7 +15,7 @@ mount -t sysfs sys /sys # consoles -mknod -m 0600 /dev/console c 5 1 +#mknod -m 0600 /dev/console c 5 1 mknod -m 0600 /dev/ttyS0 c 4 64 mknod -m 0600 /dev/ttyS1 c 4 65 mknod -m 0600 /dev/ttyS2 c 4 66 @@ -49,13 +49,15 @@ mknod -m 0644 /dev/urandom c 1 9 echo "blaat" -if ! test -n "$1" -then - echo "need harddisk device for installing!" - exit -else - device=$1 -fi +#if ! test -n "$1" +#then +# echo "need harddisk device for installing!" +# exit +#else +# device=$1 +#fi + +device=/dev/hda1 make_dir() { mode=$1 @@ -75,7 +77,9 @@ root=/tmp/mnt mkdir -p /tmp/mnt -mount $device /tmp/mnt +mount -t ext2 $device /tmp/mnt + +cd /sys; echo * # mkdir -p /nix # mkdir -p /nixpkgs/trunk/pkgs diff --git a/make-disk.sh b/make-disk.sh index ba964d09c0e..7b2f20781f7 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -44,6 +44,7 @@ echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).ni #echo $nixDeps > $storePaths utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))) +coreUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -))) bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)) coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -)) @@ -131,13 +132,13 @@ echo creating ramdisk rm -f ${initrd} cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init cp ${bash}/bin/* ${initdir}/bin -#cp -f /nix/store/570hmhmx3v57605cqg9yfvvyh0nnb8k8-bash ${initdir}/bin/sh chmod u+x ${initdir}/init cp -fau --parents ${bashdeps} ${initdir} cp -fau --parents ${utilLinux} ${initdir} +cp -fau --parents ${coreUtils} ${initdir} -#(cd ${initdir}; find . |cpio -c -o) | gzip -9 > ${initrd} -(cd ${archivesDir}/initdir; find . |cpio -c -o) | gzip -9 > ${initrd} +(cd ${initdir}; find . |cpio -c -o) | gzip -9 > ${initrd} +#(cd ${archivesDir}/initdir; find . |cpio -c -o) | gzip -9 > ${initrd} cp ${initrd} ${archivesDir}/isolinux -- GitLab From c785eeaaec25755b845d7811bbd2e8353bc1e411 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 4 Aug 2005 22:57:13 +0000 Subject: [PATCH 0043/5331] add stubs for creation of the installer via Nix expressions, similar to the bootscripts and initscripts. This will mean lots of cruft from the current fill-disk.sh can be removed. svn path=/nixu/trunk/; revision=3526 --- init/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 init/default.nix diff --git a/init/default.nix b/init/default.nix new file mode 100644 index 00000000000..b03437310c0 --- /dev/null +++ b/init/default.nix @@ -0,0 +1,9 @@ +{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grub, parted}: + +derivation { + name = "init"; + system = stdenv.system; + builder = ./builder.sh; + inherit stdenv bash coreutils utillinux e2fsprogs nix shadowutils + mingetty grub parted; +} -- GitLab From bc3ffa345873bfbbb3252fceb857875846802121 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 5 Aug 2005 13:48:22 +0000 Subject: [PATCH 0044/5331] get NixOS more towards an installable state. Stuff now actually gets installed on the disk itself. Missing is functionality to detect the right drive with the install CD in it. svn path=/nixu/trunk/; revision=3531 --- fill-disk.sh | 39 ++++++++- init/fill-disk.sh | 203 ++++++++++++++++++++++++++++++++++++++++++++++ make-disk.sh | 4 + pkgs.nix | 5 +- 4 files changed, 248 insertions(+), 3 deletions(-) create mode 100755 init/fill-disk.sh diff --git a/fill-disk.sh b/fill-disk.sh index f384d15d7ec..c6717945815 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin +export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ @@ -47,7 +47,22 @@ mknod -m 0666 /dev/ptmx c 5 2 mknod -m 0644 /dev/random c 1 8 mknod -m 0644 /dev/urandom c 1 9 -echo "blaat" +mknod -m 0660 /dev/hda b 3 0 +mknod -m 0660 /dev/hda1 b 3 1 +mknod -m 0660 /dev/hda2 b 3 2 +mknod -m 0660 /dev/hda3 b 3 3 + +#mknod -m 0660 /dev/sda b 8 0 +#mknod -m 0660 /dev/sda1 b 8 1 +#mknod -m 0660 /dev/sda2 b 8 2 +#mknod -m 0660 /dev/sda3 b 8 3 + +echo "dev" +cd /dev; echo * + +mkfs.ext2 /dev/hda1 +mkswap /dev/hda2 + #if ! test -n "$1" #then @@ -58,6 +73,8 @@ echo "blaat" #fi device=/dev/hda1 +#device=/dev/sda1 + make_dir() { mode=$1 @@ -88,6 +105,10 @@ cd /sys; echo * # mount --bind /mnt/cdrom1/nix /nix # mount --bind /mnt/cdrom1/pkgs /nixpkgs/trunk/pkgs +## +## Create a directory tree on the installation disk. +## + make_dir 00755 /bin make_dir 00755 /dev make_dir 00755 /proc @@ -110,6 +131,10 @@ make_dir 00755 /mnt/host make_dir 00755 /home make_dir 00755 /home/root +## +## Add a few devices to /dev on the install disk. This is by far complete. +## + mknod $root/dev/null c 1 3 touch_file /etc/passwd @@ -119,6 +144,12 @@ touch_file /etc/group rm -f $root/etc/mtab #ln -s /proc/mounts $root/etc/mtab +cat /proc/mounts + +## Probe for CD device which contains our CD here and mount /nix and +## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this. +## Find out how Knoppix and SUSE do this... + export NIX_DATA_DIR=$root/nix/share export NIX_LOG_DIR=$root/nix/log/nix export NIX_STATE_DIR=$root/nix/var/nix @@ -201,3 +232,7 @@ cp /etc/resolv.conf $root/etc rm -f $root/etc/hosts echo "127.0.0.1 localhost" >> $root/etc/hosts echo "192.168.150.1 uml" >> $root/etc/hosts + +### +### Do funky stuff with grub here. +### diff --git a/init/fill-disk.sh b/init/fill-disk.sh new file mode 100755 index 00000000000..f384d15d7ec --- /dev/null +++ b/init/fill-disk.sh @@ -0,0 +1,203 @@ +#! @bash@/bin/sh -e + +export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin + +sysvinitPath=@sysvinitPath@ +bootPath=@bootPath@ + +mount -t proc proc /proc +mount -t sysfs sys /sys + +#mount -t /dev/hdc /installimage + +# make a complete /dev filesystem +# ripped permissions and everything from anaconda (loader2/devices.h) + +# consoles + +#mknod -m 0600 /dev/console c 5 1 +mknod -m 0600 /dev/ttyS0 c 4 64 +mknod -m 0600 /dev/ttyS1 c 4 65 +mknod -m 0600 /dev/ttyS2 c 4 66 +mknod -m 0600 /dev/ttyS3 c 4 67 + +# base UNIX devices +mknod -m 0600 /dev/mem c 1 1 +mknod -m 0666 /dev/null c 1 3 +mknod -m 0666 /dev/zero c 1 5 + +# tty +mknod -m 0600 /dev/tty c 5 0 +mknod -m 0600 /dev/tty0 c 4 0 +mknod -m 0600 /dev/tty1 c 4 1 +mknod -m 0600 /dev/tty2 c 4 2 +mknod -m 0600 /dev/tty3 c 4 3 +mknod -m 0600 /dev/tty4 c 4 4 +mknod -m 0600 /dev/tty5 c 4 5 +mknod -m 0600 /dev/tty6 c 4 6 +mknod -m 0600 /dev/tty7 c 4 7 +mknod -m 0600 /dev/tty8 c 4 8 +mknod -m 0600 /dev/tty9 c 4 9 + +mkdir -m 0755 /dev/pts +mknod -m 0666 /dev/ptmx c 5 2 + +# random + +mknod -m 0644 /dev/random c 1 8 +mknod -m 0644 /dev/urandom c 1 9 + +echo "blaat" + +#if ! test -n "$1" +#then +# echo "need harddisk device for installing!" +# exit +#else +# device=$1 +#fi + +device=/dev/hda1 + +make_dir() { + mode=$1 + name=$2 + echo creating $name... + if ! test -d $root/$name; then mkdir $root/$name; fi + chmod $mode $root/$name +} + + +touch_file() { + name=$1 + echo touching $name... + if ! test -d $root/$name; then touch $root/$name; fi +} +root=/tmp/mnt + +mkdir -p /tmp/mnt + +mount -t ext2 $device /tmp/mnt + +cd /sys; echo * + +# mkdir -p /nix +# mkdir -p /nixpkgs/trunk/pkgs + +# temporary hack +# mount --bind /mnt/cdrom1/nix /nix +# mount --bind /mnt/cdrom1/pkgs /nixpkgs/trunk/pkgs + +make_dir 00755 /bin +make_dir 00755 /dev +make_dir 00755 /proc +make_dir 01777 /tmp +make_dir 00755 /etc # global non-constant configuration +make_dir 00755 /etc-secret +make_dir 00755 /var +make_dir 00755 /nix +make_dir 00755 /nix/store +make_dir 00755 /nix/var +make_dir 00755 /nix/var/nix +make_dir 00755 /nix/var/nix/db +make_dir 00755 /nix/var/nix/manifests +make_dir 00755 /nix/var/log +make_dir 00755 /nix/var/log/nix +make_dir 00755 /nixpkgs +make_dir 00755 /nixpkgs/trunk +make_dir 00755 /mnt +make_dir 00755 /mnt/host +make_dir 00755 /home +make_dir 00755 /home/root + +mknod $root/dev/null c 1 3 + +touch_file /etc/passwd +touch_file /etc/shadow +touch_file /etc/group + +rm -f $root/etc/mtab +#ln -s /proc/mounts $root/etc/mtab + +export NIX_DATA_DIR=$root/nix/share +export NIX_LOG_DIR=$root/nix/log/nix +export NIX_STATE_DIR=$root/nix/var/nix +export NIX_CONF_DIR=$root/nix/etc +NIX_CMD_PATH=@NIX_CMD_PATH@/bin + +echo initialising Nix DB... +#/nix/bin/nix-store --init +$NIX_CMD_PATH/nix-store --init + +echo verifying Nix DB... +$NIX_CMD_PATH/nix-store --verify + +echo copying nixpkgs... +cp -fa ../pkgs $root/nixpkgs/trunk + +make_dir 0755 /tmp/scripts +cp -fa ../scripts $root/tmp + +#echo adding manifest +#$NIX_CMD_PATH/nix-pull $manifest + +echo adding packages +export NIX_ROOT=$root +unset NIX_DATA_DIR +unset NIX_LOG_DIR +unset NIX_STATE_DIR +unset NIX_CONF_DIR + +#storeExpr=$(echo '(import /tmp/scripts/pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) +#storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) +#$NIX_CMD_PATH/nix-store -r $storeExpr +#echo $storeExpr +#storeExpr2=$($NIX_CMD_PATH/nix-store -qR $($NIX_CMD_PATH/nix-store -r $storeExpr)) +#echo storeExpr $storeExpr +#echo $($NIX_CMD_PATH/nix-store -qR --include-outputs $storeExpr) + +echo copying store + +(while read storepaths; do + cp -fa $storepaths $root/nix/store +done) < /mnt/cdrom1/mystorepaths + +#cp -fa ../nix/store/* $root/nix/store + +#echo registering valid paths... +#(while read storepath; do +# echo PATH $storepath +# if ! $NIX_CMD_PATH/nix-store --isvalid $storepath 2> /dev/null; then +# (unset NIX_ROOT; $NIX_CMD_PATH/nix-store --dump $storepath) | $NIX_CMD_PATH/nix-store --restore $storepath +# $NIX_CMD_PATH/nix-store --validpath $storepath +# fi +#done) < /tmp/mystorepaths + +#echo registering successors... +#(while read line; do +# echo SUCC $line +# $NIX_CMD_PATH/nix-store --successor $line +#done) < /tmp/mysuccessors + +exit + +echo setting init symlink... +rm -f $root/init +ln -s $sysvinitPath/sbin/init $root/init + +echo setting up inittab... +rm -f $root/etc/inittab +echo "id:2:initdefault:" >> $root/etc/inittab +echo "si::bootwait:$bootPath/bin/boot.sh" >> $root/etc/inittab +echo "ht:06:wait:$bootPath/bin/halt.sh" >> $root/etc/inittab +echo "1:2345:respawn:$bootPath/bin/login.sh /dev/ttys/0" >> $root/etc/inittab +#echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab + +echo setting up networking information... +make_dir 00755 /etc/networking +echo 192.168.150.1 > $root/etc/networking/local-ip +echo 192.168.150.3 > $root/etc/networking/gateway-ip +cp /etc/resolv.conf $root/etc +rm -f $root/etc/hosts +echo "127.0.0.1 localhost" >> $root/etc/hosts +echo "192.168.150.1 uml" >> $root/etc/hosts diff --git a/make-disk.sh b/make-disk.sh index 7b2f20781f7..9d4bb589e37 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -45,11 +45,13 @@ echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).ni utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))) coreUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -))) +e2fsProgs=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -))) bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)) coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -)) findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutils' | $NIX_CMD_PATH/nix-instantiate -)) utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)) +e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -)) (while read storepath; do cp -fa --parents ${storepath} ${archivesDir} @@ -105,6 +107,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@findutils\@^$findutils^g" \ -e "s^@coreutils\@^$coreutils^g" \ -e "s^@utillinux\@^$utillinux^g" \ + -e "s^@e2fsprogs\@^$e2fsprogs^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk @@ -136,6 +139,7 @@ chmod u+x ${initdir}/init cp -fau --parents ${bashdeps} ${initdir} cp -fau --parents ${utilLinux} ${initdir} cp -fau --parents ${coreUtils} ${initdir} +cp -fau --parents ${e2fsProgs} ${initdir} (cd ${initdir}; find . |cpio -c -o) | gzip -9 > ${initrd} #(cd ${archivesDir}/initdir; find . |cpio -c -o) | gzip -9 > ${initrd} diff --git a/pkgs.nix b/pkgs.nix index d404a71e496..23573c7aedb 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -10,5 +10,8 @@ rec { less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingetty grub parted;}; - everything = [boot sysvinit kernel]; + init = (import ./init) {inherit stdenv bash coreutils + utillinux e2fsprogs nix shadowutils mingetty grub parted;}; + + everything = [boot init sysvinit kernel]; } -- GitLab From 9babae1704ee8a1ae75cd0060f5b0e7701667da4 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 5 Aug 2005 21:56:48 +0000 Subject: [PATCH 0045/5331] split fill-disk in two parts svn path=/nixu/trunk/; revision=3532 --- init/default.nix | 2 ++ init/fill-disk.sh | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/init/default.nix b/init/default.nix index b03437310c0..48c27469ee8 100644 --- a/init/default.nix +++ b/init/default.nix @@ -4,6 +4,8 @@ derivation { name = "init"; system = stdenv.system; builder = ./builder.sh; + stage1 = ./prepare-disk.sh; + stage2 = ./fill-disk.sh; inherit stdenv bash coreutils utillinux e2fsprogs nix shadowutils mingetty grub parted; } diff --git a/init/fill-disk.sh b/init/fill-disk.sh index f384d15d7ec..c6717945815 100755 --- a/init/fill-disk.sh +++ b/init/fill-disk.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin +export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ @@ -47,7 +47,22 @@ mknod -m 0666 /dev/ptmx c 5 2 mknod -m 0644 /dev/random c 1 8 mknod -m 0644 /dev/urandom c 1 9 -echo "blaat" +mknod -m 0660 /dev/hda b 3 0 +mknod -m 0660 /dev/hda1 b 3 1 +mknod -m 0660 /dev/hda2 b 3 2 +mknod -m 0660 /dev/hda3 b 3 3 + +#mknod -m 0660 /dev/sda b 8 0 +#mknod -m 0660 /dev/sda1 b 8 1 +#mknod -m 0660 /dev/sda2 b 8 2 +#mknod -m 0660 /dev/sda3 b 8 3 + +echo "dev" +cd /dev; echo * + +mkfs.ext2 /dev/hda1 +mkswap /dev/hda2 + #if ! test -n "$1" #then @@ -58,6 +73,8 @@ echo "blaat" #fi device=/dev/hda1 +#device=/dev/sda1 + make_dir() { mode=$1 @@ -88,6 +105,10 @@ cd /sys; echo * # mount --bind /mnt/cdrom1/nix /nix # mount --bind /mnt/cdrom1/pkgs /nixpkgs/trunk/pkgs +## +## Create a directory tree on the installation disk. +## + make_dir 00755 /bin make_dir 00755 /dev make_dir 00755 /proc @@ -110,6 +131,10 @@ make_dir 00755 /mnt/host make_dir 00755 /home make_dir 00755 /home/root +## +## Add a few devices to /dev on the install disk. This is by far complete. +## + mknod $root/dev/null c 1 3 touch_file /etc/passwd @@ -119,6 +144,12 @@ touch_file /etc/group rm -f $root/etc/mtab #ln -s /proc/mounts $root/etc/mtab +cat /proc/mounts + +## Probe for CD device which contains our CD here and mount /nix and +## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this. +## Find out how Knoppix and SUSE do this... + export NIX_DATA_DIR=$root/nix/share export NIX_LOG_DIR=$root/nix/log/nix export NIX_STATE_DIR=$root/nix/var/nix @@ -201,3 +232,7 @@ cp /etc/resolv.conf $root/etc rm -f $root/etc/hosts echo "127.0.0.1 localhost" >> $root/etc/hosts echo "192.168.150.1 uml" >> $root/etc/hosts + +### +### Do funky stuff with grub here. +### -- GitLab From 55cf30623fc7d266aa43d4ce7e5241041bc47bac Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 5 Aug 2005 22:05:35 +0000 Subject: [PATCH 0046/5331] split fill-disk into prepare-disk (preparing the RAM disk and finding the CD player and everything) and install-disk (installing everything) svn path=/nixu/trunk/; revision=3533 --- init/default.nix | 2 +- init/{fill-disk.sh => install-disk.sh} | 63 ------------------------ init/prepare-disk.sh | 68 ++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 64 deletions(-) rename init/{fill-disk.sh => install-disk.sh} (74%) create mode 100755 init/prepare-disk.sh diff --git a/init/default.nix b/init/default.nix index 48c27469ee8..9657101ac03 100644 --- a/init/default.nix +++ b/init/default.nix @@ -5,7 +5,7 @@ derivation { system = stdenv.system; builder = ./builder.sh; stage1 = ./prepare-disk.sh; - stage2 = ./fill-disk.sh; + stage2 = ./install-disk.sh; inherit stdenv bash coreutils utillinux e2fsprogs nix shadowutils mingetty grub parted; } diff --git a/init/fill-disk.sh b/init/install-disk.sh similarity index 74% rename from init/fill-disk.sh rename to init/install-disk.sh index c6717945815..9e18719f208 100755 --- a/init/fill-disk.sh +++ b/init/install-disk.sh @@ -5,65 +5,6 @@ export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinu sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ -mount -t proc proc /proc -mount -t sysfs sys /sys - -#mount -t /dev/hdc /installimage - -# make a complete /dev filesystem -# ripped permissions and everything from anaconda (loader2/devices.h) - -# consoles - -#mknod -m 0600 /dev/console c 5 1 -mknod -m 0600 /dev/ttyS0 c 4 64 -mknod -m 0600 /dev/ttyS1 c 4 65 -mknod -m 0600 /dev/ttyS2 c 4 66 -mknod -m 0600 /dev/ttyS3 c 4 67 - -# base UNIX devices -mknod -m 0600 /dev/mem c 1 1 -mknod -m 0666 /dev/null c 1 3 -mknod -m 0666 /dev/zero c 1 5 - -# tty -mknod -m 0600 /dev/tty c 5 0 -mknod -m 0600 /dev/tty0 c 4 0 -mknod -m 0600 /dev/tty1 c 4 1 -mknod -m 0600 /dev/tty2 c 4 2 -mknod -m 0600 /dev/tty3 c 4 3 -mknod -m 0600 /dev/tty4 c 4 4 -mknod -m 0600 /dev/tty5 c 4 5 -mknod -m 0600 /dev/tty6 c 4 6 -mknod -m 0600 /dev/tty7 c 4 7 -mknod -m 0600 /dev/tty8 c 4 8 -mknod -m 0600 /dev/tty9 c 4 9 - -mkdir -m 0755 /dev/pts -mknod -m 0666 /dev/ptmx c 5 2 - -# random - -mknod -m 0644 /dev/random c 1 8 -mknod -m 0644 /dev/urandom c 1 9 - -mknod -m 0660 /dev/hda b 3 0 -mknod -m 0660 /dev/hda1 b 3 1 -mknod -m 0660 /dev/hda2 b 3 2 -mknod -m 0660 /dev/hda3 b 3 3 - -#mknod -m 0660 /dev/sda b 8 0 -#mknod -m 0660 /dev/sda1 b 8 1 -#mknod -m 0660 /dev/sda2 b 8 2 -#mknod -m 0660 /dev/sda3 b 8 3 - -echo "dev" -cd /dev; echo * - -mkfs.ext2 /dev/hda1 -mkswap /dev/hda2 - - #if ! test -n "$1" #then # echo "need harddisk device for installing!" @@ -146,10 +87,6 @@ rm -f $root/etc/mtab cat /proc/mounts -## Probe for CD device which contains our CD here and mount /nix and -## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this. -## Find out how Knoppix and SUSE do this... - export NIX_DATA_DIR=$root/nix/share export NIX_LOG_DIR=$root/nix/log/nix export NIX_STATE_DIR=$root/nix/var/nix diff --git a/init/prepare-disk.sh b/init/prepare-disk.sh new file mode 100755 index 00000000000..3e0c845de83 --- /dev/null +++ b/init/prepare-disk.sh @@ -0,0 +1,68 @@ +#! @bash@/bin/sh -e + +export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin + +sysvinitPath=@sysvinitPath@ +bootPath=@bootPath@ + +mount -t proc proc /proc +mount -t sysfs sys /sys + +#mount -t /dev/hdc /installimage + +# make a complete /dev filesystem +# ripped permissions and everything from anaconda (loader2/devices.h) + +# consoles + +#mknod -m 0600 /dev/console c 5 1 +mknod -m 0600 /dev/ttyS0 c 4 64 +mknod -m 0600 /dev/ttyS1 c 4 65 +mknod -m 0600 /dev/ttyS2 c 4 66 +mknod -m 0600 /dev/ttyS3 c 4 67 + +# base UNIX devices +mknod -m 0600 /dev/mem c 1 1 +mknod -m 0666 /dev/null c 1 3 +mknod -m 0666 /dev/zero c 1 5 + +# tty +mknod -m 0600 /dev/tty c 5 0 +mknod -m 0600 /dev/tty0 c 4 0 +mknod -m 0600 /dev/tty1 c 4 1 +mknod -m 0600 /dev/tty2 c 4 2 +mknod -m 0600 /dev/tty3 c 4 3 +mknod -m 0600 /dev/tty4 c 4 4 +mknod -m 0600 /dev/tty5 c 4 5 +mknod -m 0600 /dev/tty6 c 4 6 +mknod -m 0600 /dev/tty7 c 4 7 +mknod -m 0600 /dev/tty8 c 4 8 +mknod -m 0600 /dev/tty9 c 4 9 + +mkdir -m 0755 /dev/pts +mknod -m 0666 /dev/ptmx c 5 2 + +# random + +mknod -m 0644 /dev/random c 1 8 +mknod -m 0644 /dev/urandom c 1 9 + +mknod -m 0660 /dev/hda b 3 0 +mknod -m 0660 /dev/hda1 b 3 1 +mknod -m 0660 /dev/hda2 b 3 2 +mknod -m 0660 /dev/hda3 b 3 3 + +#mknod -m 0660 /dev/sda b 8 0 +#mknod -m 0660 /dev/sda1 b 8 1 +#mknod -m 0660 /dev/sda2 b 8 2 +#mknod -m 0660 /dev/sda3 b 8 3 + +echo "dev" +cd /dev; echo * + +mkfs.ext2 /dev/hda1 +mkswap /dev/hda2 + +## Probe for CD device which contains our CD here and mount /nix and +## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this. +## Find out how Knoppix and SUSE do this... -- GitLab From 2ed7eb698bf0e608a025d28740ccee60a6d4bd0b Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 5 Aug 2005 22:07:34 +0000 Subject: [PATCH 0047/5331] invoke install-disk (untested) svn path=/nixu/trunk/; revision=3534 --- init/prepare-disk.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init/prepare-disk.sh b/init/prepare-disk.sh index 3e0c845de83..8ba9e93ddfc 100755 --- a/init/prepare-disk.sh +++ b/init/prepare-disk.sh @@ -66,3 +66,5 @@ mkswap /dev/hda2 ## Probe for CD device which contains our CD here and mount /nix and ## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this. ## Find out how Knoppix and SUSE do this... + +$(./install-disk.sh) -- GitLab From 592b736d33baab9c33c58199005a0b17fc8bd6f5 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 9 Aug 2005 16:51:26 +0000 Subject: [PATCH 0048/5331] add modutils, start with code that will find the right CD player our install CD is in. svn path=/nixu/trunk/; revision=3540 --- boot/default.nix | 4 ++-- fill-disk.sh | 4 ++++ init/default.nix | 4 ++-- make-disk.sh | 7 +++++++ pkgs.nix | 6 +++--- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/boot/default.nix b/boot/default.nix index 52a7fd1d028..97313b94e83 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,7 +1,7 @@ { stdenv, kernel, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep -, gnutar, gzip, mingetty, grub, parted}: +, gnutar, gzip, mingetty, grub, parted, modutils}: derivation { name = "boot"; @@ -14,5 +14,5 @@ derivation { inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused - gnutar gnugrep gzip mingetty grub parted; + gnutar gnugrep gzip mingetty grub parted modutils; } diff --git a/fill-disk.sh b/fill-disk.sh index c6717945815..2e5d7e90018 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -4,6 +4,7 @@ export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinu sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ +modutils=@modutils@ mount -t proc proc /proc mount -t sysfs sys /sys @@ -150,6 +151,8 @@ cat /proc/mounts ## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this. ## Find out how Knoppix and SUSE do this... +cat /proc/ide/hd*/driver + export NIX_DATA_DIR=$root/nix/share export NIX_LOG_DIR=$root/nix/log/nix export NIX_STATE_DIR=$root/nix/var/nix @@ -236,3 +239,4 @@ echo "192.168.150.1 uml" >> $root/etc/hosts ### ### Do funky stuff with grub here. ### + diff --git a/init/default.nix b/init/default.nix index 9657101ac03..9c7a468efe1 100644 --- a/init/default.nix +++ b/init/default.nix @@ -1,4 +1,4 @@ -{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grub, parted}: +{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grub, parted, modutils}: derivation { name = "init"; @@ -7,5 +7,5 @@ derivation { stage1 = ./prepare-disk.sh; stage2 = ./install-disk.sh; inherit stdenv bash coreutils utillinux e2fsprogs nix shadowutils - mingetty grub parted; + mingetty grub parted modutils; } diff --git a/make-disk.sh b/make-disk.sh index 9d4bb589e37..4a87ffed629 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -46,12 +46,14 @@ echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).ni utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))) coreUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -))) e2fsProgs=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -))) +modUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).modutils' | $NIX_CMD_PATH/nix-instantiate -))) bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)) coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -)) findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutils' | $NIX_CMD_PATH/nix-instantiate -)) utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)) e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -)) +modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).modutils' | $NIX_CMD_PATH/nix-instantiate -)) (while read storepath; do cp -fa --parents ${storepath} ${archivesDir} @@ -76,6 +78,7 @@ mkdir ${initdir}/bin mkdir ${initdir}/dev mkdir ${initdir}/etc mkdir ${initdir}/installimage +mkdir ${initdir}/modules mkdir ${initdir}/proc mkdir ${initdir}/sbin mkdir ${initdir}/sys @@ -108,6 +111,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@coreutils\@^$coreutils^g" \ -e "s^@utillinux\@^$utillinux^g" \ -e "s^@e2fsprogs\@^$e2fsprogs^g" \ + -e "s^@modutils\@^$modutils^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk @@ -140,6 +144,7 @@ cp -fau --parents ${bashdeps} ${initdir} cp -fau --parents ${utilLinux} ${initdir} cp -fau --parents ${coreUtils} ${initdir} cp -fau --parents ${e2fsProgs} ${initdir} +cp -fau --parents ${modUtils} ${initdir} (cd ${initdir}; find . |cpio -c -o) | gzip -9 > ${initrd} #(cd ${archivesDir}/initdir; find . |cpio -c -o) | gzip -9 > ${initrd} @@ -151,3 +156,5 @@ echo creating ISO image mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin -c isolinux/boot.cat \ -no-emul-boot -boot-load-size 4 -boot-info-table \ ${archivesDir} + +echo ${kernel} diff --git a/pkgs.nix b/pkgs.nix index 23573c7aedb..6fae9f65ca3 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -3,15 +3,15 @@ rec { stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip - mingetty grub syslinux parted; + mingetty grub syslinux parted modutils; boot = (import ./boot) {inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl - gnused gnutar gnugrep gzip mingetty grub parted;}; + gnused gnutar gnugrep gzip mingetty grub parted modutils;}; init = (import ./init) {inherit stdenv bash coreutils - utillinux e2fsprogs nix shadowutils mingetty grub parted;}; + utillinux e2fsprogs nix shadowutils mingetty grub parted modutils;}; everything = [boot init sysvinit kernel]; } -- GitLab From 8aaf4e9a752a276d57186cf9fc34ea8d70214980 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 11 Aug 2005 14:06:04 +0000 Subject: [PATCH 0049/5331] touch a file "NIXOS" so we can more easily find the NixOS install CD svn path=/nixu/trunk/; revision=3546 --- make-disk.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/make-disk.sh b/make-disk.sh index 4a87ffed629..70698a30b9e 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -146,6 +146,8 @@ cp -fau --parents ${coreUtils} ${initdir} cp -fau --parents ${e2fsProgs} ${initdir} cp -fau --parents ${modUtils} ${initdir} +touch ${initdir}/NIXOS + (cd ${initdir}; find . |cpio -c -o) | gzip -9 > ${initrd} #(cd ${archivesDir}/initdir; find . |cpio -c -o) | gzip -9 > ${initrd} -- GitLab From edbd58ca43f55a8b431a9fa51c7c539684e32a04 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 12 Aug 2005 16:26:51 +0000 Subject: [PATCH 0050/5331] search for NixOS CD, mount it, copy packages onto the target disk for real now. Only IDE drives supported so far. svn path=/nixu/trunk/; revision=3559 --- fill-disk.sh | 61 ++++++++++++++++++++++++++++++++++++++++++---------- make-disk.sh | 1 + 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 2e5d7e90018..6d66b7fb638 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -53,6 +53,21 @@ mknod -m 0660 /dev/hda1 b 3 1 mknod -m 0660 /dev/hda2 b 3 2 mknod -m 0660 /dev/hda3 b 3 3 +mknod -m 0660 /dev/hdb b 3 64 +mknod -m 0660 /dev/hdb1 b 3 65 +mknod -m 0660 /dev/hdb2 b 3 66 +mknod -m 0660 /dev/hdb3 b 3 67 + +mknod -m 0660 /dev/hdc b 22 0 +mknod -m 0660 /dev/hdc1 b 22 1 +mknod -m 0660 /dev/hdc2 b 22 2 +mknod -m 0660 /dev/hdc3 b 22 3 + +mknod -m 0660 /dev/hdd b 22 64 +mknod -m 0660 /dev/hdd1 b 22 65 +mknod -m 0660 /dev/hdd2 b 22 66 +mknod -m 0660 /dev/hdd3 b 22 67 + #mknod -m 0660 /dev/sda b 8 0 #mknod -m 0660 /dev/sda1 b 8 1 #mknod -m 0660 /dev/sda2 b 8 2 @@ -99,13 +114,6 @@ mount -t ext2 $device /tmp/mnt cd /sys; echo * -# mkdir -p /nix -# mkdir -p /nixpkgs/trunk/pkgs - -# temporary hack -# mount --bind /mnt/cdrom1/nix /nix -# mount --bind /mnt/cdrom1/pkgs /nixpkgs/trunk/pkgs - ## ## Create a directory tree on the installation disk. ## @@ -151,7 +159,38 @@ cat /proc/mounts ## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this. ## Find out how Knoppix and SUSE do this... -cat /proc/ide/hd*/driver +#devices=$(grep -r cdrom hd* | cut -d '/' -f 1 | sort | uniq) +#echo devices ${devices} + +DEVICES="/dev/hd?" + +echo devices ${DEVICES} + +for i in ${DEVICES} +do +echo "Looking for CDROM in: $i" +if mount -t iso9660 $i /cdrom >/dev/null 2>&1 +then + echo "cdrom contents" + ls /cdrom + if test -f /cdrom/NIXOS + then + cddevice=$i + echo "Accessing NixOS CDROM at $i" + break +fi +#umount /cdrom +fi +done + +echo cddevice ${cddevice} + +#echo path $PATH +ls -l @coreutils@/bin/l* +#rm -rf /nix +ln -s /cdrom/nixpkgs /nixpkgs +mount --bind /cdrom/nix /nix + export NIX_DATA_DIR=$root/nix/share export NIX_LOG_DIR=$root/nix/log/nix @@ -167,10 +206,10 @@ echo verifying Nix DB... $NIX_CMD_PATH/nix-store --verify echo copying nixpkgs... -cp -fa ../pkgs $root/nixpkgs/trunk +cp -fa /nixpkgs $root/nixpkgs/trunk make_dir 0755 /tmp/scripts -cp -fa ../scripts $root/tmp +cp -fa /cdrom/scripts $root/tmp #echo adding manifest #$NIX_CMD_PATH/nix-pull $manifest @@ -194,7 +233,7 @@ echo copying store (while read storepaths; do cp -fa $storepaths $root/nix/store -done) < /mnt/cdrom1/mystorepaths +done) < /cdrom/mystorepaths #cp -fa ../nix/store/* $root/nix/store diff --git a/make-disk.sh b/make-disk.sh index 70698a30b9e..c02fb7778d3 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -75,6 +75,7 @@ echo creating directories for bootimage mkdir ${initdir} mkdir ${initdir}/bin +mkdir ${initdir}/cdrom mkdir ${initdir}/dev mkdir ${initdir}/etc mkdir ${initdir}/installimage -- GitLab From a866ceef3e9ecc65c93af49b43b7235d842ae3e0 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 12 Aug 2005 23:40:12 +0000 Subject: [PATCH 0051/5331] add grub to the path svn path=/nixu/trunk/; revision=3564 --- fill-disk.sh | 6 ++---- make-disk.sh | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 6d66b7fb638..7e86434a78e 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin +export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ @@ -252,8 +252,6 @@ done) < /cdrom/mystorepaths # $NIX_CMD_PATH/nix-store --successor $line #done) < /tmp/mysuccessors -exit - echo setting init symlink... rm -f $root/init ln -s $sysvinitPath/sbin/init $root/init @@ -270,7 +268,7 @@ echo setting up networking information... make_dir 00755 /etc/networking echo 192.168.150.1 > $root/etc/networking/local-ip echo 192.168.150.3 > $root/etc/networking/gateway-ip -cp /etc/resolv.conf $root/etc +#cp /etc/resolv.conf $root/etc rm -f $root/etc/hosts echo "127.0.0.1 localhost" >> $root/etc/hosts echo "192.168.150.1 uml" >> $root/etc/hosts diff --git a/make-disk.sh b/make-disk.sh index c02fb7778d3..0b7e31ab89d 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -54,6 +54,7 @@ findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutils' | utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)) e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -)) modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).modutils' | $NIX_CMD_PATH/nix-instantiate -)) +grub=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).grub' | $NIX_CMD_PATH/nix-instantiate -)) (while read storepath; do cp -fa --parents ${storepath} ${archivesDir} @@ -113,6 +114,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@utillinux\@^$utillinux^g" \ -e "s^@e2fsprogs\@^$e2fsprogs^g" \ -e "s^@modutils\@^$modutils^g" \ + -e "s^@grub\@^$grub^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk -- GitLab From 655ef5ac38e051f260fa0e8ba56a70418e4cff03 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 12 Aug 2005 23:41:57 +0000 Subject: [PATCH 0052/5331] actually build grub too svn path=/nixu/trunk/; revision=3565 --- make-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-disk.sh b/make-disk.sh index 0b7e31ab89d..73919434889 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -54,7 +54,7 @@ findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutils' | utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)) e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -)) modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).modutils' | $NIX_CMD_PATH/nix-instantiate -)) -grub=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).grub' | $NIX_CMD_PATH/nix-instantiate -)) +grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grub' | $NIX_CMD_PATH/nix-instantiate -)) (while read storepath; do cp -fa --parents ${storepath} ${archivesDir} -- GitLab From fdab68ff43dbf2eae0d91cba41ba4751f075c0e5 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 12 Aug 2005 23:51:12 +0000 Subject: [PATCH 0053/5331] make a /boot directory on the targetdrive svn path=/nixu/trunk/; revision=3566 --- fill-disk.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/fill-disk.sh b/fill-disk.sh index 7e86434a78e..ec1533ee4b9 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -119,6 +119,7 @@ cd /sys; echo * ## make_dir 00755 /bin +make_dir 00755 /boot make_dir 00755 /dev make_dir 00755 /proc make_dir 01777 /tmp -- GitLab From c7bd0ec47368335d522d5ff122cfa1afee6a0ceb Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 14 Aug 2005 01:40:36 +0000 Subject: [PATCH 0054/5331] get grub right, also copy all the packages needed for a nice booting system svn path=/nixu/trunk/; revision=3575 --- boot/default.nix | 4 ++-- fill-disk.sh | 51 ++++++++++++++++++++++++++++++------------------ init/default.nix | 4 ++-- make-disk.sh | 32 +++++++++++++++++++++++------- pkgs.nix | 6 +++--- 5 files changed, 64 insertions(+), 33 deletions(-) diff --git a/boot/default.nix b/boot/default.nix index 97313b94e83..3724660ae22 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,7 +1,7 @@ { stdenv, kernel, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep -, gnutar, gzip, mingetty, grub, parted, modutils}: +, gnutar, gzip, mingetty, grubWrapper, parted, modutils}: derivation { name = "boot"; @@ -14,5 +14,5 @@ derivation { inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused - gnutar gnugrep gzip mingetty grub parted modutils; + gnutar gnugrep gzip mingetty grubWrapper parted modutils; } diff --git a/fill-disk.sh b/fill-disk.sh index ec1533ee4b9..7d1ce76d31b 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,8 @@ #! @bash@/bin/sh -e -export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin +export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin + +kernel=@kernel@ sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ @@ -9,8 +11,6 @@ modutils=@modutils@ mount -t proc proc /proc mount -t sysfs sys /sys -#mount -t /dev/hdc /installimage - # make a complete /dev filesystem # ripped permissions and everything from anaconda (loader2/devices.h) @@ -73,11 +73,15 @@ mknod -m 0660 /dev/hdd3 b 22 67 #mknod -m 0660 /dev/sda2 b 8 2 #mknod -m 0660 /dev/sda3 b 8 3 +mknod -m 0600 /dev/initctl p + echo "dev" cd /dev; echo * -mkfs.ext2 /dev/hda1 -mkswap /dev/hda2 +targetdrive=/dev/hda +device=${targetdrive}1 +mkfs.ext2 ${device} +mkswap ${targetdrive}2 #if ! test -n "$1" @@ -88,9 +92,6 @@ mkswap /dev/hda2 # device=$1 #fi -device=/dev/hda1 -#device=/dev/sda1 - make_dir() { mode=$1 @@ -121,11 +122,12 @@ cd /sys; echo * make_dir 00755 /bin make_dir 00755 /boot make_dir 00755 /dev -make_dir 00755 /proc -make_dir 01777 /tmp make_dir 00755 /etc # global non-constant configuration make_dir 00755 /etc-secret -make_dir 00755 /var +make_dir 00755 /home +make_dir 00755 /home/root +make_dir 00755 /mnt +make_dir 00755 /mnt/host make_dir 00755 /nix make_dir 00755 /nix/store make_dir 00755 /nix/var @@ -136,16 +138,18 @@ make_dir 00755 /nix/var/log make_dir 00755 /nix/var/log/nix make_dir 00755 /nixpkgs make_dir 00755 /nixpkgs/trunk -make_dir 00755 /mnt -make_dir 00755 /mnt/host -make_dir 00755 /home -make_dir 00755 /home/root +make_dir 00755 /proc +make_dir 00755 /sbin +make_dir 01777 /tmp +make_dir 00755 /usr +make_dir 00755 /var ## ## Add a few devices to /dev on the install disk. This is by far complete. ## mknod $root/dev/null c 1 3 +mknod -m 0600 $root/dev/console c 5 1 touch_file /etc/passwd touch_file /etc/shadow @@ -232,11 +236,11 @@ unset NIX_CONF_DIR echo copying store -(while read storepaths; do - cp -fa $storepaths $root/nix/store -done) < /cdrom/mystorepaths +#(while read storepaths; do + #cp -fa $storepaths $root/nix/store +#done) < /cdrom/mystorepaths -#cp -fa ../nix/store/* $root/nix/store +cp -fa /nix/store/* $root/nix/store #echo registering valid paths... #(while read storepath; do @@ -274,7 +278,16 @@ rm -f $root/etc/hosts echo "127.0.0.1 localhost" >> $root/etc/hosts echo "192.168.150.1 uml" >> $root/etc/hosts + ### ### Do funky stuff with grub here. ### +ln -s @kernel@/vmlinuz /tmp/mnt/boot/vmlinuz +ln -s @sysvinitPath@/sbin/init /tmp/mnt/sbin/init + +grub-install --root-directory=/tmp/mnt --no-floppy ${targetdrive} + +echo install done +telinit 0 + diff --git a/init/default.nix b/init/default.nix index 9c7a468efe1..fae29176468 100644 --- a/init/default.nix +++ b/init/default.nix @@ -1,4 +1,4 @@ -{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grub, parted, modutils}: +{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grubWrapper, parted, modutils}: derivation { name = "init"; @@ -7,5 +7,5 @@ derivation { stage1 = ./prepare-disk.sh; stage2 = ./install-disk.sh; inherit stdenv bash coreutils utillinux e2fsprogs nix shadowutils - mingetty grub parted modutils; + mingetty grubWrapper parted modutils; } diff --git a/make-disk.sh b/make-disk.sh index 73919434889..432585cf871 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -25,10 +25,10 @@ storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiat #$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) # Location of sysvinit? -sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -)) +sysvinitPath=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -)) # Location of Nix boot scripts? -bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -)) +bootPath=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -)) nix=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) @@ -47,6 +47,12 @@ utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.ni coreUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -))) e2fsProgs=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -))) modUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).modutils' | $NIX_CMD_PATH/nix-instantiate -))) +Grub=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -))) +#gnuSed=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX_CMD_PATH/nix-instantiate -))) +#gnuGrep=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -))) +Kernel=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -))) +SysVinit=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -))) +BootPath=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -))) bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)) coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -)) @@ -54,7 +60,9 @@ findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutils' | utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)) e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -)) modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).modutils' | $NIX_CMD_PATH/nix-instantiate -)) -grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grub' | $NIX_CMD_PATH/nix-instantiate -)) +grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -)) +#gnused=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX_CMD_PATH/nix-instantiate -)) +#gnugrep=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -)) (while read storepath; do cp -fa --parents ${storepath} ${archivesDir} @@ -95,9 +103,16 @@ cp -fa ${nixpkgs} ${archivesDir} echo copying packges from store +echo GRUB ${Grub} + #cp -fa --parents ${nixDeps} ${archivesDir} cp -fau --parents ${utilLinux} ${archivesDir} -#cp -fau --parents ${kernel} ${archivesDir} +cp -fau --parents ${Grub} ${archivesDir} +#cp -fau --parents ${gnuSed} ${archivesDir} +#cp -fau --parents ${gnuGrep} ${archivesDir} +cp -fau --parents ${Kernel} ${archivesDir} +cp -fau --parents ${SysVinit} ${archivesDir} +cp -fau --parents ${BootPath} ${archivesDir} bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))) @@ -115,6 +130,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@e2fsprogs\@^$e2fsprogs^g" \ -e "s^@modutils\@^$modutils^g" \ -e "s^@grub\@^$grub^g" \ + -e "s^@kernel\@^$kernel^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk @@ -141,7 +157,7 @@ echo creating ramdisk rm -f ${initrd} cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init -cp ${bash}/bin/* ${initdir}/bin +ln -s ${bash}/bin/bash ${initdir}/bin/sh chmod u+x ${initdir}/init cp -fau --parents ${bashdeps} ${initdir} cp -fau --parents ${utilLinux} ${initdir} @@ -152,7 +168,6 @@ cp -fau --parents ${modUtils} ${initdir} touch ${initdir}/NIXOS (cd ${initdir}; find . |cpio -c -o) | gzip -9 > ${initrd} -#(cd ${archivesDir}/initdir; find . |cpio -c -o) | gzip -9 > ${initrd} cp ${initrd} ${archivesDir}/isolinux @@ -162,4 +177,7 @@ mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin -c isolinux/boot.cat \ -no-emul-boot -boot-load-size 4 -boot-info-table \ ${archivesDir} -echo ${kernel} +# cleanup, be diskspace friendly +rm -f ${initrd} +chmod -f -R +w ${archivesDir}/* +rm -rf ${archivesDir}/* diff --git a/pkgs.nix b/pkgs.nix index 6fae9f65ca3..b530a8b00cd 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -3,15 +3,15 @@ rec { stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip - mingetty grub syslinux parted modutils; + mingetty grubWrapper syslinux parted modutils; boot = (import ./boot) {inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl - gnused gnutar gnugrep gzip mingetty grub parted modutils;}; + gnused gnutar gnugrep gzip mingetty grubWrapper parted modutils;}; init = (import ./init) {inherit stdenv bash coreutils - utillinux e2fsprogs nix shadowutils mingetty grub parted modutils;}; + utillinux e2fsprogs nix shadowutils mingetty grubWrapper parted modutils;}; everything = [boot init sysvinit kernel]; } -- GitLab From ea3b3356ba12fe737691fac446f2487f27295978 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 14 Aug 2005 13:50:29 +0000 Subject: [PATCH 0055/5331] add right devices in /dev NixOS now boots, but mounts the filesystem read-only, filesystem is dirty, etc. svn path=/nixu/trunk/; revision=3579 --- fill-disk.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fill-disk.sh b/fill-disk.sh index 7d1ce76d31b..be9dc847c24 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -150,6 +150,9 @@ make_dir 00755 /var mknod $root/dev/null c 1 3 mknod -m 0600 $root/dev/console c 5 1 +mknod -m 0600 $root/dev/tty c 5 0 +mknod -m 0600 $root/dev/tty0 c 4 0 +mknod -m 0600 $root/dev/tty1 c 4 1 touch_file /etc/passwd touch_file /etc/shadow @@ -266,7 +269,7 @@ rm -f $root/etc/inittab echo "id:2:initdefault:" >> $root/etc/inittab echo "si::bootwait:$bootPath/bin/boot.sh" >> $root/etc/inittab echo "ht:06:wait:$bootPath/bin/halt.sh" >> $root/etc/inittab -echo "1:2345:respawn:$bootPath/bin/login.sh /dev/ttys/0" >> $root/etc/inittab +echo "1:2345:respawn:$bootPath/bin/login.sh /dev/tty1" >> $root/etc/inittab #echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab echo setting up networking information... -- GitLab From 08ad69d2dc6ddc545bf40338f39fa739725456d8 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 14 Aug 2005 14:34:46 +0000 Subject: [PATCH 0056/5331] some cleanups: - umount the filesystem after installing (so it's clean) - some hardcoded paths gone - svn path=/nixu/trunk/; revision=3581 --- fill-disk.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index be9dc847c24..170504b7501 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -109,9 +109,9 @@ touch_file() { } root=/tmp/mnt -mkdir -p /tmp/mnt +mkdir -p $root -mount -t ext2 $device /tmp/mnt +mount -t ext2 $device $root cd /sys; echo * @@ -140,6 +140,7 @@ make_dir 00755 /nixpkgs make_dir 00755 /nixpkgs/trunk make_dir 00755 /proc make_dir 00755 /sbin +make_dir 00755 /sys make_dir 01777 /tmp make_dir 00755 /usr make_dir 00755 /var @@ -286,11 +287,16 @@ echo "192.168.150.1 uml" >> $root/etc/hosts ### Do funky stuff with grub here. ### -ln -s @kernel@/vmlinuz /tmp/mnt/boot/vmlinuz -ln -s @sysvinitPath@/sbin/init /tmp/mnt/sbin/init +ln -s @kernel@/vmlinuz $root/boot/vmlinuz +ln -s @sysvinitPath@/sbin/init $root/sbin/init -grub-install --root-directory=/tmp/mnt --no-floppy ${targetdrive} +echo installing bootloader + +grub-install --root-directory=${root} --no-floppy ${targetdrive} + +echo umounting filesystem + +umount $root echo install done telinit 0 - -- GitLab From 597f96352865e4394d7782dd495919526d98a4a9 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 14 Aug 2005 15:08:15 +0000 Subject: [PATCH 0057/5331] more cleanups - remove some debugging code - add better descriptions for a few actions svn path=/nixu/trunk/; revision=3582 --- fill-disk.sh | 25 +++++++++++++------------ make-disk.sh | 2 -- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 170504b7501..f6ecda9d3e0 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -8,12 +8,16 @@ sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ modutils=@modutils@ +echo mounting special filesystems + mount -t proc proc /proc mount -t sysfs sys /sys # make a complete /dev filesystem # ripped permissions and everything from anaconda (loader2/devices.h) +echo making device nodes + # consoles #mknod -m 0600 /dev/console c 5 1 @@ -75,9 +79,6 @@ mknod -m 0660 /dev/hdd3 b 22 67 mknod -m 0600 /dev/initctl p -echo "dev" -cd /dev; echo * - targetdrive=/dev/hda device=${targetdrive}1 mkfs.ext2 ${device} @@ -111,14 +112,16 @@ root=/tmp/mnt mkdir -p $root -mount -t ext2 $device $root +echo mounting the target drive -cd /sys; echo * +mount -t ext2 $device $root ## ## Create a directory tree on the installation disk. ## +echo creating file system hierarchy on target drive + make_dir 00755 /bin make_dir 00755 /boot make_dir 00755 /dev @@ -149,6 +152,8 @@ make_dir 00755 /var ## Add a few devices to /dev on the install disk. This is by far complete. ## +echo making device nodes on target drive + mknod $root/dev/null c 1 3 mknod -m 0600 $root/dev/console c 5 1 mknod -m 0600 $root/dev/tty c 5 0 @@ -162,7 +167,7 @@ touch_file /etc/group rm -f $root/etc/mtab #ln -s /proc/mounts $root/etc/mtab -cat /proc/mounts +#cat /proc/mounts ## Probe for CD device which contains our CD here and mount /nix and ## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this. @@ -173,8 +178,6 @@ cat /proc/mounts DEVICES="/dev/hd?" -echo devices ${DEVICES} - for i in ${DEVICES} do echo "Looking for CDROM in: $i" @@ -192,11 +195,8 @@ fi fi done -echo cddevice ${cddevice} +echo switch to /nix and /nixpkgs from CD -#echo path $PATH -ls -l @coreutils@/bin/l* -#rm -rf /nix ln -s /cdrom/nixpkgs /nixpkgs mount --bind /cdrom/nix /nix @@ -224,6 +224,7 @@ cp -fa /cdrom/scripts $root/tmp #$NIX_CMD_PATH/nix-pull $manifest echo adding packages + export NIX_ROOT=$root unset NIX_DATA_DIR unset NIX_LOG_DIR diff --git a/make-disk.sh b/make-disk.sh index 432585cf871..b94aac69846 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -103,8 +103,6 @@ cp -fa ${nixpkgs} ${archivesDir} echo copying packges from store -echo GRUB ${Grub} - #cp -fa --parents ${nixDeps} ${archivesDir} cp -fau --parents ${utilLinux} ${archivesDir} cp -fau --parents ${Grub} ${archivesDir} -- GitLab From 2389fc5bef70c5ba95e732f135f2135848cedfd1 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 15 Aug 2005 17:02:54 +0000 Subject: [PATCH 0058/5331] copy /nixpkgs contents instead of just the link (fixes NIXOS-9) svn path=/nixu/trunk/; revision=3586 --- fill-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fill-disk.sh b/fill-disk.sh index f6ecda9d3e0..9b64544bfa3 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -215,7 +215,7 @@ echo verifying Nix DB... $NIX_CMD_PATH/nix-store --verify echo copying nixpkgs... -cp -fa /nixpkgs $root/nixpkgs/trunk +cp -fLa /nixpkgs $root/nixpkgs/trunk make_dir 0755 /tmp/scripts cp -fa /cdrom/scripts $root/tmp -- GitLab From e8f7642f096f7d193fdf9f1bad98b0864957c45c Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 16 Aug 2005 18:32:08 +0000 Subject: [PATCH 0059/5331] fix copying bug for real svn path=/nixu/trunk/; revision=3588 --- fill-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fill-disk.sh b/fill-disk.sh index 9b64544bfa3..160822a5597 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -215,7 +215,7 @@ echo verifying Nix DB... $NIX_CMD_PATH/nix-store --verify echo copying nixpkgs... -cp -fLa /nixpkgs $root/nixpkgs/trunk +cp -fLa /cdrom/pkgs $root/nixpkgs/trunk make_dir 0755 /tmp/scripts cp -fa /cdrom/scripts $root/tmp -- GitLab From 91b9cabf9bbf7aeb7107932145c401b186fe78c8 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 16 Aug 2005 18:58:23 +0000 Subject: [PATCH 0060/5331] svn export nixpkgs, don't copy it (gets rid of about 34 MB) svn path=/nixu/trunk/; revision=3589 --- make-disk.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/make-disk.sh b/make-disk.sh index b94aac69846..6e85a1138ac 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -99,7 +99,8 @@ mkdir ${initdir}/var echo copying nixpkgs -cp -fa ${nixpkgs} ${archivesDir} +svn export ${nixpkgs} ${archivesDir}/pkgs +#cp -fa ${nixpkgs} ${archivesDir} echo copying packges from store -- GitLab From 38cb12017a7b8c23239539ff538277288201272b Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 16 Aug 2005 21:46:08 +0000 Subject: [PATCH 0061/5331] fix typo, add some more echo statements, minor cleanup svn path=/nixu/trunk/; revision=3591 --- make-disk.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index 6e85a1138ac..3384e78e742 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -10,10 +10,11 @@ fill_disk=$archivesDir/scripts/fill-disk.sh storePaths=$archivesDir/mystorepaths validatePaths=$archivesDir/validatepaths bootiso=/tmp/nixos.iso -#initrd=/tmp/initrd.img initrd=/tmp/initram.img initdir=${archivesDir}/initdir +echo cleaning old build + # keep chmod happy touch ${archivesDir}/blah chmod -f -R +w ${archivesDir}/* @@ -102,7 +103,7 @@ echo copying nixpkgs svn export ${nixpkgs} ${archivesDir}/pkgs #cp -fa ${nixpkgs} ${archivesDir} -echo copying packges from store +echo copying packages from store #cp -fa --parents ${nixDeps} ${archivesDir} cp -fau --parents ${utilLinux} ${archivesDir} @@ -177,6 +178,9 @@ mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin -c isolinux/boot.cat \ ${archivesDir} # cleanup, be diskspace friendly + +echo cleaning up + rm -f ${initrd} chmod -f -R +w ${archivesDir}/* rm -rf ${archivesDir}/* -- GitLab From 0b4feb3a6c50bbbb1c119f39e9d44e26cc1a691d Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 17 Aug 2005 19:19:54 +0000 Subject: [PATCH 0062/5331] add hotplug here, temporarily disable e2fsck, so at least everything is mounted rw svn path=/nixu/trunk/; revision=3630 --- boot/boot.sh | 4 ++-- boot/default.nix | 2 +- fill-disk.sh | 5 +++++ init/default.nix | 2 +- make-disk.sh | 4 ++++ pkgs.nix | 6 +++--- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/boot/boot.sh b/boot/boot.sh index a6ce1f2d67a..0ef72d9907e 100644 --- a/boot/boot.sh +++ b/boot/boot.sh @@ -9,8 +9,8 @@ echo "--- Nix ---" echo "mounting /proc..." mount -n -t proc none /proc -echo "checking /dev/root..." -e2fsck -y /dev/root || test "$?" -le 1 +#echo "checking /dev/root..." +#e2fsck -y /dev/root || test "$?" -le 1 echo "remounting / writable..." mount -n -o remount,rw /dev/root / diff --git a/boot/default.nix b/boot/default.nix index 3724660ae22..315fab0e18d 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,7 +1,7 @@ { stdenv, kernel, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep -, gnutar, gzip, mingetty, grubWrapper, parted, modutils}: +, gnutar, gzip, mingetty, grubWrapper, parted, modutils, hotplug}: derivation { name = "boot"; diff --git a/fill-disk.sh b/fill-disk.sh index 160822a5597..17e6dd42d04 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -7,6 +7,7 @@ kernel=@kernel@ sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ modutils=@modutils@ +hotplug=@hotplug@ echo mounting special filesystems @@ -290,6 +291,10 @@ echo "192.168.150.1 uml" >> $root/etc/hosts ln -s @kernel@/vmlinuz $root/boot/vmlinuz ln -s @sysvinitPath@/sbin/init $root/sbin/init +ln -s @hotplug@/sbin/hotplug $root/sbin/hotplug +ln -s @hotplug@/etc/hotplug $root/etc/hotplug +ln -s @hotplug@/etc/hotplug.d $root/etc/hotplug.d +ln -s $device $root/dev/root echo installing bootloader diff --git a/init/default.nix b/init/default.nix index fae29176468..fbb983cba2d 100644 --- a/init/default.nix +++ b/init/default.nix @@ -1,4 +1,4 @@ -{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grubWrapper, parted, modutils}: +{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grubWrapper, parted, modutils, hotplug}: derivation { name = "init"; diff --git a/make-disk.sh b/make-disk.sh index 3384e78e742..4767e220acb 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -62,6 +62,7 @@ utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -)) modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).modutils' | $NIX_CMD_PATH/nix-instantiate -)) grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -)) +hotplug=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).hotplug' | $NIX_CMD_PATH/nix-instantiate -)) #gnused=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX_CMD_PATH/nix-instantiate -)) #gnugrep=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -)) @@ -113,6 +114,7 @@ cp -fau --parents ${Grub} ${archivesDir} cp -fau --parents ${Kernel} ${archivesDir} cp -fau --parents ${SysVinit} ${archivesDir} cp -fau --parents ${BootPath} ${archivesDir} +cp -fau --parents ${hotplug} ${archivesDir} bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))) @@ -131,6 +133,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@modutils\@^$modutils^g" \ -e "s^@grub\@^$grub^g" \ -e "s^@kernel\@^$kernel^g" \ + -e "s^@hotplug\@^$hotplug^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk @@ -164,6 +167,7 @@ cp -fau --parents ${utilLinux} ${initdir} cp -fau --parents ${coreUtils} ${initdir} cp -fau --parents ${e2fsProgs} ${initdir} cp -fau --parents ${modUtils} ${initdir} +cp -fau --parents ${hotplug} ${initdir} touch ${initdir}/NIXOS diff --git a/pkgs.nix b/pkgs.nix index b530a8b00cd..f380bedc125 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -3,15 +3,15 @@ rec { stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip - mingetty grubWrapper syslinux parted modutils; + mingetty grubWrapper syslinux parted modutils hotplug; boot = (import ./boot) {inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl - gnused gnutar gnugrep gzip mingetty grubWrapper parted modutils;}; + gnused gnutar gnugrep gzip mingetty grubWrapper parted modutils hotplug;}; init = (import ./init) {inherit stdenv bash coreutils - utillinux e2fsprogs nix shadowutils mingetty grubWrapper parted modutils;}; + utillinux e2fsprogs nix shadowutils mingetty grubWrapper parted modutils hotplug;}; everything = [boot init sysvinit kernel]; } -- GitLab From 26ccf579e03b4e9455bc7a74eb1dc3e415225416 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 17 Aug 2005 20:51:19 +0000 Subject: [PATCH 0063/5331] ssh wants /dev/urandom (or /dev/random, but urandom works too) svn path=/nixu/trunk/; revision=3631 --- fill-disk.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/fill-disk.sh b/fill-disk.sh index 17e6dd42d04..94fe3a30a4e 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -160,6 +160,7 @@ mknod -m 0600 $root/dev/console c 5 1 mknod -m 0600 $root/dev/tty c 5 0 mknod -m 0600 $root/dev/tty0 c 4 0 mknod -m 0600 $root/dev/tty1 c 4 1 +mknod -m 0444 $root/dev/urandom c 1 9 touch_file /etc/passwd touch_file /etc/shadow -- GitLab From 9a29f7097711e89115fff6469dc7b57e6a5ace2f Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 18 Aug 2005 22:55:27 +0000 Subject: [PATCH 0064/5331] mount sysfs at boottime svn path=/nixu/trunk/; revision=3635 --- boot/boot.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/boot/boot.sh b/boot/boot.sh index 0ef72d9907e..03cd14066b6 100644 --- a/boot/boot.sh +++ b/boot/boot.sh @@ -9,6 +9,9 @@ echo "--- Nix ---" echo "mounting /proc..." mount -n -t proc none /proc +echo "mounting /sys..." +mount -n -t sysfs none /sys + #echo "checking /dev/root..." #e2fsck -y /dev/root || test "$?" -le 1 -- GitLab From b39fca2ade8b92e91c1afda775e3ed3fbfd4d58d Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 19 Aug 2005 15:26:01 +0000 Subject: [PATCH 0065/5331] - add udev (not yet in use) - clean up 100 MB of unused stuff on the CD svn path=/nixu/trunk/; revision=3637 --- boot/default.nix | 4 ++-- make-disk.sh | 7 +++++-- pkgs.nix | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/boot/default.nix b/boot/default.nix index 315fab0e18d..78c7c39c924 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,7 +1,7 @@ { stdenv, kernel, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep -, gnutar, gzip, mingetty, grubWrapper, parted, modutils, hotplug}: +, gnutar, gzip, mingetty, grubWrapper, parted, modutils, hotplug, udev}: derivation { name = "boot"; @@ -14,5 +14,5 @@ derivation { inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused - gnutar gnugrep gzip mingetty grubWrapper parted modutils; + gnutar gnugrep gzip mingetty grubWrapper parted modutils udev; } diff --git a/make-disk.sh b/make-disk.sh index 4767e220acb..3218fc8007d 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -63,8 +63,7 @@ e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).modutils' | $NIX_CMD_PATH/nix-instantiate -)) grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -)) hotplug=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).hotplug' | $NIX_CMD_PATH/nix-instantiate -)) -#gnused=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX_CMD_PATH/nix-instantiate -)) -#gnugrep=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -)) +udev=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).udev' | $NIX_CMD_PATH/nix-instantiate -)) (while read storepath; do cp -fa --parents ${storepath} ${archivesDir} @@ -115,6 +114,7 @@ cp -fau --parents ${Kernel} ${archivesDir} cp -fau --parents ${SysVinit} ${archivesDir} cp -fau --parents ${BootPath} ${archivesDir} cp -fau --parents ${hotplug} ${archivesDir} +cp -fau --parents ${udev} ${archivesDir} bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))) @@ -173,6 +173,9 @@ touch ${initdir}/NIXOS (cd ${initdir}; find . |cpio -c -o) | gzip -9 > ${initrd} +chmod -f -R +w ${initdir}/* +rm -rf ${initdir} + cp ${initrd} ${archivesDir}/isolinux echo creating ISO image diff --git a/pkgs.nix b/pkgs.nix index f380bedc125..7d5d568cb93 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -3,12 +3,12 @@ rec { stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip - mingetty grubWrapper syslinux parted modutils hotplug; + mingetty grubWrapper syslinux parted modutils hotplug udev; boot = (import ./boot) {inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl - gnused gnutar gnugrep gzip mingetty grubWrapper parted modutils hotplug;}; + gnused gnutar gnugrep gzip mingetty grubWrapper parted modutils hotplug udev;}; init = (import ./init) {inherit stdenv bash coreutils utillinux e2fsprogs nix shadowutils mingetty grubWrapper parted modutils hotplug;}; -- GitLab From 30196b92434692707d649798fb201aa5ba3c3922 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 19 Aug 2005 16:09:31 +0000 Subject: [PATCH 0066/5331] incorporate udev in the boot scripts. Now we have loads of devices :) svn path=/nixu/trunk/; revision=3638 --- boot/boot.sh | 4 ++-- boot/builder.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/boot/boot.sh b/boot/boot.sh index 03cd14066b6..1589ba796e1 100644 --- a/boot/boot.sh +++ b/boot/boot.sh @@ -18,8 +18,8 @@ mount -n -t sysfs none /sys echo "remounting / writable..." mount -n -o remount,rw /dev/root / -echo "mounting /mnt/host..." -mount -n -t hostfs none /mnt/host +echo "starting udev..." +@udev@/sbin/udevstart echo "setting up hostname..." hostname uml diff --git a/boot/builder.sh b/boot/builder.sh index 5ebfadcbcf7..4b637748ade 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -36,6 +36,7 @@ for i in $boot $halt $login $env; do -e "s^@gcc\@^$gcc^g" \ -e "s^@mingetty\@^$mingetty^g" \ -e "s^@grub\@^$grub^g" \ + -e "s^@udev\@^$udev^g" \ -e "s^@out\@^$out^g" \ < $i > $dst chmod +x $dst -- GitLab From 49cd9fae36c8397ba917f52bc2e3564d0b614d5a Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 19 Aug 2005 22:39:48 +0000 Subject: [PATCH 0067/5331] make /lib/modules svn path=/nixu/trunk/; revision=3643 --- fill-disk.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fill-disk.sh b/fill-disk.sh index 94fe3a30a4e..218260caf6c 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -130,6 +130,8 @@ make_dir 00755 /etc # global non-constant configuration make_dir 00755 /etc-secret make_dir 00755 /home make_dir 00755 /home/root +make_dir 00755 /lib +make_dir 00755 /lib/modules make_dir 00755 /mnt make_dir 00755 /mnt/host make_dir 00755 /nix -- GitLab From 6e7614fdb0d9a4896b9041ab69656fb917804df9 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sat, 20 Aug 2005 21:49:53 +0000 Subject: [PATCH 0068/5331] use module-init-tools instead of modutils. Now we can insert modules :) svn path=/nixu/trunk/; revision=3650 --- boot/builder.sh | 1 + boot/default.nix | 4 ++-- boot/env.sh | 2 +- fill-disk.sh | 15 +++++++++++++++ init/default.nix | 4 ++-- make-disk.sh | 4 ++-- pkgs.nix | 6 +++--- 7 files changed, 26 insertions(+), 10 deletions(-) diff --git a/boot/builder.sh b/boot/builder.sh index 4b637748ade..ae2fdbf32b6 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -35,6 +35,7 @@ for i in $boot $halt $login $env; do -e "s^@gzip\@^$gzip^g" \ -e "s^@gcc\@^$gcc^g" \ -e "s^@mingetty\@^$mingetty^g" \ + -e "s^@module_init_tools\@^$module_init_tools^g" \ -e "s^@grub\@^$grub^g" \ -e "s^@udev\@^$udev^g" \ -e "s^@out\@^$out^g" \ diff --git a/boot/default.nix b/boot/default.nix index 78c7c39c924..0bfc2517361 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,7 +1,7 @@ { stdenv, kernel, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep -, gnutar, gzip, mingetty, grubWrapper, parted, modutils, hotplug, udev}: +, gnutar, gzip, mingetty, grubWrapper, parted, module_init_tools, hotplug, udev}: derivation { name = "boot"; @@ -14,5 +14,5 @@ derivation { inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused - gnutar gnugrep gzip mingetty grubWrapper parted modutils udev; + gnutar gnugrep gzip mingetty grubWrapper parted module_init_tools udev; } diff --git a/boot/env.sh b/boot/env.sh index 6ec13130b66..8366f534213 100644 --- a/boot/env.sh +++ b/boot/env.sh @@ -1 +1 @@ -export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingetty@/sbin:@grub@/bin:@grub@/sbin +export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingetty@/sbin:@grub@/bin:@grub@/sbin:@module_init_tools@/sbin diff --git a/fill-disk.sh b/fill-disk.sh index 218260caf6c..50c335ccc4d 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -150,6 +150,11 @@ make_dir 00755 /sys make_dir 01777 /tmp make_dir 00755 /usr make_dir 00755 /var +make_dir 00755 /var/log +make_dir 00755 /var/run +make_dir 00755 /var/spool +make_dir 00755 /var/state +make_dir 00755 /var/tmp ## ## Add a few devices to /dev on the install disk. This is by far complete. @@ -287,6 +292,16 @@ rm -f $root/etc/hosts echo "127.0.0.1 localhost" >> $root/etc/hosts echo "192.168.150.1 uml" >> $root/etc/hosts +### +### Do kernel stuff here. +### +strippedName=$(basename @kernel@); +if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then + strippedName=$(echo "$strippedName" | cut -c34-) +fi + +echo "stripped" $strippedName + ### ### Do funky stuff with grub here. diff --git a/init/default.nix b/init/default.nix index fbb983cba2d..39f8586f7eb 100644 --- a/init/default.nix +++ b/init/default.nix @@ -1,4 +1,4 @@ -{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grubWrapper, parted, modutils, hotplug}: +{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grubWrapper, parted, module_init_tools, hotplug}: derivation { name = "init"; @@ -7,5 +7,5 @@ derivation { stage1 = ./prepare-disk.sh; stage2 = ./install-disk.sh; inherit stdenv bash coreutils utillinux e2fsprogs nix shadowutils - mingetty grubWrapper parted modutils; + mingetty grubWrapper parted module_init_tools; } diff --git a/make-disk.sh b/make-disk.sh index 3218fc8007d..588f031d3dc 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -47,7 +47,7 @@ echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).ni utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))) coreUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -))) e2fsProgs=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -))) -modUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).modutils' | $NIX_CMD_PATH/nix-instantiate -))) +modUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).module_init_tools' | $NIX_CMD_PATH/nix-instantiate -))) Grub=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -))) #gnuSed=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX_CMD_PATH/nix-instantiate -))) #gnuGrep=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -))) @@ -60,7 +60,7 @@ coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutils' | $NIX_CMD_PATH/nix-instantiate -)) utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)) e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -)) -modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).modutils' | $NIX_CMD_PATH/nix-instantiate -)) +modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).module_init_tools' | $NIX_CMD_PATH/nix-instantiate -)) grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -)) hotplug=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).hotplug' | $NIX_CMD_PATH/nix-instantiate -)) udev=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).udev' | $NIX_CMD_PATH/nix-instantiate -)) diff --git a/pkgs.nix b/pkgs.nix index 7d5d568cb93..5a5065bcfe9 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -3,15 +3,15 @@ rec { stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip - mingetty grubWrapper syslinux parted modutils hotplug udev; + mingetty grubWrapper syslinux parted module_init_tools hotplug udev; boot = (import ./boot) {inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl - gnused gnutar gnugrep gzip mingetty grubWrapper parted modutils hotplug udev;}; + gnused gnutar gnugrep gzip mingetty grubWrapper parted module_init_tools hotplug udev;}; init = (import ./init) {inherit stdenv bash coreutils - utillinux e2fsprogs nix shadowutils mingetty grubWrapper parted modutils hotplug;}; + utillinux e2fsprogs nix shadowutils mingetty grubWrapper parted module_init_tools hotplug;}; everything = [boot init sysvinit kernel]; } -- GitLab From 4c6230b0a6c7e9d52cc8869c2a6c72f198189455 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 21 Aug 2005 17:39:47 +0000 Subject: [PATCH 0069/5331] add dhcp package. This doesn't work quite nicely though, needs some resolving... svn path=/nixu/trunk/; revision=3653 --- boot/builder.sh | 1 + boot/default.nix | 6 ++++-- boot/env.sh | 2 +- fill-disk.sh | 12 +++++++++--- init/default.nix | 4 ++-- make-disk.sh | 2 ++ pkgs.nix | 11 +++++++---- 7 files changed, 26 insertions(+), 12 deletions(-) diff --git a/boot/builder.sh b/boot/builder.sh index ae2fdbf32b6..679b18b514a 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -38,6 +38,7 @@ for i in $boot $halt $login $env; do -e "s^@module_init_tools\@^$module_init_tools^g" \ -e "s^@grub\@^$grub^g" \ -e "s^@udev\@^$udev^g" \ + -e "s^@dhcp\@^$dhcp^g" \ -e "s^@out\@^$out^g" \ < $i > $dst chmod +x $dst diff --git a/boot/default.nix b/boot/default.nix index 0bfc2517361..28661278cb3 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,7 +1,8 @@ { stdenv, kernel, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep -, gnutar, gzip, mingetty, grubWrapper, parted, module_init_tools, hotplug, udev}: +, gnutar, gzip, mingetty, grubWrapper, parted, module_init_tools, hotplug +, udev, dhcp}: derivation { name = "boot"; @@ -14,5 +15,6 @@ derivation { inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused - gnutar gnugrep gzip mingetty grubWrapper parted module_init_tools udev; + gnutar gnugrep gzip mingetty grubWrapper parted module_init_tools + udev dhcp; } diff --git a/boot/env.sh b/boot/env.sh index 8366f534213..7564e350d36 100644 --- a/boot/env.sh +++ b/boot/env.sh @@ -1 +1 @@ -export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingetty@/sbin:@grub@/bin:@grub@/sbin:@module_init_tools@/sbin +export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingetty@/sbin:@grub@/bin:@grub@/sbin:@module_init_tools@/sbin:@dhcp@/sbin diff --git a/fill-disk.sh b/fill-disk.sh index 50c335ccc4d..ab8eda71fb1 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -169,9 +169,9 @@ mknod -m 0600 $root/dev/tty0 c 4 0 mknod -m 0600 $root/dev/tty1 c 4 1 mknod -m 0444 $root/dev/urandom c 1 9 -touch_file /etc/passwd -touch_file /etc/shadow -touch_file /etc/group +#touch_file /etc/passwd +#touch_file /etc/shadow +#touch_file /etc/group rm -f $root/etc/mtab #ln -s /proc/mounts $root/etc/mtab @@ -292,6 +292,12 @@ rm -f $root/etc/hosts echo "127.0.0.1 localhost" >> $root/etc/hosts echo "192.168.150.1 uml" >> $root/etc/hosts +echo setting up initial account information... + +echo "root:x:0:root" > $root/etc/group +echo "root:x:0:0:root:/root:/bin/sh" > $root/etc/passwd +echo "root::12757:0:99999:7:::" > $root/etc/shadow + ### ### Do kernel stuff here. ### diff --git a/init/default.nix b/init/default.nix index 39f8586f7eb..92c34794287 100644 --- a/init/default.nix +++ b/init/default.nix @@ -1,4 +1,4 @@ -{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grubWrapper, parted, module_init_tools, hotplug}: +{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grubWrapper, parted, module_init_tools, hotplug, dhcp}: derivation { name = "init"; @@ -7,5 +7,5 @@ derivation { stage1 = ./prepare-disk.sh; stage2 = ./install-disk.sh; inherit stdenv bash coreutils utillinux e2fsprogs nix shadowutils - mingetty grubWrapper parted module_init_tools; + mingetty grubWrapper parted module_init_tools dhcp; } diff --git a/make-disk.sh b/make-disk.sh index 588f031d3dc..eb46887a91f 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -64,6 +64,7 @@ modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).module_init_to grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -)) hotplug=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).hotplug' | $NIX_CMD_PATH/nix-instantiate -)) udev=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).udev' | $NIX_CMD_PATH/nix-instantiate -)) +dhcp=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).dhcp' | $NIX_CMD_PATH/nix-instantiate -)) (while read storepath; do cp -fa --parents ${storepath} ${archivesDir} @@ -115,6 +116,7 @@ cp -fau --parents ${SysVinit} ${archivesDir} cp -fau --parents ${BootPath} ${archivesDir} cp -fau --parents ${hotplug} ${archivesDir} cp -fau --parents ${udev} ${archivesDir} +cp -fau --parents ${dhcp} ${archivesDir} bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))) diff --git a/pkgs.nix b/pkgs.nix index 5a5065bcfe9..a127d31b29a 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -3,15 +3,18 @@ rec { stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip - mingetty grubWrapper syslinux parted module_init_tools hotplug udev; + mingetty grubWrapper syslinux parted module_init_tools hotplug udev + dhcp; boot = (import ./boot) {inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl - gnused gnutar gnugrep gzip mingetty grubWrapper parted module_init_tools hotplug udev;}; + gnused gnutar gnugrep gzip mingetty grubWrapper parted module_init_tools + hotplug udev dhcp;}; - init = (import ./init) {inherit stdenv bash coreutils - utillinux e2fsprogs nix shadowutils mingetty grubWrapper parted module_init_tools hotplug;}; + init = (import ./init) {inherit stdenv bash coreutils utillinux e2fsprogs + nix shadowutils mingetty grubWrapper parted module_init_tools hotplug + dhcp;}; everything = [boot init sysvinit kernel]; } -- GitLab From fb451cc09f741ec60d3a5ef756ea44c95e0cb213 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 21 Aug 2005 19:56:30 +0000 Subject: [PATCH 0070/5331] use the dhcp wrapper, add a directory needed for DHCP svn path=/nixu/trunk/; revision=3656 --- boot/builder.sh | 2 +- boot/default.nix | 4 ++-- boot/env.sh | 2 +- fill-disk.sh | 2 ++ init/default.nix | 4 ++-- make-disk.sh | 2 +- pkgs.nix | 6 +++--- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/boot/builder.sh b/boot/builder.sh index 679b18b514a..dce3250f090 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -38,7 +38,7 @@ for i in $boot $halt $login $env; do -e "s^@module_init_tools\@^$module_init_tools^g" \ -e "s^@grub\@^$grub^g" \ -e "s^@udev\@^$udev^g" \ - -e "s^@dhcp\@^$dhcp^g" \ + -e "s^@dhcpWrapper\@^$dhcpWrapper^g" \ -e "s^@out\@^$out^g" \ < $i > $dst chmod +x $dst diff --git a/boot/default.nix b/boot/default.nix index 28661278cb3..0827f59d7bd 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -2,7 +2,7 @@ , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep , gnutar, gzip, mingetty, grubWrapper, parted, module_init_tools, hotplug -, udev, dhcp}: +, udev, dhcpWrapper}: derivation { name = "boot"; @@ -16,5 +16,5 @@ derivation { e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingetty grubWrapper parted module_init_tools - udev dhcp; + udev dhcpWrapper; } diff --git a/boot/env.sh b/boot/env.sh index 7564e350d36..84b8e7c7b3a 100644 --- a/boot/env.sh +++ b/boot/env.sh @@ -1 +1 @@ -export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingetty@/sbin:@grub@/bin:@grub@/sbin:@module_init_tools@/sbin:@dhcp@/sbin +export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingetty@/sbin:@grub@/bin:@grub@/sbin:@module_init_tools@/sbin:@dhcpWrapper@/sbin diff --git a/fill-disk.sh b/fill-disk.sh index ab8eda71fb1..eab6d7ecaf2 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -154,6 +154,7 @@ make_dir 00755 /var/log make_dir 00755 /var/run make_dir 00755 /var/spool make_dir 00755 /var/state +make_dir 00755 /var/state/dhcp make_dir 00755 /var/tmp ## @@ -274,6 +275,7 @@ cp -fa /nix/store/* $root/nix/store echo setting init symlink... rm -f $root/init ln -s $sysvinitPath/sbin/init $root/init +ln -s $bash/bin/sh $root/bin/sh echo setting up inittab... rm -f $root/etc/inittab diff --git a/init/default.nix b/init/default.nix index 92c34794287..c81e75513cd 100644 --- a/init/default.nix +++ b/init/default.nix @@ -1,4 +1,4 @@ -{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grubWrapper, parted, module_init_tools, hotplug, dhcp}: +{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grubWrapper, parted, module_init_tools, hotplug, dhcpWrapper}: derivation { name = "init"; @@ -7,5 +7,5 @@ derivation { stage1 = ./prepare-disk.sh; stage2 = ./install-disk.sh; inherit stdenv bash coreutils utillinux e2fsprogs nix shadowutils - mingetty grubWrapper parted module_init_tools dhcp; + mingetty grubWrapper parted module_init_tools dhcpWrapper; } diff --git a/make-disk.sh b/make-disk.sh index eb46887a91f..ac626727b90 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -64,7 +64,7 @@ modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).module_init_to grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -)) hotplug=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).hotplug' | $NIX_CMD_PATH/nix-instantiate -)) udev=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).udev' | $NIX_CMD_PATH/nix-instantiate -)) -dhcp=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).dhcp' | $NIX_CMD_PATH/nix-instantiate -)) +dhcp=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX_CMD_PATH/nix-instantiate -)) (while read storepath; do cp -fa --parents ${storepath} ${archivesDir} diff --git a/pkgs.nix b/pkgs.nix index a127d31b29a..874548e01f2 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -4,17 +4,17 @@ rec { nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingetty grubWrapper syslinux parted module_init_tools hotplug udev - dhcp; + dhcpWrapper; boot = (import ./boot) {inherit stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingetty grubWrapper parted module_init_tools - hotplug udev dhcp;}; + hotplug udev dhcpWrapper;}; init = (import ./init) {inherit stdenv bash coreutils utillinux e2fsprogs nix shadowutils mingetty grubWrapper parted module_init_tools hotplug - dhcp;}; + dhcpWrapper;}; everything = [boot init sysvinit kernel]; } -- GitLab From f88a356cc6a0026fb8371d5c4a1bbe0ff9fbc868 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 21 Aug 2005 22:41:22 +0000 Subject: [PATCH 0071/5331] make correct symlink to /bin/sh and /bin/bash svn path=/nixu/trunk/; revision=3658 --- fill-disk.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fill-disk.sh b/fill-disk.sh index eab6d7ecaf2..8391eef8b82 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -275,7 +275,8 @@ cp -fa /nix/store/* $root/nix/store echo setting init symlink... rm -f $root/init ln -s $sysvinitPath/sbin/init $root/init -ln -s $bash/bin/sh $root/bin/sh +ln -s @bash@/bin/sh $root/bin/sh +ln -s @bash@/bin/bash $root/bin/bash echo setting up inittab... rm -f $root/etc/inittab -- GitLab From b1b5fdd7cd66310cdba8bc50303aff25533a493d Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 21 Aug 2005 23:15:24 +0000 Subject: [PATCH 0072/5331] change root homedir to /root instead of /home/root svn path=/nixu/trunk/; revision=3659 --- boot/login.sh | 2 +- fill-disk.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/boot/login.sh b/boot/login.sh index 9222b2aba13..14bb418bd9a 100644 --- a/boot/login.sh +++ b/boot/login.sh @@ -9,7 +9,7 @@ exec < $tty > $tty 2>&1 echo echo "=== Welcome to Nix! ===" -export HOME=/home/root +export HOME=/root cd $HOME exec @bash@/bin/sh diff --git a/fill-disk.sh b/fill-disk.sh index 8391eef8b82..84ace7b66d7 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -129,7 +129,6 @@ make_dir 00755 /dev make_dir 00755 /etc # global non-constant configuration make_dir 00755 /etc-secret make_dir 00755 /home -make_dir 00755 /home/root make_dir 00755 /lib make_dir 00755 /lib/modules make_dir 00755 /mnt @@ -145,6 +144,7 @@ make_dir 00755 /nix/var/log/nix make_dir 00755 /nixpkgs make_dir 00755 /nixpkgs/trunk make_dir 00755 /proc +make_dir 00750 /root make_dir 00755 /sbin make_dir 00755 /sys make_dir 01777 /tmp -- GitLab From fe90fce5d15f185251e27da8eae93d213ffb6116 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 22 Aug 2005 14:23:01 +0000 Subject: [PATCH 0073/5331] mount /dev/pts, zo we've got PTYs (for screen) svn path=/nixu/trunk/; revision=3661 --- boot/boot.sh | 3 +++ fill-disk.sh | 1 + 2 files changed, 4 insertions(+) diff --git a/boot/boot.sh b/boot/boot.sh index 1589ba796e1..6115bd988c1 100644 --- a/boot/boot.sh +++ b/boot/boot.sh @@ -12,6 +12,9 @@ mount -n -t proc none /proc echo "mounting /sys..." mount -n -t sysfs none /sys +echo "mounting /dev/pts..." +mount -n -t devpts none /dev/pts + #echo "checking /dev/root..." #e2fsck -y /dev/root || test "$?" -le 1 diff --git a/fill-disk.sh b/fill-disk.sh index 84ace7b66d7..9e7e11e4f2c 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -126,6 +126,7 @@ echo creating file system hierarchy on target drive make_dir 00755 /bin make_dir 00755 /boot make_dir 00755 /dev +make_dir 00755 /dev/pts make_dir 00755 /etc # global non-constant configuration make_dir 00755 /etc-secret make_dir 00755 /home -- GitLab From bc79eeb3b0face4bff7647f27dedb90466ce48fc Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 23 Aug 2005 10:53:20 +0000 Subject: [PATCH 0074/5331] add a dummy builder for init svn path=/nixu/trunk/; revision=3665 --- init/builder.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 init/builder.sh diff --git a/init/builder.sh b/init/builder.sh new file mode 100755 index 00000000000..15ba03d4780 --- /dev/null +++ b/init/builder.sh @@ -0,0 +1,42 @@ +#! /bin/sh -e + +. $stdenv/setup + +mkdir $out +mkdir $out/bin + +#for i in $boot $halt $login $env; do +# dst=$out/bin/$(basename $i | cut -c34-) +# sed \ +# -e "s^@bash\@^$bash^g" \ +# -e "s^@coreutils\@^$coreutils^g" \ +# -e "s^@findutils\@^$findutils^g" \ +# -e "s^@utillinux\@^$utillinux^g" \ +# -e "s^@sysvinit\@^$sysvinit^g" \ +# -e "s^@e2fsprogs\@^$e2fsprogs^g" \ +# -e "s^@nettools\@^$nettools^g" \ +# -e "s^@nix\@^$nix^g" \ +# -e "s^@wget\@^$wget^g" \ +# -e "s^@which\@^$which^g" \ +# -e "s^@subversion\@^$subversion^g" \ +# -e "s^@vim\@^$vim^g" \ +# -e "s^@screen\@^$screen^g" \ +# -e "s^@less\@^$less^g" \ +# -e "s^@openssh\@^$openssh^g" \ +# -e "s^@binutils\@^$binutils^g" \ +# -e "s^@strace\@^$strace^g" \ +# -e "s^@shadowutils\@^$shadowutils^g" \ +# -e "s^@iputils\@^$iputils^g" \ +# -e "s^@gnumake\@^$gnumake^g" \ +# -e "s^@curl\@^$curl^g" \ +# -e "s^@gnused\@^$gnused^g" \ +# -e "s^@gnutar\@^$gnutar^g" \ +# -e "s^@gnugrep\@^$gnugrep^g" \ +# -e "s^@gzip\@^$gzip^g" \ +# -e "s^@gcc\@^$gcc^g" \ +# -e "s^@mingetty\@^$mingetty^g" \ +# -e "s^@grub\@^$grub^g" \ +# -e "s^@out\@^$out^g" \ +# < $i > $dst +# chmod +x $dst +#done -- GitLab From d707a61ac2adbf9f902d250e16204a9a3df49341 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 23 Aug 2005 15:56:17 +0000 Subject: [PATCH 0075/5331] add nano svn path=/nixu/trunk/; revision=3670 --- boot/builder.sh | 4 +++- boot/default.nix | 8 ++++---- boot/env.sh | 2 +- fill-disk.sh | 4 ++-- make-disk.sh | 20 +++++++++++--------- pkgs.nix | 12 ++++++------ 6 files changed, 27 insertions(+), 23 deletions(-) diff --git a/boot/builder.sh b/boot/builder.sh index dce3250f090..1a94fb52d0f 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -10,7 +10,7 @@ for i in $boot $halt $login $env; do sed \ -e "s^@bash\@^$bash^g" \ -e "s^@coreutils\@^$coreutils^g" \ - -e "s^@findutils\@^$findutils^g" \ + -e "s^@findutilsWrapper\@^$findutilsWrapper^g" \ -e "s^@utillinux\@^$utillinux^g" \ -e "s^@sysvinit\@^$sysvinit^g" \ -e "s^@e2fsprogs\@^$e2fsprogs^g" \ @@ -39,6 +39,8 @@ for i in $boot $halt $login $env; do -e "s^@grub\@^$grub^g" \ -e "s^@udev\@^$udev^g" \ -e "s^@dhcpWrapper\@^$dhcpWrapper^g" \ + -e "s^@man\@^$man^g" \ + -e "s^@nano\@^$nano^g" \ -e "s^@out\@^$out^g" \ < $i > $dst chmod +x $dst diff --git a/boot/default.nix b/boot/default.nix index 0827f59d7bd..dc3632f8f70 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,8 +1,8 @@ -{ stdenv, kernel, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs +{ stdenv, kernel, bash, coreutils, findutilsWrapper, utillinux, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep , gnutar, gzip, mingetty, grubWrapper, parted, module_init_tools, hotplug -, udev, dhcpWrapper}: +, udev, dhcpWrapper, man, nano}: derivation { name = "boot"; @@ -12,9 +12,9 @@ derivation { halt = ./halt.sh; login = ./login.sh; env = ./env.sh; - inherit stdenv kernel bash coreutils findutils utillinux sysvinit + inherit stdenv kernel bash coreutils findutilsWrapper utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingetty grubWrapper parted module_init_tools - udev dhcpWrapper; + udev dhcpWrapper man nano; } diff --git a/boot/env.sh b/boot/env.sh index 84b8e7c7b3a..1f151ae93b3 100644 --- a/boot/env.sh +++ b/boot/env.sh @@ -1 +1 @@ -export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingetty@/sbin:@grub@/bin:@grub@/sbin:@module_init_tools@/sbin:@dhcpWrapper@/sbin +export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutilsWrapper@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingetty@/sbin:@grub@/bin:@grub@/sbin:@module_init_tools@/sbin:@dhcpWrapper@/sbin:@man@/bin:@nano@/bin diff --git a/fill-disk.sh b/fill-disk.sh index 9e7e11e4f2c..084295c4da8 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin +export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin kernel=@kernel@ @@ -256,7 +256,7 @@ echo copying store #cp -fa $storepaths $root/nix/store #done) < /cdrom/mystorepaths -cp -fa /nix/store/* $root/nix/store +cp -fva /nix/store/* $root/nix/store #echo registering valid paths... #(while read storepath; do diff --git a/make-disk.sh b/make-disk.sh index ac626727b90..f3e149e080c 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -57,7 +57,7 @@ BootPath=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)) coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -)) -findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutils' | $NIX_CMD_PATH/nix-instantiate -)) +findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX_CMD_PATH/nix-instantiate -)) utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)) e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -)) modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).module_init_tools' | $NIX_CMD_PATH/nix-instantiate -)) @@ -65,6 +65,7 @@ grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NI hotplug=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).hotplug' | $NIX_CMD_PATH/nix-instantiate -)) udev=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).udev' | $NIX_CMD_PATH/nix-instantiate -)) dhcp=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX_CMD_PATH/nix-instantiate -)) +nano=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX_CMD_PATH/nix-instantiate -)) (while read storepath; do cp -fa --parents ${storepath} ${archivesDir} @@ -107,16 +108,17 @@ svn export ${nixpkgs} ${archivesDir}/pkgs echo copying packages from store #cp -fa --parents ${nixDeps} ${archivesDir} -cp -fau --parents ${utilLinux} ${archivesDir} -cp -fau --parents ${Grub} ${archivesDir} +cp -fvau --parents ${utilLinux} ${archivesDir} +cp -fvau --parents ${Grub} ${archivesDir} #cp -fau --parents ${gnuSed} ${archivesDir} #cp -fau --parents ${gnuGrep} ${archivesDir} -cp -fau --parents ${Kernel} ${archivesDir} -cp -fau --parents ${SysVinit} ${archivesDir} -cp -fau --parents ${BootPath} ${archivesDir} -cp -fau --parents ${hotplug} ${archivesDir} -cp -fau --parents ${udev} ${archivesDir} -cp -fau --parents ${dhcp} ${archivesDir} +cp -fvau --parents ${Kernel} ${archivesDir} +cp -fvau --parents ${SysVinit} ${archivesDir} +cp -fvau --parents ${BootPath} ${archivesDir} +cp -fvau --parents ${hotplug} ${archivesDir} +cp -fvau --parents ${udev} ${archivesDir} +cp -fvau --parents ${dhcp} ${archivesDir} +cp -fvau --parents ${nano} ${archivesDir} bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))) diff --git a/pkgs.nix b/pkgs.nix index 874548e01f2..af8d61a3f36 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,20 +1,20 @@ rec { inherit (import /nixpkgs/trunk/pkgs/system/i686-linux.nix) - stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs + stdenv kernel bash coreutils findutilsWrapper utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingetty grubWrapper syslinux parted module_init_tools hotplug udev - dhcpWrapper; + dhcpWrapper man nano; - boot = (import ./boot) {inherit stdenv kernel bash coreutils findutils + boot = (import ./boot) {inherit stdenv kernel bash coreutils findutilsWrapper utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingetty grubWrapper parted module_init_tools - hotplug udev dhcpWrapper;}; + hotplug udev dhcpWrapper man nano;}; init = (import ./init) {inherit stdenv bash coreutils utillinux e2fsprogs nix shadowutils mingetty grubWrapper parted module_init_tools hotplug - dhcpWrapper;}; + dhcpWrapper man nano;}; - everything = [boot init sysvinit kernel]; + everything = [boot sysvinit kernel]; } -- GitLab From 9c75e2cb14a6d5eadd6fd59b76627e271c54a195 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 23 Aug 2005 16:53:39 +0000 Subject: [PATCH 0076/5331] fill-disk wants grep svn path=/nixu/trunk/; revision=3671 --- make-disk.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/make-disk.sh b/make-disk.sh index f3e149e080c..580ee797746 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -66,6 +66,7 @@ hotplug=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).hotplug' | $NIX udev=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).udev' | $NIX_CMD_PATH/nix-instantiate -)) dhcp=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX_CMD_PATH/nix-instantiate -)) nano=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX_CMD_PATH/nix-instantiate -)) +gnugrep=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -)) (while read storepath; do cp -fa --parents ${storepath} ${archivesDir} @@ -138,6 +139,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@grub\@^$grub^g" \ -e "s^@kernel\@^$kernel^g" \ -e "s^@hotplug\@^$hotplug^g" \ + -e "s^@gnugrep\@^$gnugrep^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk -- GitLab From 52bc4c5681107fcf54978f1df4e26b1470422961 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 23 Aug 2005 21:00:45 +0000 Subject: [PATCH 0077/5331] get the kernel versioning right. Right now it's only printed, but it should be used for creating the /lib/modules/ stuff right svn path=/nixu/trunk/; revision=3673 --- fill-disk.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 084295c4da8..5231fa7f97f 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -307,11 +307,15 @@ echo "root::12757:0:99999:7:::" > $root/etc/shadow ### strippedName=$(basename @kernel@); if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then - strippedName=$(echo "$strippedName" | cut -c34-) + strippedName=$(echo "$strippedName" | cut -c34- | cut -c 7-) fi -echo "stripped" $strippedName +kernelhash=$(basename @kernel@); +if echo "$kernelhash" | grep -q '^[a-z0-9]\{32\}-'; then + kernelhash=$(echo "$kernelhash" | cut -c -32) +fi +echo "kernelthing" $strippedName-$kernelhash ### ### Do funky stuff with grub here. -- GitLab From 240a2de945094f525d7a80bdc257e75dcc92f917 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 23 Aug 2005 23:07:49 +0000 Subject: [PATCH 0078/5331] - make /lib/modules/- - make symlinks to "build" and "kernel" in those directories - copy all modules.* files (like modules.dep). This is done so future add-on modules can modify these files instead of the ones in the store... Since the Nix hash is embedded in the path, this can still be considered safe and it makes modprobe work automagically. svn path=/nixu/trunk/; revision=3674 --- fill-disk.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fill-disk.sh b/fill-disk.sh index 5231fa7f97f..a562fbda572 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -315,7 +315,14 @@ if echo "$kernelhash" | grep -q '^[a-z0-9]\{32\}-'; then kernelhash=$(echo "$kernelhash" | cut -c -32) fi -echo "kernelthing" $strippedName-$kernelhash +version=$strippedName-$kernelhash + +make_dir 0755 /lib/modules/$version + +ln -s @kernel@/lib/modules/$version/build $root/lib/modules/$version/build +ln -s @kernel@/lib/modules/$version/kernel $root/lib/modules/$version/kernel +cp @kernel@/lib/modules/$version/modules.* $root/lib/modules/$version +chmod 644 $root/lib/modules/$version/modules.* ### ### Do funky stuff with grub here. -- GitLab From af61e915925fd766457d821823351a1482d25ac3 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 24 Aug 2005 14:04:07 +0000 Subject: [PATCH 0079/5331] add /nix/var/nix/profiles and other nix related directories svn path=/nixu/trunk/; revision=3680 --- fill-disk.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fill-disk.sh b/fill-disk.sh index a562fbda572..a96cdf39dde 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -139,7 +139,10 @@ make_dir 00755 /nix/store make_dir 00755 /nix/var make_dir 00755 /nix/var/nix make_dir 00755 /nix/var/nix/db +make_dir 00755 /nix/var/nix/gcroots make_dir 00755 /nix/var/nix/manifests +make_dir 00755 /nix/var/nix/profiles +make_dir 00755 /nix/var/nix/temproots make_dir 00755 /nix/var/log make_dir 00755 /nix/var/log/nix make_dir 00755 /nixpkgs -- GitLab From de9fa851968adeb728634f6e8e249f26f88572e1 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 25 Aug 2005 17:53:43 +0000 Subject: [PATCH 0080/5331] fix error in format svn path=/nixu/trunk/; revision=3687 --- storepaths_format | 1 + 1 file changed, 1 insertion(+) diff --git a/storepaths_format b/storepaths_format index dbb20caa111..5b71b007445 100644 --- a/storepaths_format +++ b/storepaths_format @@ -1,4 +1,5 @@ /nix/store/abcd- +deriver 2 /nix/store/1234- /nix/store/5678- -- GitLab From 3dce29bb92622cedfb6dcbe10abee793930ab038 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 25 Aug 2005 23:10:36 +0000 Subject: [PATCH 0081/5331] make /var/run in the installdisk, add some code for registering the copied Nix store in the Nix database, still unfinished svn path=/nixu/trunk/; revision=3690 --- fill-disk.sh | 10 +++++++--- make-disk.sh | 25 ++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index a96cdf39dde..b5bd0880f69 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin +export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin kernel=@kernel@ @@ -82,6 +82,7 @@ mknod -m 0600 /dev/initctl p targetdrive=/dev/hda device=${targetdrive}1 +echo ext2 fs blaat `which mkfs.ext2` mkfs.ext2 ${device} mkswap ${targetdrive}2 @@ -245,10 +246,12 @@ unset NIX_LOG_DIR unset NIX_STATE_DIR unset NIX_CONF_DIR +storeExpr=$(echo '(import /tmp/scripts/pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -v -v -) #storeExpr=$(echo '(import /tmp/scripts/pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) #storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) #$NIX_CMD_PATH/nix-store -r $storeExpr -#echo $storeExpr +echo $storeExpr > $root/tmp/storeExpr +cp /cdrom/mystorepaths $root/tmp #storeExpr2=$($NIX_CMD_PATH/nix-store -qR $($NIX_CMD_PATH/nix-store -r $storeExpr)) #echo storeExpr $storeExpr #echo $($NIX_CMD_PATH/nix-store -qR --include-outputs $storeExpr) @@ -347,4 +350,5 @@ echo umounting filesystem umount $root echo install done -telinit 0 +#telinit 0 +shutdown -h now diff --git a/make-disk.sh b/make-disk.sh index 580ee797746..223e634ddc7 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -40,9 +40,24 @@ kernel=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_C #nixDeps=$($NIX_CMD_PATH/nix-store -qR $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) #nixDeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) -echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) >> $storePaths +#echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) >> $storePaths +#$NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) >> $storePaths -#echo $nixDeps > $storePaths +nixblaat=$(nix-store -r $(echo '(import ./pkgs.nix).nix'| $NIX_CMD_PATH/nix-instantiate -)) +echo $nixblaat >> $storePaths +echo '' >> $storePaths +#echo 13 >> $storePaths +## Nix does --references, not --requisites for registering paths +nixdeps=$($NIX_CMD_PATH/nix-store -q --references $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) + +pkgs=$(echo $nixdeps | wc -w) + +echo $pkgs >> $storePaths + +for i in $nixdeps +do + echo $i >> $storePaths +done utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))) coreUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -))) @@ -67,6 +82,7 @@ udev=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).udev' | $NIX_CMD_P dhcp=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX_CMD_PATH/nix-instantiate -)) nano=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX_CMD_PATH/nix-instantiate -)) gnugrep=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -)) +which=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).which' | $NIX_CMD_PATH/nix-instantiate -)) (while read storepath; do cp -fa --parents ${storepath} ${archivesDir} @@ -100,6 +116,7 @@ mkdir ${initdir}/tmp mkdir -p ${initdir}/usr/bin mkdir -p ${initdir}/usr/sbin mkdir ${initdir}/var +mkdir ${initdir}/var/run echo copying nixpkgs @@ -140,6 +157,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@kernel\@^$kernel^g" \ -e "s^@hotplug\@^$hotplug^g" \ -e "s^@gnugrep\@^$gnugrep^g" \ + -e "s^@which\@^$which^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk @@ -174,6 +192,7 @@ cp -fau --parents ${coreUtils} ${initdir} cp -fau --parents ${e2fsProgs} ${initdir} cp -fau --parents ${modUtils} ${initdir} cp -fau --parents ${hotplug} ${initdir} +cp -fau --parents ${which} ${initdir} touch ${initdir}/NIXOS @@ -183,6 +202,7 @@ chmod -f -R +w ${initdir}/* rm -rf ${initdir} cp ${initrd} ${archivesDir}/isolinux +rm -f ${initrd} echo creating ISO image @@ -194,6 +214,5 @@ mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin -c isolinux/boot.cat \ echo cleaning up -rm -f ${initrd} chmod -f -R +w ${archivesDir}/* rm -rf ${archivesDir}/* -- GitLab From 789f716808b25d3aa9ccff714c6dd5f5f1538201 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 26 Aug 2005 16:06:52 +0000 Subject: [PATCH 0082/5331] use tar for copying nixpkgs instead of cp to speed up installation process. Commit 3700 :) svn path=/nixu/trunk/; revision=3700 --- fill-disk.sh | 5 +++-- make-disk.sh | 10 +++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index b5bd0880f69..6916cc740e1 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin +export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin kernel=@kernel@ @@ -230,7 +230,8 @@ echo verifying Nix DB... $NIX_CMD_PATH/nix-store --verify echo copying nixpkgs... -cp -fLa /cdrom/pkgs $root/nixpkgs/trunk +#cp -fLa /cdrom/pkgs $root/nixpkgs/trunk +tar --directory=/cdrom -cf - pkgs | tar --directory=$root/nixpkgs/trunk -xvf - make_dir 0755 /tmp/scripts cp -fa /cdrom/scripts $root/tmp diff --git a/make-disk.sh b/make-disk.sh index 223e634ddc7..63012c683e6 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -22,7 +22,7 @@ rm -rf ${archivesDir}/* NIX_CMD_PATH=/nix/bin -storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) +storeExpr=$($NIX_CMD_PATH/nix-store -qR $(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -)) #$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) # Location of sysvinit? @@ -59,6 +59,11 @@ do echo $i >> $storePaths done +for i in $storeExpr +do + echo $i >> $archivesDir/store-expressions +done + utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))) coreUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -))) e2fsProgs=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -))) @@ -83,6 +88,7 @@ dhcp=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NI nano=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX_CMD_PATH/nix-instantiate -)) gnugrep=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -)) which=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).which' | $NIX_CMD_PATH/nix-instantiate -)) +gnutar=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX_CMD_PATH/nix-instantiate -)) (while read storepath; do cp -fa --parents ${storepath} ${archivesDir} @@ -137,6 +143,7 @@ cp -fvau --parents ${hotplug} ${archivesDir} cp -fvau --parents ${udev} ${archivesDir} cp -fvau --parents ${dhcp} ${archivesDir} cp -fvau --parents ${nano} ${archivesDir} +cp -fvau --parents ${gnutar} ${archivesDir} bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))) @@ -158,6 +165,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@hotplug\@^$hotplug^g" \ -e "s^@gnugrep\@^$gnugrep^g" \ -e "s^@which\@^$which^g" \ + -e "s^@gnutar\@^$gnutar^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk -- GitLab From 3b7a4df52ee78186ebe2a53ab0a565a175f971f5 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 26 Aug 2005 18:38:57 +0000 Subject: [PATCH 0083/5331] use tar instead of cp, which should be a bit faster (but is it really?) svn path=/nixu/trunk/; revision=3709 --- fill-disk.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 6916cc740e1..2a44c22f908 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -263,7 +263,8 @@ echo copying store #cp -fa $storepaths $root/nix/store #done) < /cdrom/mystorepaths -cp -fva /nix/store/* $root/nix/store +#cp -fva /nix/store/* $root/nix/store +tar cf - /nix/store | tar --directory=$root -xvf - #echo registering valid paths... #(while read storepath; do @@ -301,7 +302,7 @@ echo 192.168.150.3 > $root/etc/networking/gateway-ip #cp /etc/resolv.conf $root/etc rm -f $root/etc/hosts echo "127.0.0.1 localhost" >> $root/etc/hosts -echo "192.168.150.1 uml" >> $root/etc/hosts +#echo "192.168.150.1 uml" >> $root/etc/hosts echo setting up initial account information... @@ -352,4 +353,5 @@ umount $root echo install done #telinit 0 +ln -s @sysvinitPath@/sbin/init /sbin/init shutdown -h now -- GitLab From 796f3bb6913cf08de035eaf2e07a07273a78745a Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 26 Aug 2005 22:21:29 +0000 Subject: [PATCH 0084/5331] add grub configuration file (menu.lst) during installation svn path=/nixu/trunk/; revision=3715 --- fill-disk.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fill-disk.sh b/fill-disk.sh index 2a44c22f908..cab29a3fb22 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -347,6 +347,15 @@ echo installing bootloader grub-install --root-directory=${root} --no-floppy ${targetdrive} +# FIXME "root (hd0,0)" +cat > $root/boot/grub/menu.lst << GRUBEND +default=0 +timeout=5 +title NixOS + root (hd0,0) + kernel @kernel@/vmlinuz root=$device +GRUBEND + echo umounting filesystem umount $root -- GitLab From a3ae8f4143245ca403098758d1984a06fbf56cf3 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sat, 27 Aug 2005 00:04:30 +0000 Subject: [PATCH 0085/5331] remove some debugging statements svn path=/nixu/trunk/; revision=3716 --- fill-disk.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index cab29a3fb22..bb699d6de68 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -4,6 +4,8 @@ export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinu kernel=@kernel@ +storePaths=/mystorepaths + sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ modutils=@modutils@ @@ -82,7 +84,6 @@ mknod -m 0600 /dev/initctl p targetdrive=/dev/hda device=${targetdrive}1 -echo ext2 fs blaat `which mkfs.ext2` mkfs.ext2 ${device} mkswap ${targetdrive}2 @@ -198,8 +199,6 @@ do echo "Looking for CDROM in: $i" if mount -t iso9660 $i /cdrom >/dev/null 2>&1 then - echo "cdrom contents" - ls /cdrom if test -f /cdrom/NIXOS then cddevice=$i @@ -266,7 +265,10 @@ echo copying store #cp -fva /nix/store/* $root/nix/store tar cf - /nix/store | tar --directory=$root -xvf - -#echo registering valid paths... +echo registering valid paths... + +$NIX_CMD_PATH/nix-store --register-validity < $root/tmp/mystorepaths + #(while read storepath; do # echo PATH $storepath # if ! $NIX_CMD_PATH/nix-store --isvalid $storepath 2> /dev/null; then @@ -336,7 +338,6 @@ chmod 644 $root/lib/modules/$version/modules.* ### Do funky stuff with grub here. ### -ln -s @kernel@/vmlinuz $root/boot/vmlinuz ln -s @sysvinitPath@/sbin/init $root/sbin/init ln -s @hotplug@/sbin/hotplug $root/sbin/hotplug ln -s @hotplug@/etc/hotplug $root/etc/hotplug -- GitLab From fff45e114e464e554a91bc8b77032e16ca368f65 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sat, 27 Aug 2005 00:36:07 +0000 Subject: [PATCH 0086/5331] - register all valid paths inside the Nix database. The .drv files are not included, this is a purely binary deployment. - add grub to the initial environment svn path=/nixu/trunk/; revision=3717 --- boot/builder.sh | 2 +- make-disk.sh | 66 +++++++++++++++++++++++++++++-------------------- 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/boot/builder.sh b/boot/builder.sh index 1a94fb52d0f..a350d06e020 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -36,7 +36,7 @@ for i in $boot $halt $login $env; do -e "s^@gcc\@^$gcc^g" \ -e "s^@mingetty\@^$mingetty^g" \ -e "s^@module_init_tools\@^$module_init_tools^g" \ - -e "s^@grub\@^$grub^g" \ + -e "s^@grub\@^$grubWrapper^g" \ -e "s^@udev\@^$udev^g" \ -e "s^@dhcpWrapper\@^$dhcpWrapper^g" \ -e "s^@man\@^$man^g" \ diff --git a/make-disk.sh b/make-disk.sh index 63012c683e6..6c42916df1b 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -22,7 +22,7 @@ rm -rf ${archivesDir}/* NIX_CMD_PATH=/nix/bin -storeExpr=$($NIX_CMD_PATH/nix-store -qR $(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -)) +storeExpr=$($NIX_CMD_PATH/nix-store -qR $($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -))) #$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) # Location of sysvinit? @@ -43,25 +43,37 @@ kernel=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_C #echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) >> $storePaths #$NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) >> $storePaths -nixblaat=$(nix-store -r $(echo '(import ./pkgs.nix).nix'| $NIX_CMD_PATH/nix-instantiate -)) -echo $nixblaat >> $storePaths -echo '' >> $storePaths +#nixblaat=$(nix-store -r $(echo '(import ./pkgs.nix).nix'| $NIX_CMD_PATH/nix-instantiate -)) +#echo $nixblaat >> $storePaths +#echo '' >> $storePaths #echo 13 >> $storePaths ## Nix does --references, not --requisites for registering paths -nixdeps=$($NIX_CMD_PATH/nix-store -q --references $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) +#nixdeps=$($NIX_CMD_PATH/nix-store -q --references $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) -pkgs=$(echo $nixdeps | wc -w) +#pkgs=$(echo $nixdeps | wc -w) -echo $pkgs >> $storePaths +#echo $pkgs >> $storePaths -for i in $nixdeps -do - echo $i >> $storePaths -done +#for i in $nixdeps +#do + #echo $i >> $storePaths +#done for i in $storeExpr do echo $i >> $archivesDir/store-expressions + echo $i >> $archivesDir/store-expressions-storepath + echo $i >> $storePaths + echo '' >> $storePaths + deps=$($NIX_CMD_PATH/nix-store -q --references $i) + pkgs=$(echo $deps | wc -w) + echo $pkgs >> $storePaths + for j in $deps + do + echo $j >> $storePaths + done + echo copying from store: $i + tar -cf - $i | tar --directory=$archivesDir -xf - done utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))) @@ -90,9 +102,9 @@ gnugrep=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX which=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).which' | $NIX_CMD_PATH/nix-instantiate -)) gnutar=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX_CMD_PATH/nix-instantiate -)) -(while read storepath; do - cp -fa --parents ${storepath} ${archivesDir} -done) < $storePaths +#(while read storepath; do + #cp -fa --parents ${storepath} ${archivesDir} +#done) < $storePaths echo utillinux $utilLinux @@ -129,21 +141,21 @@ echo copying nixpkgs svn export ${nixpkgs} ${archivesDir}/pkgs #cp -fa ${nixpkgs} ${archivesDir} -echo copying packages from store +#echo copying packages from store #cp -fa --parents ${nixDeps} ${archivesDir} -cp -fvau --parents ${utilLinux} ${archivesDir} -cp -fvau --parents ${Grub} ${archivesDir} -#cp -fau --parents ${gnuSed} ${archivesDir} -#cp -fau --parents ${gnuGrep} ${archivesDir} -cp -fvau --parents ${Kernel} ${archivesDir} -cp -fvau --parents ${SysVinit} ${archivesDir} -cp -fvau --parents ${BootPath} ${archivesDir} -cp -fvau --parents ${hotplug} ${archivesDir} -cp -fvau --parents ${udev} ${archivesDir} -cp -fvau --parents ${dhcp} ${archivesDir} -cp -fvau --parents ${nano} ${archivesDir} -cp -fvau --parents ${gnutar} ${archivesDir} +#cp -fvau --parents ${utilLinux} ${archivesDir} +#cp -fvau --parents ${Grub} ${archivesDir} +##cp -fau --parents ${gnuSed} ${archivesDir} +##cp -fau --parents ${gnuGrep} ${archivesDir} +#cp -fvau --parents ${Kernel} ${archivesDir} +#cp -fvau --parents ${SysVinit} ${archivesDir} +#cp -fvau --parents ${BootPath} ${archivesDir} +#cp -fvau --parents ${hotplug} ${archivesDir} +#cp -fvau --parents ${udev} ${archivesDir} +#cp -fvau --parents ${dhcp} ${archivesDir} +#cp -fvau --parents ${nano} ${archivesDir} +#cp -fvau --parents ${gnutar} ${archivesDir} bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))) -- GitLab From de289092b2066b22dd62b1ffa9542ce36b7ee5dd Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 28 Aug 2005 00:51:34 +0000 Subject: [PATCH 0087/5331] - various cleanups - have mingetty listen on tty2 (but this still fails because of missing /dev/log - get rid of /init on the targetdrive, solely use /sbin/init (and even that has to go one day) - use dietlibc statically linked e2fsprogs for the installer. More to come :) svn path=/nixu/trunk/; revision=3734 --- boot/builder.sh | 2 +- boot/default.nix | 4 ++-- boot/env.sh | 2 +- fill-disk.sh | 44 ++++++++++++-------------------------------- make-disk.sh | 6 ++++-- pkgs.nix | 11 ++++++----- 6 files changed, 26 insertions(+), 43 deletions(-) diff --git a/boot/builder.sh b/boot/builder.sh index a350d06e020..bef4682093d 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -34,7 +34,7 @@ for i in $boot $halt $login $env; do -e "s^@gnugrep\@^$gnugrep^g" \ -e "s^@gzip\@^$gzip^g" \ -e "s^@gcc\@^$gcc^g" \ - -e "s^@mingetty\@^$mingetty^g" \ + -e "s^@mingettyWrapper\@^$mingettyWrapper^g" \ -e "s^@module_init_tools\@^$module_init_tools^g" \ -e "s^@grub\@^$grubWrapper^g" \ -e "s^@udev\@^$udev^g" \ diff --git a/boot/default.nix b/boot/default.nix index dc3632f8f70..17957c934a7 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,7 +1,7 @@ { stdenv, kernel, bash, coreutils, findutilsWrapper, utillinux, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep -, gnutar, gzip, mingetty, grubWrapper, parted, module_init_tools, hotplug +, gnutar, gzip, mingettyWrapper, grubWrapper, parted, module_init_tools, hotplug , udev, dhcpWrapper, man, nano}: derivation { @@ -15,6 +15,6 @@ derivation { inherit stdenv kernel bash coreutils findutilsWrapper utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused - gnutar gnugrep gzip mingetty grubWrapper parted module_init_tools + gnutar gnugrep gzip mingettyWrapper grubWrapper parted module_init_tools udev dhcpWrapper man nano; } diff --git a/boot/env.sh b/boot/env.sh index 1f151ae93b3..ee481270ee9 100644 --- a/boot/env.sh +++ b/boot/env.sh @@ -1 +1 @@ -export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutilsWrapper@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingetty@/sbin:@grub@/bin:@grub@/sbin:@module_init_tools@/sbin:@dhcpWrapper@/sbin:@man@/bin:@nano@/bin +export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutilsWrapper@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingettyWrapper@/sbin:@grub@/bin:@grub@/sbin:@module_init_tools@/sbin:@dhcpWrapper@/sbin:@man@/bin:@nano@/bin diff --git a/fill-disk.sh b/fill-disk.sh index bb699d6de68..df64f730219 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -2,6 +2,11 @@ export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin +## +## In the beginning we want to have a minimalistic environment, built with +## klibc. +## + kernel=@kernel@ storePaths=/mystorepaths @@ -10,6 +15,7 @@ sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ modutils=@modutils@ hotplug=@hotplug@ +mingetty=@mingetty@ echo mounting special filesystems @@ -176,22 +182,13 @@ mknod -m 0600 $root/dev/tty0 c 4 0 mknod -m 0600 $root/dev/tty1 c 4 1 mknod -m 0444 $root/dev/urandom c 1 9 -#touch_file /etc/passwd -#touch_file /etc/shadow -#touch_file /etc/group - rm -f $root/etc/mtab #ln -s /proc/mounts $root/etc/mtab -#cat /proc/mounts - ## Probe for CD device which contains our CD here and mount /nix and ## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this. ## Find out how Knoppix and SUSE do this... -#devices=$(grep -r cdrom hd* | cut -d '/' -f 1 | sort | uniq) -#echo devices ${devices} - DEVICES="/dev/hd?" for i in ${DEVICES} @@ -204,13 +201,14 @@ then cddevice=$i echo "Accessing NixOS CDROM at $i" break -fi -#umount /cdrom + fi fi done echo switch to /nix and /nixpkgs from CD +## starting here it's OK to have full blown glibc + ln -s /cdrom/nixpkgs /nixpkgs mount --bind /cdrom/nix /nix @@ -222,7 +220,6 @@ export NIX_CONF_DIR=$root/nix/etc NIX_CMD_PATH=@NIX_CMD_PATH@/bin echo initialising Nix DB... -#/nix/bin/nix-store --init $NIX_CMD_PATH/nix-store --init echo verifying Nix DB... @@ -258,10 +255,6 @@ cp /cdrom/mystorepaths $root/tmp echo copying store -#(while read storepaths; do - #cp -fa $storepaths $root/nix/store -#done) < /cdrom/mystorepaths - #cp -fva /nix/store/* $root/nix/store tar cf - /nix/store | tar --directory=$root -xvf - @@ -269,23 +262,10 @@ echo registering valid paths... $NIX_CMD_PATH/nix-store --register-validity < $root/tmp/mystorepaths -#(while read storepath; do -# echo PATH $storepath -# if ! $NIX_CMD_PATH/nix-store --isvalid $storepath 2> /dev/null; then -# (unset NIX_ROOT; $NIX_CMD_PATH/nix-store --dump $storepath) | $NIX_CMD_PATH/nix-store --restore $storepath -# $NIX_CMD_PATH/nix-store --validpath $storepath -# fi -#done) < /tmp/mystorepaths - -#echo registering successors... -#(while read line; do -# echo SUCC $line -# $NIX_CMD_PATH/nix-store --successor $line -#done) < /tmp/mysuccessors - echo setting init symlink... rm -f $root/init -ln -s $sysvinitPath/sbin/init $root/init +#ln -s $sysvinitPath/sbin/init $root/init +ln -s @sysvinitPath@/sbin/init $root/sbin/init ln -s @bash@/bin/sh $root/bin/sh ln -s @bash@/bin/bash $root/bin/bash @@ -295,6 +275,7 @@ echo "id:2:initdefault:" >> $root/etc/inittab echo "si::bootwait:$bootPath/bin/boot.sh" >> $root/etc/inittab echo "ht:06:wait:$bootPath/bin/halt.sh" >> $root/etc/inittab echo "1:2345:respawn:$bootPath/bin/login.sh /dev/tty1" >> $root/etc/inittab +echo "2:2345:respawn:$mingetty/sbin/mingetty tty2" >> $root/etc/inittab #echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab echo setting up networking information... @@ -338,7 +319,6 @@ chmod 644 $root/lib/modules/$version/modules.* ### Do funky stuff with grub here. ### -ln -s @sysvinitPath@/sbin/init $root/sbin/init ln -s @hotplug@/sbin/hotplug $root/sbin/hotplug ln -s @hotplug@/etc/hotplug $root/etc/hotplug ln -s @hotplug@/etc/hotplug.d $root/etc/hotplug.d diff --git a/make-disk.sh b/make-disk.sh index 6c42916df1b..3d33571ec99 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -78,7 +78,7 @@ done utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))) coreUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -))) -e2fsProgs=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -))) +e2fsProgs=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX_CMD_PATH/nix-instantiate -))) modUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).module_init_tools' | $NIX_CMD_PATH/nix-instantiate -))) Grub=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -))) #gnuSed=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX_CMD_PATH/nix-instantiate -))) @@ -91,9 +91,10 @@ bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_P coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -)) findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX_CMD_PATH/nix-instantiate -)) utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)) -e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -)) +e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX_CMD_PATH/nix-instantiate -)) modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).module_init_tools' | $NIX_CMD_PATH/nix-instantiate -)) grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -)) +mingettyWrapper=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).mingettyWrapper' | $NIX_CMD_PATH/nix-instantiate -)) hotplug=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).hotplug' | $NIX_CMD_PATH/nix-instantiate -)) udev=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).udev' | $NIX_CMD_PATH/nix-instantiate -)) dhcp=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX_CMD_PATH/nix-instantiate -)) @@ -178,6 +179,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@gnugrep\@^$gnugrep^g" \ -e "s^@which\@^$which^g" \ -e "s^@gnutar\@^$gnutar^g" \ + -e "s^@mingetty\@^$mingettyWrapper^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk diff --git a/pkgs.nix b/pkgs.nix index af8d61a3f36..d02d0a7a134 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,19 +1,20 @@ rec { inherit (import /nixpkgs/trunk/pkgs/system/i686-linux.nix) - stdenv kernel bash coreutils findutilsWrapper utillinux sysvinit e2fsprogs + stdenv kernel bash coreutils findutilsWrapper utillinux sysvinit + e2fsprogsDiet e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip - mingetty grubWrapper syslinux parted module_init_tools hotplug udev + mingettyWrapper grubWrapper syslinux parted module_init_tools hotplug udev dhcpWrapper man nano; boot = (import ./boot) {inherit stdenv kernel bash coreutils findutilsWrapper utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl - gnused gnutar gnugrep gzip mingetty grubWrapper parted module_init_tools + gnused gnutar gnugrep gzip mingettyWrapper grubWrapper parted module_init_tools hotplug udev dhcpWrapper man nano;}; - init = (import ./init) {inherit stdenv bash coreutils utillinux e2fsprogs - nix shadowutils mingetty grubWrapper parted module_init_tools hotplug + init = (import ./init) {inherit stdenv bash coreutils utillinux e2fsprogsDiet + nix shadowutils mingettyWrapper grubWrapper parted module_init_tools hotplug dhcpWrapper man nano;}; everything = [boot sysvinit kernel]; -- GitLab From 142cef0a9eed3db300d5b2a2bd6534924e12cdb7 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 28 Aug 2005 16:56:48 +0000 Subject: [PATCH 0088/5331] switch to dietlibc coreutils in the initrams. Use thit up until a certain point, after which we switch to the normal coreutils. Oh, this should really be refactored... svn path=/nixu/trunk/; revision=3738 --- fill-disk.sh | 2 +- make-disk.sh | 6 ++++-- pkgs.nix | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index df64f730219..203f4ac59a7 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin +export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin ## ## In the beginning we want to have a minimalistic environment, built with diff --git a/make-disk.sh b/make-disk.sh index 3d33571ec99..c8dd31d3b0a 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -77,7 +77,7 @@ do done utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))) -coreUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -))) +coreUtilsDiet=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX_CMD_PATH/nix-instantiate -))) e2fsProgs=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX_CMD_PATH/nix-instantiate -))) modUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).module_init_tools' | $NIX_CMD_PATH/nix-instantiate -))) Grub=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -))) @@ -88,6 +88,7 @@ SysVinit=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix BootPath=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -))) bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)) +coreutilsdiet=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX_CMD_PATH/nix-instantiate -)) coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -)) findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX_CMD_PATH/nix-instantiate -)) utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)) @@ -169,6 +170,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@NIX_CMD_PATH\@^$nix^g" \ -e "s^@bash\@^$bash^g" \ -e "s^@findutils\@^$findutils^g" \ + -e "s^@coreutilsdiet\@^$coreutilsdiet^g" \ -e "s^@coreutils\@^$coreutils^g" \ -e "s^@utillinux\@^$utillinux^g" \ -e "s^@e2fsprogs\@^$e2fsprogs^g" \ @@ -210,7 +212,7 @@ ln -s ${bash}/bin/bash ${initdir}/bin/sh chmod u+x ${initdir}/init cp -fau --parents ${bashdeps} ${initdir} cp -fau --parents ${utilLinux} ${initdir} -cp -fau --parents ${coreUtils} ${initdir} +cp -fau --parents ${coreUtilsDiet} ${initdir} cp -fau --parents ${e2fsProgs} ${initdir} cp -fau --parents ${modUtils} ${initdir} cp -fau --parents ${hotplug} ${initdir} diff --git a/pkgs.nix b/pkgs.nix index d02d0a7a134..fff17e9921d 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,6 +1,6 @@ rec { inherit (import /nixpkgs/trunk/pkgs/system/i686-linux.nix) - stdenv kernel bash coreutils findutilsWrapper utillinux sysvinit + stdenv kernel bash coreutils coreutilsDiet findutilsWrapper utillinux sysvinit e2fsprogsDiet e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip @@ -13,7 +13,7 @@ rec { gnused gnutar gnugrep gzip mingettyWrapper grubWrapper parted module_init_tools hotplug udev dhcpWrapper man nano;}; - init = (import ./init) {inherit stdenv bash coreutils utillinux e2fsprogsDiet + init = (import ./init) {inherit stdenv bash coreutilsDiet utillinux e2fsprogsDiet nix shadowutils mingettyWrapper grubWrapper parted module_init_tools hotplug dhcpWrapper man nano;}; -- GitLab From 1581e0c08ef6b704c6f3900d3d817ac88160f2c7 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 30 Aug 2005 11:23:56 +0000 Subject: [PATCH 0089/5331] remove dependency on /nix, so we can build NixOS inside NixOS svn path=/nixu/trunk/; revision=3747 --- make-disk.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index c8dd31d3b0a..55db5bc6b7d 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -20,7 +20,7 @@ touch ${archivesDir}/blah chmod -f -R +w ${archivesDir}/* rm -rf ${archivesDir}/* -NIX_CMD_PATH=/nix/bin +NIX_CMD_PATH=$(dirname $(which nix-store)) storeExpr=$($NIX_CMD_PATH/nix-store -qR $($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -))) #$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) @@ -216,7 +216,7 @@ cp -fau --parents ${coreUtilsDiet} ${initdir} cp -fau --parents ${e2fsProgs} ${initdir} cp -fau --parents ${modUtils} ${initdir} cp -fau --parents ${hotplug} ${initdir} -cp -fau --parents ${which} ${initdir} +#cp -fau --parents ${which} ${initdir} touch ${initdir}/NIXOS -- GitLab From 115f0e2a25c87c63dbfeec5e06079eabeaadb9e2 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 30 Aug 2005 13:14:04 +0000 Subject: [PATCH 0090/5331] we don't use UML at all anymore and the installation instructions are *way* out of date svn path=/nixu/trunk/; revision=3749 --- INSTALL | 89 --------------------------------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 INSTALL diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 79098f8b07c..00000000000 --- a/INSTALL +++ /dev/null @@ -1,89 +0,0 @@ -Setting up and running Nix UML ("nixu") - -It is possible to run Nix inside a User Mode Linux environment (UML). The Nix -expressions for this can be found at -https://svn.cs.uu.nl:12443/repos/trace/nixu/. - - - Installation on SuSE Linux 9 - -Download the latest nixpkgs collection and checkout the nixu trunk with -subversion. Install the uml and uml-utilities packages with Nix and run the -"make-disk.sh" script which can be found in nixu. After it has built -everything (or downloaded everything from the nixpkgs cache which can be -used with nix-pull) you can use the "run.sh" script to start the UML. - - - Installation on Fedora Core 1 - -Installing the Nix UML on Fedora Core 1 is a bit tricky. Nix relies on -Berkeley DB and there are issues with Berkeley DB and NPTL kernels (New POSIX -Thread Library) on Red Hat based systems. Since the system we build inside -UML does not use NPTL we cannot use the Nix we use on the host system to -fill the disk once we've booted our the kernel of our UML. - -The solution is as follows: - -- install all packages via the nix-pull mechanisms with the MANIFEST from - the official nix-pkgs site to avoid that impure builds link against the - NPTL glibc on the host system. -- install Nix in Nix -- in the nixu scripts edit make-disk.sh and fill-disk.sh. - In make-disk.sh prefix all nix-* commands with the absolute path to the - host-Nix installation bin directory (for example: /nix/bin). In - fill-disk.sh replace all /nix/bin paths with a relative path to the Nix - installed with Nix (for example: /usr/home/nix/.nix-profile/bin). - -This should fix the installation problems and the Nix UML should boot -flawlessly. - - - Nix UML and 2.6 kernel - -Installing the current Nix UML packages with a 2.4 kernel on a 2.6 -kernel based host system will most likely fail. Linux kernel 2.6 uses NPTL -by default, but UML itself seems to be broken somewhat so halfway the system -seems to hang. - -Installing a 2.6 based UML with Nix is not trivial and is not advised. - - - Using the Nix UML - -By default, the Nix UML comes with very little configuration. Apart from the -networking information and mount information, there is nothing. One of the -first things to do is to add user and group information, otherwise a lot -of tools won't work. There are empty passwd, shadow and group files. Due -to some limitations in Nix it is only possible to modify the password file -as root. - -- add a root user: - -useradd root - -- edit /etc/passwd and change the UID to 0 ("vim" is provided) -- add a root group: - -groupadd root - - - Adding packages to the UML Nix installation - -Packages can be added the the Nix UML installation by editing a few files. -The first file packages should be added to is 'pkgs.nix'. The other files -that should be edited all reside in the "boot" directory. In default.nix -the packages should be added as an argument (first line) and given as an -argument to the builder (line starting with "inherit"). In "builder.sh" -there is a sed expression which subsitutes all occurences of the names of -the packages in the files with the right value. If the programs that are -added need to be added to $PATH the file "env.sh" has to be edited and the -UML has to be recreated. - -Another option would be to enable networking in the UML and use nix-pull to -get all the right packages, however this does not work yet out of the box. -A small trick is to symlink /bin/sh to the current version of "sh": - -# cd /bin -# ln -s `which sh` sh - -We're looking for a more permanent solution to fix this. -- GitLab From eac09bcb315ceb0c1062454e51e607b466a59bd0 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 30 Aug 2005 13:16:16 +0000 Subject: [PATCH 0091/5331] cleanups commit 3750 :) svn path=/nixu/trunk/; revision=3750 --- make-disk.sh | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index 55db5bc6b7d..341701917e5 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -43,26 +43,8 @@ kernel=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_C #echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) >> $storePaths #$NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) >> $storePaths -#nixblaat=$(nix-store -r $(echo '(import ./pkgs.nix).nix'| $NIX_CMD_PATH/nix-instantiate -)) -#echo $nixblaat >> $storePaths -#echo '' >> $storePaths -#echo 13 >> $storePaths -## Nix does --references, not --requisites for registering paths -#nixdeps=$($NIX_CMD_PATH/nix-store -q --references $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) - -#pkgs=$(echo $nixdeps | wc -w) - -#echo $pkgs >> $storePaths - -#for i in $nixdeps -#do - #echo $i >> $storePaths -#done - for i in $storeExpr do - echo $i >> $archivesDir/store-expressions - echo $i >> $archivesDir/store-expressions-storepath echo $i >> $storePaths echo '' >> $storePaths deps=$($NIX_CMD_PATH/nix-store -q --references $i) @@ -198,12 +180,6 @@ echo copying kernel # of the kernel here. cp -L $kernel/vmlinuz ${archivesDir}/isolinux -# echo making ramdisk -# todo! -# mkdir ${archivesDir}/sbin -# ln -s /scripts/fill-disk.sh ${archivesDir}/sbin/init -# ln -s /scripts/fill-disk.sh ${archivesDir}/init - echo creating ramdisk rm -f ${initrd} -- GitLab From f64cf78dfa28b9ed797dfeb9d63b948baa7c7ffb Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 31 Aug 2005 09:39:41 +0000 Subject: [PATCH 0092/5331] fix for cpio. Between cpio 2.5 and 2.6 semantics of the -c flag (which we used) has changed. Switch to a flag which is unlikely to change (-H newc) svn path=/nixu/trunk/; revision=3756 --- make-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-disk.sh b/make-disk.sh index 341701917e5..5cb46a2b214 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -196,7 +196,7 @@ cp -fau --parents ${hotplug} ${initdir} touch ${initdir}/NIXOS -(cd ${initdir}; find . |cpio -c -o) | gzip -9 > ${initrd} +(cd ${initdir}; find . |cpio -H newc -o) | gzip -9 > ${initrd} chmod -f -R +w ${initdir}/* rm -rf ${initdir} -- GitLab From d227f0e83ac33fe60e6bb0295e518b4e19b401da Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 31 Aug 2005 10:11:07 +0000 Subject: [PATCH 0093/5331] temporarily outcomment mingetty svn path=/nixu/trunk/; revision=3757 --- fill-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fill-disk.sh b/fill-disk.sh index 203f4ac59a7..37600769e8f 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -275,7 +275,7 @@ echo "id:2:initdefault:" >> $root/etc/inittab echo "si::bootwait:$bootPath/bin/boot.sh" >> $root/etc/inittab echo "ht:06:wait:$bootPath/bin/halt.sh" >> $root/etc/inittab echo "1:2345:respawn:$bootPath/bin/login.sh /dev/tty1" >> $root/etc/inittab -echo "2:2345:respawn:$mingetty/sbin/mingetty tty2" >> $root/etc/inittab +#echo "2:2345:respawn:$mingetty/sbin/mingetty tty2" >> $root/etc/inittab #echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab echo setting up networking information... -- GitLab From 14b2ad157c07f805dd6ec92eef899cb30482b203 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 31 Aug 2005 12:02:28 +0000 Subject: [PATCH 0094/5331] add logging capabilities. Install log is now copied to /root/install-log. svn path=/nixu/trunk/; revision=3759 --- fill-disk.sh | 4 ++++ init.sh | 3 +++ make-disk.sh | 10 +++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 init.sh diff --git a/fill-disk.sh b/fill-disk.sh index 37600769e8f..6ae875cab94 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -337,6 +337,10 @@ title NixOS kernel @kernel@/vmlinuz root=$device GRUBEND +echo copying install log + +cp /tmp/install-log $root/root + echo umounting filesystem umount $root diff --git a/init.sh b/init.sh new file mode 100644 index 00000000000..b7ab17f20af --- /dev/null +++ b/init.sh @@ -0,0 +1,3 @@ +#! @bash@/bin/sh -e + +exec ./fill-disk.sh | @coreutils@/bin/tee /tmp/install-log diff --git a/make-disk.sh b/make-disk.sh index 5cb46a2b214..115cd722bfa 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -12,6 +12,7 @@ validatePaths=$archivesDir/validatepaths bootiso=/tmp/nixos.iso initrd=/tmp/initram.img initdir=${archivesDir}/initdir +initscript=$archivesDir/scripts/init.sh echo cleaning old build @@ -147,6 +148,10 @@ echo copying scripts mkdir ${archivesDir}/scripts cp -fa * ${archivesDir}/scripts +sed -e "s^@bash\@^$bash^g" \ + -e "s^@coreutils\@^$coreutilsdiet^g" \ + < $initscript > $initscript.tmp +mv $initscript.tmp $initscript sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@bootPath\@^$bootPath^g" \ -e "s^@NIX_CMD_PATH\@^$nix^g" \ @@ -183,9 +188,12 @@ cp -L $kernel/vmlinuz ${archivesDir}/isolinux echo creating ramdisk rm -f ${initrd} -cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init +#cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init +cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/ +cp ${archivesDir}/scripts/init.sh ${initdir}/init ln -s ${bash}/bin/bash ${initdir}/bin/sh chmod u+x ${initdir}/init +chmod u+x ${initdir}/fill-disk.sh cp -fau --parents ${bashdeps} ${initdir} cp -fau --parents ${utilLinux} ${initdir} cp -fau --parents ${coreUtilsDiet} ${initdir} -- GitLab From f74115278f5f633b620f05c938da3b4dd9932471 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 31 Aug 2005 12:58:46 +0000 Subject: [PATCH 0095/5331] add a shell on tty2 svn path=/nixu/trunk/; revision=3760 --- fill-disk.sh | 4 ++++ make-disk.sh | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/fill-disk.sh b/fill-disk.sh index 6ae875cab94..cf9a4c5eaec 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -88,6 +88,10 @@ mknod -m 0660 /dev/hdd3 b 22 67 mknod -m 0600 /dev/initctl p +echo starting emergency shell on tty2 + +exec ./ramdisk-login.sh /dev/tty2 & + targetdrive=/dev/hda device=${targetdrive}1 mkfs.ext2 ${device} diff --git a/make-disk.sh b/make-disk.sh index 115cd722bfa..aad35e52d2e 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -7,6 +7,7 @@ archivesDir=/tmp/arch manifest=${archivesDir}/MANIFEST nixpkgs=/nixpkgs/trunk/pkgs fill_disk=$archivesDir/scripts/fill-disk.sh +ramdisk_login=$archivesDir/scripts/ramdisk-login.sh storePaths=$archivesDir/mystorepaths validatePaths=$archivesDir/validatepaths bootiso=/tmp/nixos.iso @@ -172,6 +173,26 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk +sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ + -e "s^@bootPath\@^$bootPath^g" \ + -e "s^@NIX_CMD_PATH\@^$nix^g" \ + -e "s^@bash\@^$bash^g" \ + -e "s^@findutils\@^$findutils^g" \ + -e "s^@coreutilsdiet\@^$coreutilsdiet^g" \ + -e "s^@coreutils\@^$coreutils^g" \ + -e "s^@utillinux\@^$utillinux^g" \ + -e "s^@e2fsprogs\@^$e2fsprogs^g" \ + -e "s^@modutils\@^$modutils^g" \ + -e "s^@grub\@^$grub^g" \ + -e "s^@kernel\@^$kernel^g" \ + -e "s^@hotplug\@^$hotplug^g" \ + -e "s^@gnugrep\@^$gnugrep^g" \ + -e "s^@which\@^$which^g" \ + -e "s^@gnutar\@^$gnutar^g" \ + -e "s^@mingetty\@^$mingettyWrapper^g" \ + < $ramdisk_login > $ramdisk_login.tmp +mv $ramdisk_login.tmp $ramdisk_login + echo copying bootimage mkdir ${archivesDir}/isolinux @@ -190,10 +211,12 @@ echo creating ramdisk rm -f ${initrd} #cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/ +cp ${archivesDir}/scripts/ramdisk-login.sh ${initdir}/ cp ${archivesDir}/scripts/init.sh ${initdir}/init ln -s ${bash}/bin/bash ${initdir}/bin/sh chmod u+x ${initdir}/init chmod u+x ${initdir}/fill-disk.sh +chmod u+x ${initdir}/ramdisk-login.sh cp -fau --parents ${bashdeps} ${initdir} cp -fau --parents ${utilLinux} ${initdir} cp -fau --parents ${coreUtilsDiet} ${initdir} -- GitLab From b86eb3cf4f6d2a24747402f98ad7dea8830f8ee7 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 31 Aug 2005 13:26:20 +0000 Subject: [PATCH 0096/5331] don't forget ramdisk login script svn path=/nixu/trunk/; revision=3761 --- ramdisk-login.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ramdisk-login.sh diff --git a/ramdisk-login.sh b/ramdisk-login.sh new file mode 100644 index 00000000000..5ef5117cfe9 --- /dev/null +++ b/ramdisk-login.sh @@ -0,0 +1,15 @@ +#! @bash@/bin/sh -e + +export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin + +tty=$1 + +exec < $tty > $tty 2>&1 + +echo +echo "=== Welcome to Nix! ===" + +export HOME=/ +cd $HOME + +exec @bash@/bin/sh -- GitLab From 066c85b4f0e52ab4864d890480c94df0d29de715 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 31 Aug 2005 16:38:34 +0000 Subject: [PATCH 0097/5331] run a busy loop after we've finished the install, instead of kernel panicking svn path=/nixu/trunk/; revision=3762 --- fill-disk.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index cf9a4c5eaec..fc3bb782e9d 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -348,8 +348,13 @@ cp /tmp/install-log $root/root echo umounting filesystem umount $root +umount /cdrom echo install done -#telinit 0 ln -s @sysvinitPath@/sbin/init /sbin/init -shutdown -h now + +echo it\'s safe to turn off your machine + +while true; do + sleep 60; +done -- GitLab From 9f0a098056d60bed104cd6bc76d9b185d106d24b Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 2 Sep 2005 16:47:58 +0000 Subject: [PATCH 0098/5331] fix error in detection of NixOS install CD svn path=/nixu/trunk/; revision=3772 --- fill-disk.sh | 24 +++++++++++++----------- make-disk.sh | 6 ++++-- pkgs.nix | 6 +++--- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index fc3bb782e9d..65499c7df83 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin +export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@eject@/bin ## ## In the beginning we want to have a minimalistic environment, built with @@ -187,7 +187,7 @@ mknod -m 0600 $root/dev/tty1 c 4 1 mknod -m 0444 $root/dev/urandom c 1 9 rm -f $root/etc/mtab -#ln -s /proc/mounts $root/etc/mtab +ln -s /proc/mounts $root/etc/mtab ## Probe for CD device which contains our CD here and mount /nix and ## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this. @@ -198,15 +198,15 @@ DEVICES="/dev/hd?" for i in ${DEVICES} do echo "Looking for CDROM in: $i" -if mount -t iso9660 $i /cdrom >/dev/null 2>&1 -then - if test -f /cdrom/NIXOS + if mount -t iso9660 $i /cdrom >/dev/null 2>&1 then - cddevice=$i - echo "Accessing NixOS CDROM at $i" - break + if test -f /cdrom/NIXOS + then + cddevice=$i + echo "Accessing NixOS CDROM at $i" + break + fi fi -fi done echo switch to /nix and /nixpkgs from CD @@ -327,6 +327,7 @@ ln -s @hotplug@/sbin/hotplug $root/sbin/hotplug ln -s @hotplug@/etc/hotplug $root/etc/hotplug ln -s @hotplug@/etc/hotplug.d $root/etc/hotplug.d ln -s $device $root/dev/root +ln -s @sysvinitPath@/sbin/init /sbin/init echo installing bootloader @@ -348,11 +349,12 @@ cp /tmp/install-log $root/root echo umounting filesystem umount $root +#umount /nix umount /cdrom +#echo ejecting $cddevice +#eject $cddevice echo install done -ln -s @sysvinitPath@/sbin/init /sbin/init - echo it\'s safe to turn off your machine while true; do diff --git a/make-disk.sh b/make-disk.sh index aad35e52d2e..7f6be2694e6 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -87,6 +87,7 @@ nano=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX_CMD_P gnugrep=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -)) which=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).which' | $NIX_CMD_PATH/nix-instantiate -)) gnutar=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX_CMD_PATH/nix-instantiate -)) +eject=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).eject' | $NIX_CMD_PATH/nix-instantiate -)) #(while read storepath; do #cp -fa --parents ${storepath} ${archivesDir} @@ -168,6 +169,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@hotplug\@^$hotplug^g" \ -e "s^@gnugrep\@^$gnugrep^g" \ -e "s^@which\@^$which^g" \ + -e "s^@eject\@^$eject^g" \ -e "s^@gnutar\@^$gnutar^g" \ -e "s^@mingetty\@^$mingettyWrapper^g" \ < $fill_disk > $fill_disk.tmp @@ -223,9 +225,9 @@ cp -fau --parents ${coreUtilsDiet} ${initdir} cp -fau --parents ${e2fsProgs} ${initdir} cp -fau --parents ${modUtils} ${initdir} cp -fau --parents ${hotplug} ${initdir} -#cp -fau --parents ${which} ${initdir} +cp -fau --parents ${eject} ${initdir} -touch ${initdir}/NIXOS +touch ${archivesDir}/NIXOS (cd ${initdir}; find . |cpio -H newc -o) | gzip -9 > ${initrd} diff --git a/pkgs.nix b/pkgs.nix index fff17e9921d..78d6805dee8 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -5,7 +5,7 @@ rec { nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted module_init_tools hotplug udev - dhcpWrapper man nano; + dhcpWrapper man nano eject; boot = (import ./boot) {inherit stdenv kernel bash coreutils findutilsWrapper utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim @@ -15,7 +15,7 @@ rec { init = (import ./init) {inherit stdenv bash coreutilsDiet utillinux e2fsprogsDiet nix shadowutils mingettyWrapper grubWrapper parted module_init_tools hotplug - dhcpWrapper man nano;}; + dhcpWrapper man nano eject;}; - everything = [boot sysvinit kernel]; + everything = [boot sysvinit kernel eject]; } -- GitLab From f8cea32cf1dd89a465c9a1de94684b35e06c0d78 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 30 Sep 2005 15:22:08 +0000 Subject: [PATCH 0099/5331] add some stuff, incl. some things to /etc/inittab, but keep them outcommented svn path=/nixu/trunk/; revision=3976 --- fill-disk.sh | 2 +- make-disk.sh | 10 ++++++---- pkgs.nix | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 65499c7df83..ddb75f0506f 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -279,7 +279,7 @@ echo "id:2:initdefault:" >> $root/etc/inittab echo "si::bootwait:$bootPath/bin/boot.sh" >> $root/etc/inittab echo "ht:06:wait:$bootPath/bin/halt.sh" >> $root/etc/inittab echo "1:2345:respawn:$bootPath/bin/login.sh /dev/tty1" >> $root/etc/inittab -#echo "2:2345:respawn:$mingetty/sbin/mingetty tty2" >> $root/etc/inittab +echo #"2:2345:respawn:$mingetty/sbin/mingetty tty2" >> $root/etc/inittab #echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab echo setting up networking information... diff --git a/make-disk.sh b/make-disk.sh index 7f6be2694e6..f8293d9c38a 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -88,6 +88,7 @@ gnugrep=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX which=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).which' | $NIX_CMD_PATH/nix-instantiate -)) gnutar=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX_CMD_PATH/nix-instantiate -)) eject=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).eject' | $NIX_CMD_PATH/nix-instantiate -)) +sysklogd=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).sysklogd' | $NIX_CMD_PATH/nix-instantiate -)) #(while read storepath; do #cp -fa --parents ${storepath} ${archivesDir} @@ -125,8 +126,8 @@ mkdir ${initdir}/var/run echo copying nixpkgs -svn export ${nixpkgs} ${archivesDir}/pkgs -#cp -fa ${nixpkgs} ${archivesDir} +#svn export ${nixpkgs} ${archivesDir}/pkgs +cp -fa ${nixpkgs} ${archivesDir} #echo copying packages from store @@ -170,6 +171,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@gnugrep\@^$gnugrep^g" \ -e "s^@which\@^$which^g" \ -e "s^@eject\@^$eject^g" \ + -e "s^@sysklogd\@^$sysklogd^g" \ -e "s^@gnutar\@^$gnutar^g" \ -e "s^@mingetty\@^$mingettyWrapper^g" \ < $fill_disk > $fill_disk.tmp @@ -225,7 +227,7 @@ cp -fau --parents ${coreUtilsDiet} ${initdir} cp -fau --parents ${e2fsProgs} ${initdir} cp -fau --parents ${modUtils} ${initdir} cp -fau --parents ${hotplug} ${initdir} -cp -fau --parents ${eject} ${initdir} +#cp -fau --parents ${eject} ${initdir} touch ${archivesDir}/NIXOS @@ -248,4 +250,4 @@ mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin -c isolinux/boot.cat \ echo cleaning up chmod -f -R +w ${archivesDir}/* -rm -rf ${archivesDir}/* +#rm -rf ${archivesDir}/* diff --git a/pkgs.nix b/pkgs.nix index 78d6805dee8..a995404f335 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -5,7 +5,7 @@ rec { nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted module_init_tools hotplug udev - dhcpWrapper man nano eject; + dhcpWrapper man nano eject sysklogd; boot = (import ./boot) {inherit stdenv kernel bash coreutils findutilsWrapper utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim @@ -17,5 +17,5 @@ rec { nix shadowutils mingettyWrapper grubWrapper parted module_init_tools hotplug dhcpWrapper man nano eject;}; - everything = [boot sysvinit kernel eject]; + everything = [boot sysvinit kernel sysklogd]; } -- GitLab From 18a56f26a286a0faa89d8ac037959e81be18ca48 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 30 Sep 2005 16:50:35 +0000 Subject: [PATCH 0100/5331] argh! If we want to have # echoed into a file, make sure to enclose it in brackets... svn path=/nixu/trunk/; revision=3980 --- fill-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fill-disk.sh b/fill-disk.sh index ddb75f0506f..cfa52a5aa29 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -279,7 +279,7 @@ echo "id:2:initdefault:" >> $root/etc/inittab echo "si::bootwait:$bootPath/bin/boot.sh" >> $root/etc/inittab echo "ht:06:wait:$bootPath/bin/halt.sh" >> $root/etc/inittab echo "1:2345:respawn:$bootPath/bin/login.sh /dev/tty1" >> $root/etc/inittab -echo #"2:2345:respawn:$mingetty/sbin/mingetty tty2" >> $root/etc/inittab +echo "#2:2345:respawn:$mingetty/sbin/mingetty tty2" >> $root/etc/inittab #echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab echo setting up networking information... -- GitLab From d04db9e95fcadb76dd97d52fc44bfa90b39ccbab Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 3 Oct 2005 15:44:10 +0000 Subject: [PATCH 0101/5331] small howto on how to install today's version of NixOS. svn path=/nixu/trunk/; revision=4001 --- howto | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 howto diff --git a/howto b/howto new file mode 100644 index 00000000000..3e7f4f0fd9d --- /dev/null +++ b/howto @@ -0,0 +1,74 @@ +NixOS installation HOWTO -- October 3, 2005 + +This is small HOWTO of how to build and install the current version of +NixOS. + + + Building + +Install Nix. Checkout nixpkgs from Subversion, as well as nixu. Adapt the +scripts in nixu to reflect the location of nixpkgs (default /nixpkgs). +Make a directory /tmp/arch. Run ./make-disk.sh. Wait. + + Burning + +Use your favourite tool to burn the ISO image to a CD. + + Preparing the host machine + +Currently NixOS can only be installed with machines that have a specific +hardware set up: + +An ATA harddisk on the first ATA controller (hda) with: +- data partition (hda1) +- swap partition (hda2) + +All data on these two partitions will be wiped and the bootloader in the +Master Boot Record (MBR) will be overwritten with GRUB. + + Booting + +Insert the CD, make sure it can boot from CD and reboot. Let it run for a +while. + + Configuring + +To get NixOS in a working state, do the following: + +- load the networkdriver. This is machine dependent. On the labmachines this +is the e1000 driver: + +# modprobe e1000 + +- bring the interface up: + +# ifconfig eth0 up + +If the interface is different (say, eth1) replace eth0 with the right +interface. + +- if DHCP is used, run a DHCP client to obtain an IP address: + +# dhclient eth0 + +The interface will not be configured, but it will give you all the right +information needed to configure the interface. + +# ifconfig eth0 netmask +# route add default gw +# vim /etc/resolv.conf + + Making logins on virtual consoles work. + +Logins on virtual consoles are disabled by default. To make them work: + +- edit /etc/inittab and outcomment the lines with "mingetty" in them +- copy /etc/services from a working Linux machine to /etc/services on the +NixOS machine (needed for sysklogd) +- copy /etc/syslog.conf from a working Linux machine to /etc/syslog.conf on the +NixOS machine (needed for sysklogd) +- launch sysklogd +- copy /etc/login.defs from a working Linux machine to /etc/login.defs on the +NixOS machine (needed for mingetty) +- chmod +x /path/to/mingetty +- relaunch init -- GitLab From 83aa84be942ad8990ea2ce754ac3e4cfef2d9eb8 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 11 Oct 2005 10:48:10 +0000 Subject: [PATCH 0102/5331] no longer hardcode the directory where we put our stuff in (previously /tmp/arch), but use mktemp instead, which is a *lot* cleaner. Update documentation accordingly. svn path=/nixu/trunk/; revision=4047 --- howto | 2 +- make-disk.sh | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/howto b/howto index 3e7f4f0fd9d..13b8aa3b8bf 100644 --- a/howto +++ b/howto @@ -8,7 +8,7 @@ NixOS. Install Nix. Checkout nixpkgs from Subversion, as well as nixu. Adapt the scripts in nixu to reflect the location of nixpkgs (default /nixpkgs). -Make a directory /tmp/arch. Run ./make-disk.sh. Wait. +Make sure mktemp is installed. Run ./make-disk.sh. Wait. Burning diff --git a/make-disk.sh b/make-disk.sh index f8293d9c38a..6e87f0e488f 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -3,7 +3,7 @@ # deps is an array declare -a deps -archivesDir=/tmp/arch +archivesDir=$(mktemp -d) manifest=${archivesDir}/MANIFEST nixpkgs=/nixpkgs/trunk/pkgs fill_disk=$archivesDir/scripts/fill-disk.sh @@ -15,13 +15,6 @@ initrd=/tmp/initram.img initdir=${archivesDir}/initdir initscript=$archivesDir/scripts/init.sh -echo cleaning old build - -# keep chmod happy -touch ${archivesDir}/blah -chmod -f -R +w ${archivesDir}/* -rm -rf ${archivesDir}/* - NIX_CMD_PATH=$(dirname $(which nix-store)) storeExpr=$($NIX_CMD_PATH/nix-store -qR $($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -))) @@ -250,4 +243,4 @@ mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin -c isolinux/boot.cat \ echo cleaning up chmod -f -R +w ${archivesDir}/* -#rm -rf ${archivesDir}/* +rm -rf ${archivesDir}/* -- GitLab From 583ce934a8d0b1493c88e4d9893041c82f08e4d7 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 11 Oct 2005 19:39:41 +0000 Subject: [PATCH 0103/5331] - add NIC driver info for vmware - add profile support svn path=/nixu/trunk/; revision=4069 --- fill-disk.sh | 6 +++++- howto | 2 ++ make-disk.sh | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index cfa52a5aa29..ad50100ddd5 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -221,7 +221,7 @@ export NIX_DATA_DIR=$root/nix/share export NIX_LOG_DIR=$root/nix/log/nix export NIX_STATE_DIR=$root/nix/var/nix export NIX_CONF_DIR=$root/nix/etc -NIX_CMD_PATH=@NIX_CMD_PATH@/bin +NIX_CMD_PATH=@nix@/bin echo initialising Nix DB... $NIX_CMD_PATH/nix-store --init @@ -265,6 +265,7 @@ tar cf - /nix/store | tar --directory=$root -xvf - echo registering valid paths... $NIX_CMD_PATH/nix-store --register-validity < $root/tmp/mystorepaths +$NIX_CMD_PATH/nix-env -iKf /nixpkgs/trunk/pkgs/system/i686-linux.nix nix echo setting init symlink... rm -f $root/init @@ -297,6 +298,9 @@ echo "root:x:0:root" > $root/etc/group echo "root:x:0:0:root:/root:/bin/sh" > $root/etc/passwd echo "root::12757:0:99999:7:::" > $root/etc/shadow +echo default profile for root +echo "source @nix@/etc/profile.d/nix.sh" > $root/root/.profile + ### ### Do kernel stuff here. ### diff --git a/howto b/howto index 13b8aa3b8bf..640f2b1a0a2 100644 --- a/howto +++ b/howto @@ -40,6 +40,8 @@ is the e1000 driver: # modprobe e1000 +In vmware the driver is "pcnet32". + - bring the interface up: # ifconfig eth0 up diff --git a/make-disk.sh b/make-disk.sh index 6e87f0e488f..831c2eed7a3 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -150,7 +150,7 @@ sed -e "s^@bash\@^$bash^g" \ mv $initscript.tmp $initscript sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@bootPath\@^$bootPath^g" \ - -e "s^@NIX_CMD_PATH\@^$nix^g" \ + -e "s^@nix\@^$nix^g" \ -e "s^@bash\@^$bash^g" \ -e "s^@findutils\@^$findutils^g" \ -e "s^@coreutilsdiet\@^$coreutilsdiet^g" \ -- GitLab From b53b6e5b436a8d1fae619481eb4b10f230c96668 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 12 Oct 2005 22:40:10 +0000 Subject: [PATCH 0104/5331] dhclient works now, adapt documentation svn path=/nixu/trunk/; revision=4080 --- howto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/howto b/howto index 640f2b1a0a2..366f2947a9b 100644 --- a/howto +++ b/howto @@ -49,12 +49,12 @@ In vmware the driver is "pcnet32". If the interface is different (say, eth1) replace eth0 with the right interface. -- if DHCP is used, run a DHCP client to obtain an IP address: +- if DHCP is used, run a DHCP client to obtain an IP address, routing +and resolving information: # dhclient eth0 -The interface will not be configured, but it will give you all the right -information needed to configure the interface. +Otherwise, do this yourself: # ifconfig eth0 netmask # route add default gw -- GitLab From e378ef0bf443794ce7708889fe864e1bfcbaef6f Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 14 Oct 2005 10:42:06 +0000 Subject: [PATCH 0105/5331] update documentation svn path=/nixu/trunk/; revision=4087 --- howto | 1 - 1 file changed, 1 deletion(-) diff --git a/howto b/howto index 366f2947a9b..000e9fd2ee9 100644 --- a/howto +++ b/howto @@ -72,5 +72,4 @@ NixOS machine (needed for sysklogd) - launch sysklogd - copy /etc/login.defs from a working Linux machine to /etc/login.defs on the NixOS machine (needed for mingetty) -- chmod +x /path/to/mingetty - relaunch init -- GitLab From 569bbf75b1e89aecf0c5c650be0c49d0ddc9fc9e Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 16 Oct 2005 21:48:33 +0000 Subject: [PATCH 0106/5331] don't make /bin/bash anymore svn path=/nixu/trunk/; revision=4095 --- fill-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fill-disk.sh b/fill-disk.sh index ad50100ddd5..9f671bce04d 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -272,7 +272,7 @@ rm -f $root/init #ln -s $sysvinitPath/sbin/init $root/init ln -s @sysvinitPath@/sbin/init $root/sbin/init ln -s @bash@/bin/sh $root/bin/sh -ln -s @bash@/bin/bash $root/bin/bash +#ln -s @bash@/bin/bash $root/bin/bash echo setting up inittab... rm -f $root/etc/inittab -- GitLab From b084dc18b3ca50a839f1e98c305f364a5650f1ed Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 19 Oct 2005 14:07:21 +0000 Subject: [PATCH 0107/5331] also add coreutils to Nix default profile svn path=/nixu/trunk/; revision=4106 --- fill-disk.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/fill-disk.sh b/fill-disk.sh index 9f671bce04d..5b0495a5328 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -266,6 +266,7 @@ echo registering valid paths... $NIX_CMD_PATH/nix-store --register-validity < $root/tmp/mystorepaths $NIX_CMD_PATH/nix-env -iKf /nixpkgs/trunk/pkgs/system/i686-linux.nix nix +$NIX_CMD_PATH/nix-env -iKf /nixpkgs/trunk/pkgs/system/i686-linux.nix coreutils echo setting init symlink... rm -f $root/init -- GitLab From 22195d35a598a922ed56d823c14f7eff5f42a56f Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 19 Oct 2005 14:14:08 +0000 Subject: [PATCH 0108/5331] make /etc/sysconfig so we can store information, such as hardware configuration of the box (needed for Kudzu) svn path=/nixu/trunk/; revision=4107 --- fill-disk.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/fill-disk.sh b/fill-disk.sh index 5b0495a5328..fc51a3f106e 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -140,6 +140,7 @@ make_dir 00755 /boot make_dir 00755 /dev make_dir 00755 /dev/pts make_dir 00755 /etc # global non-constant configuration +make_dir 00755 /etc/sysconfig make_dir 00755 /etc-secret make_dir 00755 /home make_dir 00755 /lib -- GitLab From 988e34e5bc161ee109970641f35de28a7aa4f4bb Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 12 Dec 2005 14:45:46 +0000 Subject: [PATCH 0109/5331] touch an empty login.defs, needed for login svn path=/nixu/trunk/; revision=4353 --- init/install-disk.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/init/install-disk.sh b/init/install-disk.sh index 9e18719f208..de158cda600 100755 --- a/init/install-disk.sh +++ b/init/install-disk.sh @@ -81,6 +81,7 @@ mknod $root/dev/null c 1 3 touch_file /etc/passwd touch_file /etc/shadow touch_file /etc/group +touch_file /etc/login.defs rm -f $root/etc/mtab #ln -s /proc/mounts $root/etc/mtab -- GitLab From 5d0899c0bcb9024a3b0ecb1a162ea21014f6573e Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 13 Dec 2005 14:24:31 +0000 Subject: [PATCH 0110/5331] add a bunch of stuff for SSH user privilege seperation (yes, we want this) svn path=/nixu/trunk/; revision=4361 --- fill-disk.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fill-disk.sh b/fill-disk.sh index fc51a3f106e..dbc18322d58 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -167,6 +167,8 @@ make_dir 00755 /sys make_dir 01777 /tmp make_dir 00755 /usr make_dir 00755 /var +make_dir 00755 /var/empty +make_dir 00111 /var/empty/sshd make_dir 00755 /var/log make_dir 00755 /var/run make_dir 00755 /var/spool @@ -297,8 +299,11 @@ echo "127.0.0.1 localhost" >> $root/etc/hosts echo setting up initial account information... echo "root:x:0:root" > $root/etc/group +echo "sshd:x:74:" >> $root/etc/group echo "root:x:0:0:root:/root:/bin/sh" > $root/etc/passwd -echo "root::12757:0:99999:7:::" > $root/etc/shadow +echo "sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin" >> $root/etc/passwd +echo "root::12757:0:99999:7:::" >> $root/etc/shadow +echo "sshd:!!:12757:0:99999:7:::" >> $root/etc/shadow echo default profile for root echo "source @nix@/etc/profile.d/nix.sh" > $root/root/.profile -- GitLab From ec790cdf85f1535ea1a119b184ad8ef6bda40e5c Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 13 Dec 2005 14:28:55 +0000 Subject: [PATCH 0111/5331] add a seperate dir for SSH-keys. Remove the /etc-secret dir, we probably won't be using it anyway... svn path=/nixu/trunk/; revision=4362 --- fill-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fill-disk.sh b/fill-disk.sh index dbc18322d58..1ea71f23acf 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -140,8 +140,8 @@ make_dir 00755 /boot make_dir 00755 /dev make_dir 00755 /dev/pts make_dir 00755 /etc # global non-constant configuration +make_dir 00755 /etc/ssh make_dir 00755 /etc/sysconfig -make_dir 00755 /etc-secret make_dir 00755 /home make_dir 00755 /lib make_dir 00755 /lib/modules -- GitLab From ff840ef21c5ce18f5e76fec2010132e5a783aa3d Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 14 Dec 2005 00:46:59 +0000 Subject: [PATCH 0112/5331] small corrections to the installer svn path=/nixu/trunk/; revision=4368 --- howto | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/howto b/howto index 000e9fd2ee9..057fb17276b 100644 --- a/howto +++ b/howto @@ -60,16 +60,22 @@ Otherwise, do this yourself: # route add default gw # vim /etc/resolv.conf - Making logins on virtual consoles work. - -Logins on virtual consoles are disabled by default. To make them work: + Making syslog work. -- edit /etc/inittab and outcomment the lines with "mingetty" in them - copy /etc/services from a working Linux machine to /etc/services on the NixOS machine (needed for sysklogd) - copy /etc/syslog.conf from a working Linux machine to /etc/syslog.conf on the NixOS machine (needed for sysklogd) - launch sysklogd + + Making logins on virtual consoles work. + +Logins on virtual consoles are disabled by default. To make them work: + +- edit /etc/inittab and outcomment the lines with "mingetty" in them - copy /etc/login.defs from a working Linux machine to /etc/login.defs on the -NixOS machine (needed for mingetty) +NixOS machine (needed for mingetty). Alternatively, do: + +# touch /etc/login.defs + - relaunch init -- GitLab From f130123af58709952d2ecfcd5b0d824b49f963cf Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 22 Dec 2005 19:34:36 +0000 Subject: [PATCH 0113/5331] also make /var/lock and /var/lock/subsys: needed for ssh and others svn path=/nixu/trunk/; revision=4414 --- fill-disk.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fill-disk.sh b/fill-disk.sh index 1ea71f23acf..d3206a7e7fe 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -169,6 +169,8 @@ make_dir 00755 /usr make_dir 00755 /var make_dir 00755 /var/empty make_dir 00111 /var/empty/sshd +make_dir 00755 /var/lock +make_dir 00755 /var/lock/subsys make_dir 00755 /var/log make_dir 00755 /var/run make_dir 00755 /var/spool -- GitLab From fe355bba78b0b0bfa78459940f77581a3644fef1 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sat, 24 Dec 2005 11:50:42 +0000 Subject: [PATCH 0114/5331] replace a lot of tools we initially use with statically linked versions. This reduces the ramdisk installer size with a few megabytes when gzipped, but with about 40 MB when unpacked in memory. There are a few improvements possible: - strip the binaries. This saves another few MBs. - only copy the binaries we really need to /bin or /sbin. This could reduce the size of the installer a lot, especially with util-linux, of which we don't use that many tools at all. - try to move some packages we link with glibc right now (like util-linux) to dietlibc. This will not work for bash, already tried that. - try to use busybox as a replacement for everything. svn path=/nixu/trunk/; revision=4428 --- boot/builder.sh | 2 ++ boot/default.nix | 4 ++-- fill-disk.sh | 18 ++++++++++---- make-disk.sh | 62 ++++++++++++++++++++++++++++++------------------ pkgs.nix | 14 +++++------ 5 files changed, 64 insertions(+), 36 deletions(-) diff --git a/boot/builder.sh b/boot/builder.sh index bef4682093d..bf747933083 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -9,9 +9,11 @@ for i in $boot $halt $login $env; do dst=$out/bin/$(basename $i | cut -c34-) sed \ -e "s^@bash\@^$bash^g" \ + -e "s^@bashStatic\@^$bashStatic^g" \ -e "s^@coreutils\@^$coreutils^g" \ -e "s^@findutilsWrapper\@^$findutilsWrapper^g" \ -e "s^@utillinux\@^$utillinux^g" \ + -e "s^@utillinuxStatic\@^$utillinuxStatic^g" \ -e "s^@sysvinit\@^$sysvinit^g" \ -e "s^@e2fsprogs\@^$e2fsprogs^g" \ -e "s^@nettools\@^$nettools^g" \ diff --git a/boot/default.nix b/boot/default.nix index 17957c934a7..12d80e54419 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,4 +1,4 @@ -{ stdenv, kernel, bash, coreutils, findutilsWrapper, utillinux, sysvinit, e2fsprogs +{ stdenv, kernel, bash, bashStatic, coreutils, findutilsWrapper, utillinux, utillinuxStatic, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep , gnutar, gzip, mingettyWrapper, grubWrapper, parted, module_init_tools, hotplug @@ -12,7 +12,7 @@ derivation { halt = ./halt.sh; login = ./login.sh; env = ./env.sh; - inherit stdenv kernel bash coreutils findutilsWrapper utillinux sysvinit + inherit stdenv kernel bash bashStatic coreutils findutilsWrapper utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper parted module_init_tools diff --git a/fill-disk.sh b/fill-disk.sh index d3206a7e7fe..3240b2b57d4 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@eject@/bin +export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@utilLinux@/bin:@utilLinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@eject@/bin:@kudzu@/sbin ## ## In the beginning we want to have a minimalistic environment, built with @@ -194,6 +194,7 @@ mknod -m 0444 $root/dev/urandom c 1 9 rm -f $root/etc/mtab ln -s /proc/mounts $root/etc/mtab + ## Probe for CD device which contains our CD here and mount /nix and ## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this. ## Find out how Knoppix and SUSE do this... @@ -221,6 +222,9 @@ echo switch to /nix and /nixpkgs from CD ln -s /cdrom/nixpkgs /nixpkgs mount --bind /cdrom/nix /nix +echo probing for hardware... + +kudzu export NIX_DATA_DIR=$root/nix/share export NIX_LOG_DIR=$root/nix/log/nix @@ -228,6 +232,10 @@ export NIX_STATE_DIR=$root/nix/var/nix export NIX_CONF_DIR=$root/nix/etc NIX_CMD_PATH=@nix@/bin +echo bringing up networking... + +nic=`kudzu -p | grep eth | sort | uniq | cut -d ' ' -f 2` + echo initialising Nix DB... $NIX_CMD_PATH/nix-store --init @@ -290,13 +298,15 @@ echo "#2:2345:respawn:$mingetty/sbin/mingetty tty2" >> $root/etc/inittab #echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab echo setting up networking information... + make_dir 00755 /etc/networking -echo 192.168.150.1 > $root/etc/networking/local-ip -echo 192.168.150.3 > $root/etc/networking/gateway-ip #cp /etc/resolv.conf $root/etc rm -f $root/etc/hosts echo "127.0.0.1 localhost" >> $root/etc/hosts -#echo "192.168.150.1 uml" >> $root/etc/hosts + +echo storing hardware information... + +kudzu -p > $root/etc/sysconfig/hwconf echo setting up initial account information... diff --git a/make-disk.sh b/make-disk.sh index 831c2eed7a3..eda0f9cbd41 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -53,10 +53,10 @@ do tar -cf - $i | tar --directory=$archivesDir -xf - done -utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))) +utilLinux=$(nix-store -r $(echo '(import ./pkgs.nix).utillinuxStatic' | $NIX_CMD_PATH/nix-instantiate -)) coreUtilsDiet=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX_CMD_PATH/nix-instantiate -))) e2fsProgs=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX_CMD_PATH/nix-instantiate -))) -modUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).module_init_tools' | $NIX_CMD_PATH/nix-instantiate -))) +modUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX_CMD_PATH/nix-instantiate -))) Grub=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -))) #gnuSed=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX_CMD_PATH/nix-instantiate -))) #gnuGrep=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -))) @@ -64,13 +64,14 @@ Kernel=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix). SysVinit=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -))) BootPath=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -))) -bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)) +#bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)) +bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bashStatic' | $NIX_CMD_PATH/nix-instantiate -)) coreutilsdiet=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX_CMD_PATH/nix-instantiate -)) coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -)) findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX_CMD_PATH/nix-instantiate -)) utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)) e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX_CMD_PATH/nix-instantiate -)) -modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).module_init_tools' | $NIX_CMD_PATH/nix-instantiate -)) +modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX_CMD_PATH/nix-instantiate -)) grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -)) mingettyWrapper=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).mingettyWrapper' | $NIX_CMD_PATH/nix-instantiate -)) hotplug=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).hotplug' | $NIX_CMD_PATH/nix-instantiate -)) @@ -82,22 +83,23 @@ which=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).which' | $NIX_CMD gnutar=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX_CMD_PATH/nix-instantiate -)) eject=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).eject' | $NIX_CMD_PATH/nix-instantiate -)) sysklogd=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).sysklogd' | $NIX_CMD_PATH/nix-instantiate -)) +kudzu=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).kudzu' | $NIX_CMD_PATH/nix-instantiate -)) #(while read storepath; do #cp -fa --parents ${storepath} ${archivesDir} #done) < $storePaths -echo utillinux $utilLinux +#echo utillinux $utilLinux -for i in $utilLinux; do - echo i $i - deps=( $($NIX_CMD_PATH/nix-store -q --references $i) ) - echo length ${#deps[@]} - if test "${#deps[@]}" = 0 - then - echo zarro - fi -done +#for i in $utilLinux; do +# echo i $i +# deps=( $($NIX_CMD_PATH/nix-store -q --references $i) ) +# echo length ${#deps[@]} +# if test "${#deps[@]}" = 0 +# then +# echo zarro +# fi +#done echo creating directories for bootimage @@ -106,6 +108,7 @@ mkdir ${initdir}/bin mkdir ${initdir}/cdrom mkdir ${initdir}/dev mkdir ${initdir}/etc +mkdir ${initdir}/etc/sysconfig mkdir ${initdir}/installimage mkdir ${initdir}/modules mkdir ${initdir}/proc @@ -138,7 +141,7 @@ cp -fa ${nixpkgs} ${archivesDir} #cp -fvau --parents ${nano} ${archivesDir} #cp -fvau --parents ${gnutar} ${archivesDir} -bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))) +bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bashStatic' | $NIX_CMD_PATH/nix-instantiate -))) echo copying scripts @@ -155,6 +158,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@findutils\@^$findutils^g" \ -e "s^@coreutilsdiet\@^$coreutilsdiet^g" \ -e "s^@coreutils\@^$coreutils^g" \ + -e "s^@utilLinux\@^$utilLinux^g" \ -e "s^@utillinux\@^$utillinux^g" \ -e "s^@e2fsprogs\@^$e2fsprogs^g" \ -e "s^@modutils\@^$modutils^g" \ @@ -163,7 +167,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@hotplug\@^$hotplug^g" \ -e "s^@gnugrep\@^$gnugrep^g" \ -e "s^@which\@^$which^g" \ - -e "s^@eject\@^$eject^g" \ + -e "s^@kudzu\@^$kudzu^g" \ -e "s^@sysklogd\@^$sysklogd^g" \ -e "s^@gnutar\@^$gnutar^g" \ -e "s^@mingetty\@^$mingettyWrapper^g" \ @@ -177,7 +181,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@findutils\@^$findutils^g" \ -e "s^@coreutilsdiet\@^$coreutilsdiet^g" \ -e "s^@coreutils\@^$coreutils^g" \ - -e "s^@utillinux\@^$utillinux^g" \ + -e "s^@utillinux\@^$utilLinux^g" \ -e "s^@e2fsprogs\@^$e2fsprogs^g" \ -e "s^@modutils\@^$modutils^g" \ -e "s^@grub\@^$grub^g" \ @@ -203,6 +207,10 @@ echo copying kernel # of the kernel here. cp -L $kernel/vmlinuz ${archivesDir}/isolinux +echo linking kernel modules + +ln -s $kernel/lib $archivesDir/lib + echo creating ramdisk rm -f ${initrd} @@ -210,16 +218,24 @@ rm -f ${initrd} cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/ cp ${archivesDir}/scripts/ramdisk-login.sh ${initdir}/ cp ${archivesDir}/scripts/init.sh ${initdir}/init -ln -s ${bash}/bin/bash ${initdir}/bin/sh +#ln -s ${bash}/bin/bash ${initdir}/bin/sh +cp ${bash}/bin/bash ${initdir}/bin/sh chmod u+x ${initdir}/init chmod u+x ${initdir}/fill-disk.sh chmod u+x ${initdir}/ramdisk-login.sh -cp -fau --parents ${bashdeps} ${initdir} +#cp -fau --parents ${bashdeps} ${initdir} +#cp -fau --parents ${utilLinux} ${initdir} +#cp -fau --parents ${coreUtilsDiet} ${initdir} +#cp -fau --parents ${e2fsProgs} ${initdir} +#cp -fau --parents ${modUtils} ${initdir} +#cp -fau --parents ${hotplug} ${initdir} +cp -fau --parents ${bash} ${initdir} cp -fau --parents ${utilLinux} ${initdir} -cp -fau --parents ${coreUtilsDiet} ${initdir} -cp -fau --parents ${e2fsProgs} ${initdir} -cp -fau --parents ${modUtils} ${initdir} +cp -fau --parents ${coreutilsdiet} ${initdir} +cp -fau --parents ${e2fsprogs} ${initdir} +cp -fau --parents ${modutils} ${initdir} cp -fau --parents ${hotplug} ${initdir} +#cp -fau --parents ${kudzu} ${initdir} #cp -fau --parents ${eject} ${initdir} touch ${archivesDir}/NIXOS @@ -243,4 +259,4 @@ mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin -c isolinux/boot.cat \ echo cleaning up chmod -f -R +w ${archivesDir}/* -rm -rf ${archivesDir}/* +#rm -rf ${archivesDir}/* diff --git a/pkgs.nix b/pkgs.nix index a995404f335..e1a4288c156 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,21 +1,21 @@ rec { inherit (import /nixpkgs/trunk/pkgs/system/i686-linux.nix) - stdenv kernel bash coreutils coreutilsDiet findutilsWrapper utillinux sysvinit + stdenv kernel bash bashStatic coreutils coreutilsDiet findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogsDiet e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip - mingettyWrapper grubWrapper syslinux parted module_init_tools hotplug udev - dhcpWrapper man nano eject sysklogd; + mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic hotplug udev + dhcpWrapper man nano eject sysklogd kudzu; - boot = (import ./boot) {inherit stdenv kernel bash coreutils findutilsWrapper - utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim + boot = (import ./boot) {inherit stdenv kernel bash bashStatic coreutils findutilsWrapper + utillinux utillinuxStatic sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper parted module_init_tools hotplug udev dhcpWrapper man nano;}; - init = (import ./init) {inherit stdenv bash coreutilsDiet utillinux e2fsprogsDiet + init = (import ./init) {inherit stdenv bash bashStatic coreutilsDiet utillinux e2fsprogsDiet nix shadowutils mingettyWrapper grubWrapper parted module_init_tools hotplug dhcpWrapper man nano eject;}; - everything = [boot sysvinit kernel sysklogd]; + everything = [boot sysvinit kernel sysklogd kudzu]; } -- GitLab From d124bd94348234da8e21369fa0ceeb4fa511b518 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sat, 24 Dec 2005 21:15:24 +0000 Subject: [PATCH 0115/5331] some more tweaks. Enable extra logins on tty2 and tty3. Default root password is empty. svn path=/nixu/trunk/; revision=4429 --- fill-disk.sh | 12 +++++++++--- make-disk.sh | 26 +++++++++++++++----------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 3240b2b57d4..93e55f5a979 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@utilLinux@/bin:@utilLinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@eject@/bin:@kudzu@/sbin +export PATH=/bin:/sbin:@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@utilLinux@/bin:@utilLinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@eject@/bin:@kudzu@/sbin ## ## In the beginning we want to have a minimalistic environment, built with @@ -236,6 +236,8 @@ echo bringing up networking... nic=`kudzu -p | grep eth | sort | uniq | cut -d ' ' -f 2` +echo "NIC: $nic" + echo initialising Nix DB... $NIX_CMD_PATH/nix-store --init @@ -285,7 +287,7 @@ echo setting init symlink... rm -f $root/init #ln -s $sysvinitPath/sbin/init $root/init ln -s @sysvinitPath@/sbin/init $root/sbin/init -ln -s @bash@/bin/sh $root/bin/sh +ln -s @bashGlibc@/bin/sh $root/bin/sh #ln -s @bash@/bin/bash $root/bin/bash echo setting up inittab... @@ -294,7 +296,8 @@ echo "id:2:initdefault:" >> $root/etc/inittab echo "si::bootwait:$bootPath/bin/boot.sh" >> $root/etc/inittab echo "ht:06:wait:$bootPath/bin/halt.sh" >> $root/etc/inittab echo "1:2345:respawn:$bootPath/bin/login.sh /dev/tty1" >> $root/etc/inittab -echo "#2:2345:respawn:$mingetty/sbin/mingetty tty2" >> $root/etc/inittab +echo "2:2345:respawn:$mingetty/sbin/mingetty tty2" >> $root/etc/inittab +echo "3:2345:respawn:$mingetty/sbin/mingetty tty3" >> $root/etc/inittab #echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab echo setting up networking information... @@ -307,6 +310,7 @@ echo "127.0.0.1 localhost" >> $root/etc/hosts echo storing hardware information... kudzu -p > $root/etc/sysconfig/hwconf +#cp /etc/modprobe.conf $root/etc/ echo setting up initial account information... @@ -320,6 +324,8 @@ echo "sshd:!!:12757:0:99999:7:::" >> $root/etc/shadow echo default profile for root echo "source @nix@/etc/profile.d/nix.sh" > $root/root/.profile +touch_file /etc/login.defs + ### ### Do kernel stuff here. ### diff --git a/make-disk.sh b/make-disk.sh index eda0f9cbd41..ccca59b28f4 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -64,7 +64,7 @@ Kernel=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix). SysVinit=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -))) BootPath=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -))) -#bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)) +bashGlibc=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)) bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bashStatic' | $NIX_CMD_PATH/nix-instantiate -)) coreutilsdiet=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX_CMD_PATH/nix-instantiate -)) coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -)) @@ -124,6 +124,7 @@ echo copying nixpkgs #svn export ${nixpkgs} ${archivesDir}/pkgs cp -fa ${nixpkgs} ${archivesDir} +#tar cf $archivesDir #echo copying packages from store @@ -141,8 +142,6 @@ cp -fa ${nixpkgs} ${archivesDir} #cp -fvau --parents ${nano} ${archivesDir} #cp -fvau --parents ${gnutar} ${archivesDir} -bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bashStatic' | $NIX_CMD_PATH/nix-instantiate -))) - echo copying scripts mkdir ${archivesDir}/scripts @@ -155,6 +154,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@bootPath\@^$bootPath^g" \ -e "s^@nix\@^$nix^g" \ -e "s^@bash\@^$bash^g" \ + -e "s^@bashGlibc\@^$bashGlibc^g" \ -e "s^@findutils\@^$findutils^g" \ -e "s^@coreutilsdiet\@^$coreutilsdiet^g" \ -e "s^@coreutils\@^$coreutils^g" \ @@ -223,20 +223,24 @@ cp ${bash}/bin/bash ${initdir}/bin/sh chmod u+x ${initdir}/init chmod u+x ${initdir}/fill-disk.sh chmod u+x ${initdir}/ramdisk-login.sh -#cp -fau --parents ${bashdeps} ${initdir} #cp -fau --parents ${utilLinux} ${initdir} #cp -fau --parents ${coreUtilsDiet} ${initdir} #cp -fau --parents ${e2fsProgs} ${initdir} #cp -fau --parents ${modUtils} ${initdir} #cp -fau --parents ${hotplug} ${initdir} -cp -fau --parents ${bash} ${initdir} -cp -fau --parents ${utilLinux} ${initdir} -cp -fau --parents ${coreutilsdiet} ${initdir} -cp -fau --parents ${e2fsprogs} ${initdir} -cp -fau --parents ${modutils} ${initdir} -cp -fau --parents ${hotplug} ${initdir} +cp -fau --parents ${bash}/bin ${initdir} +cp -fau --parents ${utilLinux}/bin ${initdir} +chmod -R u+w ${initdir} +cp -fau --parents ${utilLinux}/sbin ${initdir} +cp -fau --parents ${coreutilsdiet}/bin ${initdir} +cp -fau --parents ${e2fsprogs}/bin ${initdir} +chmod -R u+w ${initdir} +cp -fau --parents ${e2fsprogs}/sbin ${initdir} +cp -fau --parents ${modutils}/bin ${initdir} +chmod -R u+w ${initdir} +cp -fau --parents ${modutils}/sbin ${initdir} +#cp -fau --parents ${hotplug} ${initdir} #cp -fau --parents ${kudzu} ${initdir} -#cp -fau --parents ${eject} ${initdir} touch ${archivesDir}/NIXOS -- GitLab From dfa61299fe29934f6aaa2238056ffb5e5bf0a1a0 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 4 Jan 2006 18:19:23 +0000 Subject: [PATCH 0116/5331] add module_init_tools/bin to the initial path on tty1 svn path=/nixu/trunk/; revision=4488 --- boot/env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/env.sh b/boot/env.sh index ee481270ee9..e5e6051c0ac 100644 --- a/boot/env.sh +++ b/boot/env.sh @@ -1 +1 @@ -export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutilsWrapper@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingettyWrapper@/sbin:@grub@/bin:@grub@/sbin:@module_init_tools@/sbin:@dhcpWrapper@/sbin:@man@/bin:@nano@/bin +export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutilsWrapper@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingettyWrapper@/sbin:@grub@/bin:@grub@/sbin:@module_init_tools@/bin:@module_init_tools@/sbin:@dhcpWrapper@/sbin:@man@/bin:@nano@/bin -- GitLab From f20d80957c5eb6f29433f1d21a7cf2bd7144fd1b Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 6 Jan 2006 15:51:19 +0000 Subject: [PATCH 0117/5331] add some testscripts for generating kernel modules layout. Right now too much cruft gets symlinked, needs weeding and documenting...lots of documenting.... svn path=/nixu/trunk/; revision=4501 --- fill-disk.sh | 10 ++++----- make-disk.sh | 6 +++++- scripts/kernel.nix | 6 ++++++ scripts/make-kernel.sh | 49 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 scripts/kernel.nix create mode 100755 scripts/make-kernel.sh diff --git a/fill-disk.sh b/fill-disk.sh index 93e55f5a979..0687b4e7fb4 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -224,7 +224,7 @@ mount --bind /cdrom/nix /nix echo probing for hardware... -kudzu +#kudzu export NIX_DATA_DIR=$root/nix/share export NIX_LOG_DIR=$root/nix/log/nix @@ -232,11 +232,11 @@ export NIX_STATE_DIR=$root/nix/var/nix export NIX_CONF_DIR=$root/nix/etc NIX_CMD_PATH=@nix@/bin -echo bringing up networking... +#echo bringing up networking... -nic=`kudzu -p | grep eth | sort | uniq | cut -d ' ' -f 2` +#nic=`kudzu -p | grep eth | sort | uniq | cut -d ' ' -f 2` -echo "NIC: $nic" +#echo "NIC: $nic" echo initialising Nix DB... $NIX_CMD_PATH/nix-store --init @@ -309,7 +309,7 @@ echo "127.0.0.1 localhost" >> $root/etc/hosts echo storing hardware information... -kudzu -p > $root/etc/sysconfig/hwconf +#kudzu -p > $root/etc/sysconfig/hwconf #cp /etc/modprobe.conf $root/etc/ echo setting up initial account information... diff --git a/make-disk.sh b/make-disk.sh index ccca59b28f4..34a1c2b5f33 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -83,7 +83,7 @@ which=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).which' | $NIX_CMD gnutar=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX_CMD_PATH/nix-instantiate -)) eject=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).eject' | $NIX_CMD_PATH/nix-instantiate -)) sysklogd=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).sysklogd' | $NIX_CMD_PATH/nix-instantiate -)) -kudzu=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).kudzu' | $NIX_CMD_PATH/nix-instantiate -)) +#kudzu=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).kudzu' | $NIX_CMD_PATH/nix-instantiate -)) #(while read storepath; do #cp -fa --parents ${storepath} ${archivesDir} @@ -231,13 +231,17 @@ chmod u+x ${initdir}/ramdisk-login.sh cp -fau --parents ${bash}/bin ${initdir} cp -fau --parents ${utilLinux}/bin ${initdir} chmod -R u+w ${initdir} +echo utilLinux $utilLinux cp -fau --parents ${utilLinux}/sbin ${initdir} +echo coreutils cp -fau --parents ${coreutilsdiet}/bin ${initdir} cp -fau --parents ${e2fsprogs}/bin ${initdir} chmod -R u+w ${initdir} +echo e2fsprogs cp -fau --parents ${e2fsprogs}/sbin ${initdir} cp -fau --parents ${modutils}/bin ${initdir} chmod -R u+w ${initdir} +echo modutils cp -fau --parents ${modutils}/sbin ${initdir} #cp -fau --parents ${hotplug} ${initdir} #cp -fau --parents ${kudzu} ${initdir} diff --git a/scripts/kernel.nix b/scripts/kernel.nix new file mode 100644 index 00000000000..3a799a5ea4d --- /dev/null +++ b/scripts/kernel.nix @@ -0,0 +1,6 @@ +rec { + inherit (import /nixpkgs/trunk/pkgs/system/i686-linux.nix) + stdenv kernel ov511; + + everything = [kernel ov511]; +} diff --git a/scripts/make-kernel.sh b/scripts/make-kernel.sh new file mode 100755 index 00000000000..e3a199fb84a --- /dev/null +++ b/scripts/make-kernel.sh @@ -0,0 +1,49 @@ +#! /bin/sh -e + +archivesDir=$(mktemp -d) +manifest=${archivesDir}/MANIFEST +nixpkgs=/nixpkgs/trunk/pkgs +fill_disk=$archivesDir/scripts/fill-disk.sh +ramdisk_login=$archivesDir/scripts/ramdisk-login.sh +storePaths=$archivesDir/mystorepaths +validatePaths=$archivesDir/validatepaths +bootiso=/tmp/nixos.iso +initrd=/tmp/initram.img +initdir=${archivesDir}/initdir +initscript=$archivesDir/scripts/init.sh + +NIX_CMD_PATH=$(dirname $(which nix-store)) +cpwd=`pwd` + +storeExpr=$($NIX_CMD_PATH/nix-store -qR $($NIX_CMD_PATH/nix-store -r $(echo '(import ./kernel.nix).everything' | $NIX_CMD_PATH/nix-instantiate -))) + +kernel=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./kernel.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) + +ov511=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./kernel.nix).ov511' | $NIX_CMD_PATH/nix-instantiate -)) + +echo $kernel +echo $ov511 + +echo making kernel stuff + +kernelVersion=$(cd $kernel/lib/modules/; ls -d *) +mkdir -p $archivesDir/lib/modules/$kernelVersion + +echo $kernelVersion + +cd $kernel + +# make directories + +find . -not -path "./lib/modules/$kernelVersion/build*" -type d | xargs -n 1 -i% mkdir -p $archivesDir/% + +# link all files +find . -not -path "./lib/modules/$kernelVersion/build*" -type f | xargs -n 1 -i% ln -s $kernel/% $archivesDir/% + +# make directories + +cd $ov511 +find . -not -path "./lib/modules/$kernelVersion/build*" -type d | xargs -n 1 -i% mkdir -p $archivesDir/% + +# link all files +find . -not -path "./lib/modules/$kernelVersion/build*" -type f | xargs -n 1 -i% ln -s $kernel/% $archivesDir/% -- GitLab From bdf2a61d916c7f0c7af523a1b58960385a849d40 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sat, 7 Jan 2006 01:24:29 +0000 Subject: [PATCH 0118/5331] add /var/run/usb. This is needed for hotplugging. Actually, this is probably the wrong place to make these directories. After all, if we build this into a real installer what do we know what to install? Perhaps we will use a completely different hotplug implementation that won't use this directory. Ah well, future work ;) svn path=/nixu/trunk/; revision=4502 --- fill-disk.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/fill-disk.sh b/fill-disk.sh index 0687b4e7fb4..d36f4bc044b 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -173,6 +173,7 @@ make_dir 00755 /var/lock make_dir 00755 /var/lock/subsys make_dir 00755 /var/log make_dir 00755 /var/run +make_dir 00755 /var/run/usb make_dir 00755 /var/spool make_dir 00755 /var/state make_dir 00755 /var/state/dhcp -- GitLab From 9cbf8a84fb42b1fa0b6fbf2b94db740e9c6a34e4 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sat, 7 Jan 2006 14:36:13 +0000 Subject: [PATCH 0119/5331] enable swap during install svn path=/nixu/trunk/; revision=4503 --- fill-disk.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index d36f4bc044b..b8acc73ad19 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=/bin:/sbin:@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@utilLinux@/bin:@utilLinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@eject@/bin:@kudzu@/sbin +export PATH=/bin:/sbin:@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@utilLinux@/bin:@utilLinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@eject@/bin:@kudzu@/sbin:@xawtv@/bin ## ## In the beginning we want to have a minimalistic environment, built with @@ -8,6 +8,7 @@ export PATH=/bin:/sbin:@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils ## kernel=@kernel@ +xawtv=@xawtv@ storePaths=/mystorepaths @@ -92,11 +93,17 @@ echo starting emergency shell on tty2 exec ./ramdisk-login.sh /dev/tty2 & +echo formatting target device + targetdrive=/dev/hda device=${targetdrive}1 mkfs.ext2 ${device} -mkswap ${targetdrive}2 +swapdevice=${targetdrive}2 +mkswap $swapdevice + +echo enabling swap +swapon $swapdevice #if ! test -n "$1" #then @@ -297,8 +304,8 @@ echo "id:2:initdefault:" >> $root/etc/inittab echo "si::bootwait:$bootPath/bin/boot.sh" >> $root/etc/inittab echo "ht:06:wait:$bootPath/bin/halt.sh" >> $root/etc/inittab echo "1:2345:respawn:$bootPath/bin/login.sh /dev/tty1" >> $root/etc/inittab -echo "2:2345:respawn:$mingetty/sbin/mingetty tty2" >> $root/etc/inittab -echo "3:2345:respawn:$mingetty/sbin/mingetty tty3" >> $root/etc/inittab +echo "#2:2345:respawn:$mingetty/sbin/mingetty tty2" >> $root/etc/inittab +echo "#3:2345:respawn:$mingetty/sbin/mingetty tty3" >> $root/etc/inittab #echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab echo setting up networking information... @@ -326,6 +333,7 @@ echo default profile for root echo "source @nix@/etc/profile.d/nix.sh" > $root/root/.profile touch_file /etc/login.defs +touch_file /etc/services ### ### Do kernel stuff here. -- GitLab From 77b661cfab670c2a3f0edc578804941ee9760a47 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sat, 7 Jan 2006 15:42:59 +0000 Subject: [PATCH 0120/5331] e2fsprogs dynamically loads some library, even if it's statically linked. svn path=/nixu/trunk/; revision=4505 --- boot/default.nix | 4 ++-- make-disk.sh | 8 +------- pkgs.nix | 6 +++--- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/boot/default.nix b/boot/default.nix index 12d80e54419..588f3d58273 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,4 +1,4 @@ -{ stdenv, kernel, bash, bashStatic, coreutils, findutilsWrapper, utillinux, utillinuxStatic, sysvinit, e2fsprogs +{ stdenv, bash, bashStatic, coreutils, findutilsWrapper, utillinux, utillinuxStatic, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep , gnutar, gzip, mingettyWrapper, grubWrapper, parted, module_init_tools, hotplug @@ -12,7 +12,7 @@ derivation { halt = ./halt.sh; login = ./login.sh; env = ./env.sh; - inherit stdenv kernel bash bashStatic coreutils findutilsWrapper utillinux sysvinit + inherit stdenv bash bashStatic coreutils findutilsWrapper utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper parted module_init_tools diff --git a/make-disk.sh b/make-disk.sh index 34a1c2b5f33..f226e216a30 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -225,20 +225,14 @@ chmod u+x ${initdir}/fill-disk.sh chmod u+x ${initdir}/ramdisk-login.sh #cp -fau --parents ${utilLinux} ${initdir} #cp -fau --parents ${coreUtilsDiet} ${initdir} -#cp -fau --parents ${e2fsProgs} ${initdir} #cp -fau --parents ${modUtils} ${initdir} #cp -fau --parents ${hotplug} ${initdir} cp -fau --parents ${bash}/bin ${initdir} cp -fau --parents ${utilLinux}/bin ${initdir} chmod -R u+w ${initdir} -echo utilLinux $utilLinux cp -fau --parents ${utilLinux}/sbin ${initdir} -echo coreutils +cp -fau --parents ${e2fsProgs} ${initdir} cp -fau --parents ${coreutilsdiet}/bin ${initdir} -cp -fau --parents ${e2fsprogs}/bin ${initdir} -chmod -R u+w ${initdir} -echo e2fsprogs -cp -fau --parents ${e2fsprogs}/sbin ${initdir} cp -fau --parents ${modutils}/bin ${initdir} chmod -R u+w ${initdir} echo modutils diff --git a/pkgs.nix b/pkgs.nix index e1a4288c156..d156cddbab8 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -5,9 +5,9 @@ rec { nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic hotplug udev - dhcpWrapper man nano eject sysklogd kudzu; + dhcpWrapper man nano eject sysklogd kudzu xawtv; - boot = (import ./boot) {inherit stdenv kernel bash bashStatic coreutils findutilsWrapper + boot = (import ./boot) {inherit stdenv bash bashStatic coreutils findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper parted module_init_tools @@ -17,5 +17,5 @@ rec { nix shadowutils mingettyWrapper grubWrapper parted module_init_tools hotplug dhcpWrapper man nano eject;}; - everything = [boot sysvinit kernel sysklogd kudzu]; + everything = [boot sysvinit sysklogd kernel xawtv]; } -- GitLab From 908db1fd4510613479e3de7377b466611125af5b Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sat, 7 Jan 2006 18:07:32 +0000 Subject: [PATCH 0121/5331] rename dir...it makes more sense svn path=/nixu/trunk/; revision=4508 --- {scripts => kernelscripts}/kernel.nix | 0 {scripts => kernelscripts}/make-kernel.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {scripts => kernelscripts}/kernel.nix (100%) rename {scripts => kernelscripts}/make-kernel.sh (100%) diff --git a/scripts/kernel.nix b/kernelscripts/kernel.nix similarity index 100% rename from scripts/kernel.nix rename to kernelscripts/kernel.nix diff --git a/scripts/make-kernel.sh b/kernelscripts/make-kernel.sh similarity index 100% rename from scripts/make-kernel.sh rename to kernelscripts/make-kernel.sh -- GitLab From ed5199d3b26042ceb8916b9da5592ff3e206e1fb Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sat, 7 Jan 2006 22:35:20 +0000 Subject: [PATCH 0122/5331] make symlinks to the right location svn path=/nixu/trunk/; revision=4511 --- kernelscripts/make-kernel.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernelscripts/make-kernel.sh b/kernelscripts/make-kernel.sh index e3a199fb84a..14f006a0553 100755 --- a/kernelscripts/make-kernel.sh +++ b/kernelscripts/make-kernel.sh @@ -46,4 +46,4 @@ cd $ov511 find . -not -path "./lib/modules/$kernelVersion/build*" -type d | xargs -n 1 -i% mkdir -p $archivesDir/% # link all files -find . -not -path "./lib/modules/$kernelVersion/build*" -type f | xargs -n 1 -i% ln -s $kernel/% $archivesDir/% +find . -not -path "./lib/modules/$kernelVersion/build*" -type f | xargs -n 1 -i% ln -s $ov511/% $archivesDir/% -- GitLab From 41eb324771b9632b8fac9248ea8f4c0964068315 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 8 Jan 2006 00:23:31 +0000 Subject: [PATCH 0123/5331] add a bit about hotplugging svn path=/nixu/trunk/; revision=4515 --- howto | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/howto b/howto index 057fb17276b..7209c06d427 100644 --- a/howto +++ b/howto @@ -79,3 +79,22 @@ NixOS machine (needed for mingetty). Alternatively, do: # touch /etc/login.defs - relaunch init + + + Making hotplugging work + +Many devices are controlled by so called "hot plugging". The kernel executes +a program -- usually /sbin/hotplug, but this is configurable at boottime by +setting the right path in /proc/sys/kernel/hotplug -- when a new device is +added to the machine. This program makes sure the right kernel modules are +loaded and optionally, if enabled, sends a message to udev to create the right +device node in /dev (NOTE: this is not enabled in NixOS right now). + +- install hotplug package + - make symlinks /etc/hotplug, /etc/hotplug.d, /sbin/hotplug (TODO: make + this pure) + - make sure the kernel and additional modules are prepared well (currently + this is hackish, but workable: see kernelscripts/make-kernel.sh for an + example) + - (optionally:) launch udev + - plug in a device -- GitLab From 80595bb21f8ebc7f08ddc7012789050ad2a19c57 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 8 Jan 2006 00:42:45 +0000 Subject: [PATCH 0124/5331] add a bit about mounting usbfs svn path=/nixu/trunk/; revision=4516 --- howto | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/howto b/howto index 7209c06d427..646f2c2ebf6 100644 --- a/howto +++ b/howto @@ -83,18 +83,23 @@ NixOS machine (needed for mingetty). Alternatively, do: Making hotplugging work -Many devices are controlled by so called "hot plugging". The kernel executes -a program -- usually /sbin/hotplug, but this is configurable at boottime by -setting the right path in /proc/sys/kernel/hotplug -- when a new device is -added to the machine. This program makes sure the right kernel modules are -loaded and optionally, if enabled, sends a message to udev to create the right -device node in /dev (NOTE: this is not enabled in NixOS right now). - +Many devices (USB, Firewire) are controlled by so called "hot plugging". The +kernel executes a program -- usually /sbin/hotplug, but this is configurable +at boottime by setting the right path in /proc/sys/kernel/hotplug -- when a +new device is added to the machine. This program makes sure the right kernel +modules are loaded and optionally, if enabled, sends a message to udev to +create the right device node in /dev (NOTE: this is not enabled in NixOS right +now). + +- mount usbfs (for USB): + # mount -t usbfs usbfs /proc/bus/usb - install hotplug package - make symlinks /etc/hotplug, /etc/hotplug.d, /sbin/hotplug (TODO: make this pure) - make sure the kernel and additional modules are prepared well (currently this is hackish, but workable: see kernelscripts/make-kernel.sh for an example) - - (optionally:) launch udev + - (optionally:) install udev + - make a symlink to /etc/udev/udev.conf + - launch udev - plug in a device -- GitLab From bb2278902150b62b47122dc39cdcbbdbb039cf51 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 12 Jan 2006 13:51:43 +0000 Subject: [PATCH 0125/5331] change the hostname from "uml" to "nixos" to keep eelco happy ;) svn path=/nixu/trunk/; revision=4540 --- boot/boot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/boot.sh b/boot/boot.sh index 6115bd988c1..5f04abe0134 100644 --- a/boot/boot.sh +++ b/boot/boot.sh @@ -25,7 +25,7 @@ echo "starting udev..." @udev@/sbin/udevstart echo "setting up hostname..." -hostname uml +hostname nixos echo "enabling loopback interface..." ifconfig lo 127.0.0.1 -- GitLab From 994b85b4af3cbd1e504246ab3895f16a6ddcba54 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 16 Jan 2006 16:05:16 +0000 Subject: [PATCH 0126/5331] make all paths absolute...still needed: a builder svn path=/nixu/trunk/; revision=4563 --- kernelscripts/make-kernel.sh | 49 --------------------------------- kernelscripts/make-kernel.sh.in | 36 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 49 deletions(-) delete mode 100755 kernelscripts/make-kernel.sh create mode 100755 kernelscripts/make-kernel.sh.in diff --git a/kernelscripts/make-kernel.sh b/kernelscripts/make-kernel.sh deleted file mode 100755 index 14f006a0553..00000000000 --- a/kernelscripts/make-kernel.sh +++ /dev/null @@ -1,49 +0,0 @@ -#! /bin/sh -e - -archivesDir=$(mktemp -d) -manifest=${archivesDir}/MANIFEST -nixpkgs=/nixpkgs/trunk/pkgs -fill_disk=$archivesDir/scripts/fill-disk.sh -ramdisk_login=$archivesDir/scripts/ramdisk-login.sh -storePaths=$archivesDir/mystorepaths -validatePaths=$archivesDir/validatepaths -bootiso=/tmp/nixos.iso -initrd=/tmp/initram.img -initdir=${archivesDir}/initdir -initscript=$archivesDir/scripts/init.sh - -NIX_CMD_PATH=$(dirname $(which nix-store)) -cpwd=`pwd` - -storeExpr=$($NIX_CMD_PATH/nix-store -qR $($NIX_CMD_PATH/nix-store -r $(echo '(import ./kernel.nix).everything' | $NIX_CMD_PATH/nix-instantiate -))) - -kernel=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./kernel.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) - -ov511=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./kernel.nix).ov511' | $NIX_CMD_PATH/nix-instantiate -)) - -echo $kernel -echo $ov511 - -echo making kernel stuff - -kernelVersion=$(cd $kernel/lib/modules/; ls -d *) -mkdir -p $archivesDir/lib/modules/$kernelVersion - -echo $kernelVersion - -cd $kernel - -# make directories - -find . -not -path "./lib/modules/$kernelVersion/build*" -type d | xargs -n 1 -i% mkdir -p $archivesDir/% - -# link all files -find . -not -path "./lib/modules/$kernelVersion/build*" -type f | xargs -n 1 -i% ln -s $kernel/% $archivesDir/% - -# make directories - -cd $ov511 -find . -not -path "./lib/modules/$kernelVersion/build*" -type d | xargs -n 1 -i% mkdir -p $archivesDir/% - -# link all files -find . -not -path "./lib/modules/$kernelVersion/build*" -type f | xargs -n 1 -i% ln -s $ov511/% $archivesDir/% diff --git a/kernelscripts/make-kernel.sh.in b/kernelscripts/make-kernel.sh.in new file mode 100755 index 00000000000..681587f62dd --- /dev/null +++ b/kernelscripts/make-kernel.sh.in @@ -0,0 +1,36 @@ +#! /bin/sh -e + +#archivesDir=$(@mktemp@/bin/mktemp -d) +archivesDir=/ + +cpwd=@coreutils@/bin/pwd + +storeExpr=$(@nix@/bin/nix-store -qR $(@nix@/bin/nix-store -r $(echo '(import ./kernel.nix).everything' | @nix@/bin/nix-instantiate -))) + +kernel=$(@nix@/bin/nix-store -r $(echo '(import ./kernel.nix).kernel' | @nix@/bin/nix-instantiate -)) + +ov511=$(@nix@/bin/nix-store -r $(echo '(import ./kernel.nix).ov511' | @nix@/bin/nix-instantiate -)) + +#echo making kernel stuff + +kernelVersion=$(cd $kernel/lib/modules/; @coreutils@/bin/ls -d *) +@coreutils@/bin/mkdir -p $archivesDir/lib/modules/$kernelVersion + +#echo $kernelVersion + +cd $kernel + +# make directories + +@findutils@/bin/find . -not -path "./lib/modules/$kernelVersion/build*" -type d | @findutils@/bin/xargs -n 1 -i% @coreutils@/bin/mkdir -p $archivesDir/% + +# link all files +@findutils@/bin/find . -not -path "./lib/modules/$kernelVersion/build*" -type f | @findutils@/bin/xargs -n 1 -i% @coreutils@/bin/ln -s $kernel/% $archivesDir/% + +# make directories + +cd $ov511 +@findutils@/bin/find . -not -path "./lib/modules/$kernelVersion/build*" -type d | @findutils@/bin/xargs -n 1 -i% @coreutils@/bin/mkdir -p $archivesDir/% + +# link all files +@findutils@/bin/find . -not -path "./lib/modules/$kernelVersion/build*" -type f | @findutils@/bin/xargs -n 1 -i% @coreutils@/bin/ln -s $ov511/% $archivesDir/% -- GitLab From 6bad2b0809060748b8608024fce5779dd200b86f Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 20 Jan 2006 13:47:01 +0000 Subject: [PATCH 0127/5331] do stuff with utmp and wtmp, so tools like "w" work svn path=/nixu/trunk/; revision=4581 --- boot/boot.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boot/boot.sh b/boot/boot.sh index 5f04abe0134..5183d045613 100644 --- a/boot/boot.sh +++ b/boot/boot.sh @@ -27,6 +27,10 @@ echo "starting udev..." echo "setting up hostname..." hostname nixos +echo "cleaning utmp and wtmp..." +echo "" > /var/run/utmp +echo "" > /var/log/wtmp + echo "enabling loopback interface..." ifconfig lo 127.0.0.1 -- GitLab From ff05d84a100f3488381dde187e9892061017d709 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 26 Jan 2006 10:25:06 +0000 Subject: [PATCH 0128/5331] we also want /dev/input to be available (fixme, can't this one be created by udev instead?) svn path=/nixu/trunk/; revision=4593 --- fill-disk.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/fill-disk.sh b/fill-disk.sh index b8acc73ad19..f009a68bcb2 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -146,6 +146,7 @@ make_dir 00755 /bin make_dir 00755 /boot make_dir 00755 /dev make_dir 00755 /dev/pts +make_dir 00755 /dev/input make_dir 00755 /etc # global non-constant configuration make_dir 00755 /etc/ssh make_dir 00755 /etc/sysconfig -- GitLab From caf9b6bfba3d033e2298e45f56c390a4c695cba7 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 26 Jan 2006 19:48:51 +0000 Subject: [PATCH 0129/5331] start of good HOWTO for using X in NixOS svn path=/nixu/trunk/; revision=4602 --- X-howto | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 X-howto diff --git a/X-howto b/X-howto new file mode 100644 index 00000000000..6cf4bd36763 --- /dev/null +++ b/X-howto @@ -0,0 +1,16 @@ +Making X work in NixOS (fixing guide) + + Mouse + +* for mouse support /dev/input/mice needs to be there. This device can be +created either automatically with udev, or manually with mknod. + + Fonts + +Right now fonts have to be copied from another machine and put into +/usr/X11R6/lib/X11/fonts + + Config + +in services/trunk/configurations/tyros.cs.uu.nl-xorg/ there is a Nix expression +which builds a working X configuration for use in VMware. -- GitLab From 78767321ce6004fe0adfec33f0b40a5e2b113f08 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 31 Jan 2006 11:01:28 +0000 Subject: [PATCH 0130/5331] add something so we modprobe some stuff for at least one family of USB controllers (uhci-hcd). This is of course not very elegant: even if a machine does not have USB, or another USB controller this module will loaded. A better way would be to let some hardware probing program run first, but that is "future work" svn path=/nixu/trunk/; revision=4631 --- boot/boot.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/boot/boot.sh b/boot/boot.sh index 5183d045613..c964e410c41 100644 --- a/boot/boot.sh +++ b/boot/boot.sh @@ -31,6 +31,9 @@ echo "cleaning utmp and wtmp..." echo "" > /var/run/utmp echo "" > /var/log/wtmp +echo "loading USB controller modules..." +@module_init_tools@/sbin/modprobe uhci-hcd + echo "enabling loopback interface..." ifconfig lo 127.0.0.1 -- GitLab From 89df039e35a36282687e903b76e5345163f9957f Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 1 Feb 2006 13:31:52 +0000 Subject: [PATCH 0131/5331] * store the value of hotplug in /etc/sysconfig/hotplug and cat this value to /proc/sys/kernel/hotplug during boot. (FIXME, install hotplug during install of NixOS) * /dev/input is created by udev svn path=/nixu/trunk/; revision=4660 --- boot/boot.sh | 3 +++ fill-disk.sh | 13 ++++++++++-- kernelscripts/kernel.nix | 6 ------ kernelscripts/make-kernel.sh.in | 36 --------------------------------- 4 files changed, 14 insertions(+), 44 deletions(-) delete mode 100644 kernelscripts/kernel.nix delete mode 100755 kernelscripts/make-kernel.sh.in diff --git a/boot/boot.sh b/boot/boot.sh index c964e410c41..8ed197ca287 100644 --- a/boot/boot.sh +++ b/boot/boot.sh @@ -31,6 +31,9 @@ echo "cleaning utmp and wtmp..." echo "" > /var/run/utmp echo "" > /var/log/wtmp +echo "setting hotplug..." +cat /etc/sysconfig/hotplug > /proc/sys/kernel/hotplug + echo "loading USB controller modules..." @module_init_tools@/sbin/modprobe uhci-hcd diff --git a/fill-disk.sh b/fill-disk.sh index f009a68bcb2..18beb23d318 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -146,7 +146,6 @@ make_dir 00755 /bin make_dir 00755 /boot make_dir 00755 /dev make_dir 00755 /dev/pts -make_dir 00755 /dev/input make_dir 00755 /etc # global non-constant configuration make_dir 00755 /etc/ssh make_dir 00755 /etc/sysconfig @@ -359,15 +358,25 @@ cp @kernel@/lib/modules/$version/modules.* $root/lib/modules/$version chmod 644 $root/lib/modules/$version/modules.* ### -### Do funky stuff with grub here. +### hotplug ### +echo "@hotplug@/sbin/hotplug" > $root/etc/sysconfig/hotplug ln -s @hotplug@/sbin/hotplug $root/sbin/hotplug ln -s @hotplug@/etc/hotplug $root/etc/hotplug ln -s @hotplug@/etc/hotplug.d $root/etc/hotplug.d + +### +### init +### + ln -s $device $root/dev/root ln -s @sysvinitPath@/sbin/init /sbin/init +### +### Do funky stuff with grub here. +### + echo installing bootloader grub-install --root-directory=${root} --no-floppy ${targetdrive} diff --git a/kernelscripts/kernel.nix b/kernelscripts/kernel.nix deleted file mode 100644 index 3a799a5ea4d..00000000000 --- a/kernelscripts/kernel.nix +++ /dev/null @@ -1,6 +0,0 @@ -rec { - inherit (import /nixpkgs/trunk/pkgs/system/i686-linux.nix) - stdenv kernel ov511; - - everything = [kernel ov511]; -} diff --git a/kernelscripts/make-kernel.sh.in b/kernelscripts/make-kernel.sh.in deleted file mode 100755 index 681587f62dd..00000000000 --- a/kernelscripts/make-kernel.sh.in +++ /dev/null @@ -1,36 +0,0 @@ -#! /bin/sh -e - -#archivesDir=$(@mktemp@/bin/mktemp -d) -archivesDir=/ - -cpwd=@coreutils@/bin/pwd - -storeExpr=$(@nix@/bin/nix-store -qR $(@nix@/bin/nix-store -r $(echo '(import ./kernel.nix).everything' | @nix@/bin/nix-instantiate -))) - -kernel=$(@nix@/bin/nix-store -r $(echo '(import ./kernel.nix).kernel' | @nix@/bin/nix-instantiate -)) - -ov511=$(@nix@/bin/nix-store -r $(echo '(import ./kernel.nix).ov511' | @nix@/bin/nix-instantiate -)) - -#echo making kernel stuff - -kernelVersion=$(cd $kernel/lib/modules/; @coreutils@/bin/ls -d *) -@coreutils@/bin/mkdir -p $archivesDir/lib/modules/$kernelVersion - -#echo $kernelVersion - -cd $kernel - -# make directories - -@findutils@/bin/find . -not -path "./lib/modules/$kernelVersion/build*" -type d | @findutils@/bin/xargs -n 1 -i% @coreutils@/bin/mkdir -p $archivesDir/% - -# link all files -@findutils@/bin/find . -not -path "./lib/modules/$kernelVersion/build*" -type f | @findutils@/bin/xargs -n 1 -i% @coreutils@/bin/ln -s $kernel/% $archivesDir/% - -# make directories - -cd $ov511 -@findutils@/bin/find . -not -path "./lib/modules/$kernelVersion/build*" -type d | @findutils@/bin/xargs -n 1 -i% @coreutils@/bin/mkdir -p $archivesDir/% - -# link all files -@findutils@/bin/find . -not -path "./lib/modules/$kernelVersion/build*" -type f | @findutils@/bin/xargs -n 1 -i% @coreutils@/bin/ln -s $ov511/% $archivesDir/% -- GitLab From a05f476c39c452ff9e945a6f1f818267d0d4f6c6 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 8 Mar 2006 19:14:12 +0000 Subject: [PATCH 0132/5331] add a doc directory, with some documentation in it svn path=/nixu/trunk/; revision=5006 --- doc/configuration.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 doc/configuration.txt diff --git a/doc/configuration.txt b/doc/configuration.txt new file mode 100644 index 00000000000..2275c6e4281 --- /dev/null +++ b/doc/configuration.txt @@ -0,0 +1,25 @@ +Configuration in NixOS + +Configuration in NixOS is not very straightforward. On other Linux +distribution site-specific information (password files, host files, and +so on) are stored with information that is rather generic for a lot of +operating systems. To be able to handle these in a gentle way I have decided +to seperate these two a bit more in NixOS. + +In particular, in the /etc directory there is a Nix profile called "configs". +In this profile the generic configuration is kept. In time this can grow +to keep configuration which is site specific, but which can easily be kept +in the store, such as "profile" (default system wide Bourne shell profile) + +Right now two packages should be in this profile: + +* etcServices : installs a file called "services" (/etc/services should +point to this) +* etcProtocols : installs a file called "protocols" (/etc/protocols should +point to this) + +During install time these packages should be installed and the right symlinks +should be made. + +When NIX-40 is closed, we might consider making /etc itself a profile and +keep even more configuration information inside the Nix store. -- GitLab From af9eb8537e29605d6fafb6d939b8e4c2e4b70a10 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 8 Mar 2006 19:15:14 +0000 Subject: [PATCH 0133/5331] move the existing documentation to the docs directory svn path=/nixu/trunk/; revision=5007 --- X-howto => doc/X-howto | 0 howto => doc/howto | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename X-howto => doc/X-howto (100%) rename howto => doc/howto (100%) diff --git a/X-howto b/doc/X-howto similarity index 100% rename from X-howto rename to doc/X-howto diff --git a/howto b/doc/howto similarity index 100% rename from howto rename to doc/howto -- GitLab From d8550e9d105017650e47528cc7257b7fee46cb19 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 25 Apr 2006 23:52:31 +0000 Subject: [PATCH 0134/5331] remove all reference to the "hotplug" package, since it is obsolete. TODO: update udev svn path=/nixu/trunk/; revision=5222 --- boot/boot.sh | 3 --- boot/default.nix | 2 +- fill-disk.sh | 10 ---------- init/default.nix | 2 +- make-disk.sh | 6 ------ pkgs.nix | 8 ++++---- 6 files changed, 6 insertions(+), 25 deletions(-) diff --git a/boot/boot.sh b/boot/boot.sh index 8ed197ca287..c964e410c41 100644 --- a/boot/boot.sh +++ b/boot/boot.sh @@ -31,9 +31,6 @@ echo "cleaning utmp and wtmp..." echo "" > /var/run/utmp echo "" > /var/log/wtmp -echo "setting hotplug..." -cat /etc/sysconfig/hotplug > /proc/sys/kernel/hotplug - echo "loading USB controller modules..." @module_init_tools@/sbin/modprobe uhci-hcd diff --git a/boot/default.nix b/boot/default.nix index 588f3d58273..e6e31ca161b 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,7 +1,7 @@ { stdenv, bash, bashStatic, coreutils, findutilsWrapper, utillinux, utillinuxStatic, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh , binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep -, gnutar, gzip, mingettyWrapper, grubWrapper, parted, module_init_tools, hotplug +, gnutar, gzip, mingettyWrapper, grubWrapper, parted, module_init_tools , udev, dhcpWrapper, man, nano}: derivation { diff --git a/fill-disk.sh b/fill-disk.sh index 18beb23d318..391a5b3dba0 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -15,7 +15,6 @@ storePaths=/mystorepaths sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ modutils=@modutils@ -hotplug=@hotplug@ mingetty=@mingetty@ echo mounting special filesystems @@ -357,15 +356,6 @@ ln -s @kernel@/lib/modules/$version/kernel $root/lib/modules/$version/kernel cp @kernel@/lib/modules/$version/modules.* $root/lib/modules/$version chmod 644 $root/lib/modules/$version/modules.* -### -### hotplug -### - -echo "@hotplug@/sbin/hotplug" > $root/etc/sysconfig/hotplug -ln -s @hotplug@/sbin/hotplug $root/sbin/hotplug -ln -s @hotplug@/etc/hotplug $root/etc/hotplug -ln -s @hotplug@/etc/hotplug.d $root/etc/hotplug.d - ### ### init ### diff --git a/init/default.nix b/init/default.nix index c81e75513cd..f1b10b5bc8f 100644 --- a/init/default.nix +++ b/init/default.nix @@ -1,4 +1,4 @@ -{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grubWrapper, parted, module_init_tools, hotplug, dhcpWrapper}: +{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grubWrapper, parted, module_init_tools, dhcpWrapper}: derivation { name = "init"; diff --git a/make-disk.sh b/make-disk.sh index f226e216a30..d2af5273ab2 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -74,7 +74,6 @@ e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogsDiet modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX_CMD_PATH/nix-instantiate -)) grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -)) mingettyWrapper=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).mingettyWrapper' | $NIX_CMD_PATH/nix-instantiate -)) -hotplug=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).hotplug' | $NIX_CMD_PATH/nix-instantiate -)) udev=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).udev' | $NIX_CMD_PATH/nix-instantiate -)) dhcp=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX_CMD_PATH/nix-instantiate -)) nano=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX_CMD_PATH/nix-instantiate -)) @@ -136,7 +135,6 @@ cp -fa ${nixpkgs} ${archivesDir} #cp -fvau --parents ${Kernel} ${archivesDir} #cp -fvau --parents ${SysVinit} ${archivesDir} #cp -fvau --parents ${BootPath} ${archivesDir} -#cp -fvau --parents ${hotplug} ${archivesDir} #cp -fvau --parents ${udev} ${archivesDir} #cp -fvau --parents ${dhcp} ${archivesDir} #cp -fvau --parents ${nano} ${archivesDir} @@ -164,7 +162,6 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@modutils\@^$modutils^g" \ -e "s^@grub\@^$grub^g" \ -e "s^@kernel\@^$kernel^g" \ - -e "s^@hotplug\@^$hotplug^g" \ -e "s^@gnugrep\@^$gnugrep^g" \ -e "s^@which\@^$which^g" \ -e "s^@kudzu\@^$kudzu^g" \ @@ -186,7 +183,6 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@modutils\@^$modutils^g" \ -e "s^@grub\@^$grub^g" \ -e "s^@kernel\@^$kernel^g" \ - -e "s^@hotplug\@^$hotplug^g" \ -e "s^@gnugrep\@^$gnugrep^g" \ -e "s^@which\@^$which^g" \ -e "s^@gnutar\@^$gnutar^g" \ @@ -226,7 +222,6 @@ chmod u+x ${initdir}/ramdisk-login.sh #cp -fau --parents ${utilLinux} ${initdir} #cp -fau --parents ${coreUtilsDiet} ${initdir} #cp -fau --parents ${modUtils} ${initdir} -#cp -fau --parents ${hotplug} ${initdir} cp -fau --parents ${bash}/bin ${initdir} cp -fau --parents ${utilLinux}/bin ${initdir} chmod -R u+w ${initdir} @@ -237,7 +232,6 @@ cp -fau --parents ${modutils}/bin ${initdir} chmod -R u+w ${initdir} echo modutils cp -fau --parents ${modutils}/sbin ${initdir} -#cp -fau --parents ${hotplug} ${initdir} #cp -fau --parents ${kudzu} ${initdir} touch ${archivesDir}/NIXOS diff --git a/pkgs.nix b/pkgs.nix index d156cddbab8..90d5e5646b3 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,20 +1,20 @@ rec { - inherit (import /nixpkgs/trunk/pkgs/system/i686-linux.nix) + inherit (import /nixpkgs/trunk/pkgs/top-level/all-packages.nix {}) stdenv kernel bash bashStatic coreutils coreutilsDiet findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogsDiet e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip - mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic hotplug udev + mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic udev dhcpWrapper man nano eject sysklogd kudzu xawtv; boot = (import ./boot) {inherit stdenv bash bashStatic coreutils findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper parted module_init_tools - hotplug udev dhcpWrapper man nano;}; + udev dhcpWrapper man nano;}; init = (import ./init) {inherit stdenv bash bashStatic coreutilsDiet utillinux e2fsprogsDiet - nix shadowutils mingettyWrapper grubWrapper parted module_init_tools hotplug + nix shadowutils mingettyWrapper grubWrapper parted module_init_tools dhcpWrapper man nano eject;}; everything = [boot sysvinit sysklogd kernel xawtv]; -- GitLab From 2a304add0b593b1b93cca3cc913812924d57affe Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 28 Apr 2006 12:45:32 +0000 Subject: [PATCH 0135/5331] rewrite to new Nixpkgs and new Nix version svn path=/nixu/trunk/; revision=5233 --- fill-disk.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 391a5b3dba0..e59a0260f34 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -287,8 +287,8 @@ tar cf - /nix/store | tar --directory=$root -xvf - echo registering valid paths... $NIX_CMD_PATH/nix-store --register-validity < $root/tmp/mystorepaths -$NIX_CMD_PATH/nix-env -iKf /nixpkgs/trunk/pkgs/system/i686-linux.nix nix -$NIX_CMD_PATH/nix-env -iKf /nixpkgs/trunk/pkgs/system/i686-linux.nix coreutils +$NIX_CMD_PATH/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix nix +$NIX_CMD_PATH/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix coreutils echo setting init symlink... rm -f $root/init -- GitLab From 02cf649af649119030b57732695d1273fac79ea4 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sat, 24 Jun 2006 22:14:43 +0000 Subject: [PATCH 0136/5331] small cleanups, also move to newer Nix svn path=/nixu/trunk/; revision=5524 --- fill-disk.sh | 26 +++++++-------- make-disk.sh | 94 +++++++++++++++++++++++++++------------------------- pkgs.nix | 12 ++++--- 3 files changed, 69 insertions(+), 63 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index e59a0260f34..d39bbfb72c3 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -237,7 +237,7 @@ export NIX_DATA_DIR=$root/nix/share export NIX_LOG_DIR=$root/nix/log/nix export NIX_STATE_DIR=$root/nix/var/nix export NIX_CONF_DIR=$root/nix/etc -NIX_CMD_PATH=@nix@/bin +NIX=@nix@/bin #echo bringing up networking... @@ -246,10 +246,10 @@ NIX_CMD_PATH=@nix@/bin #echo "NIC: $nic" echo initialising Nix DB... -$NIX_CMD_PATH/nix-store --init +$NIX/nix-store --init echo verifying Nix DB... -$NIX_CMD_PATH/nix-store --verify +$NIX/nix-store --verify echo copying nixpkgs... #cp -fLa /cdrom/pkgs $root/nixpkgs/trunk @@ -259,7 +259,7 @@ make_dir 0755 /tmp/scripts cp -fa /cdrom/scripts $root/tmp #echo adding manifest -#$NIX_CMD_PATH/nix-pull $manifest +#$NIX/nix-pull $manifest echo adding packages @@ -269,15 +269,15 @@ unset NIX_LOG_DIR unset NIX_STATE_DIR unset NIX_CONF_DIR -storeExpr=$(echo '(import /tmp/scripts/pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -v -v -) -#storeExpr=$(echo '(import /tmp/scripts/pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) -#storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) -#$NIX_CMD_PATH/nix-store -r $storeExpr +storeExpr=$(echo '(import /tmp/scripts/pkgs.nix).kernel' | $NIX/nix-instantiate -v -v -) +#storeExpr=$(echo '(import /tmp/scripts/pkgs.nix).everything' | $NIX/nix-instantiate -v -v -) +#storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX/nix-instantiate -v -v -) +#$NIX/nix-store -r $storeExpr echo $storeExpr > $root/tmp/storeExpr cp /cdrom/mystorepaths $root/tmp -#storeExpr2=$($NIX_CMD_PATH/nix-store -qR $($NIX_CMD_PATH/nix-store -r $storeExpr)) +#storeExpr2=$($NIX/nix-store -qR $($NIX/nix-store -r $storeExpr)) #echo storeExpr $storeExpr -#echo $($NIX_CMD_PATH/nix-store -qR --include-outputs $storeExpr) +#echo $($NIX/nix-store -qR --include-outputs $storeExpr) echo copying store @@ -286,9 +286,9 @@ tar cf - /nix/store | tar --directory=$root -xvf - echo registering valid paths... -$NIX_CMD_PATH/nix-store --register-validity < $root/tmp/mystorepaths -$NIX_CMD_PATH/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix nix -$NIX_CMD_PATH/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix coreutils +$NIX/nix-store --register-validity < $root/tmp/mystorepaths +$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix nix +$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix coreutils echo setting init symlink... rm -f $root/init diff --git a/make-disk.sh b/make-disk.sh index d2af5273ab2..52a09680e06 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -15,34 +15,35 @@ initrd=/tmp/initram.img initdir=${archivesDir}/initdir initscript=$archivesDir/scripts/init.sh -NIX_CMD_PATH=$(dirname $(which nix-store)) +# determine where we can find the Nix binaries +NIX=$(dirname $(which nix-store)) -storeExpr=$($NIX_CMD_PATH/nix-store -qR $($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -))) -#$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) +storeExpr=$($NIX/nix-store -qR $($NIX/nix-store -r $(echo '(import ./pkgs.nix).everything' | $NIX/nix-instantiate -))) +#$NIX/nix-push --copy $archivesDir $manifest $($NIX/nix-store -r $storeExpr) $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) # Location of sysvinit? -sysvinitPath=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -)) +sysvinitPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/nix-instantiate -)) # Location of Nix boot scripts? -bootPath=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -)) +bootPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instantiate -)) -nix=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) +nix=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).nixUnstable' | $NIX/nix-instantiate -)) -syslinux=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).syslinux' | $NIX_CMD_PATH/nix-instantiate -)) +syslinux=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).syslinux' | $NIX/nix-instantiate -)) -kernel=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)) +kernel=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) -#nixDeps=$($NIX_CMD_PATH/nix-store -qR $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) +#nixDeps=$($NIX/nix-store -qR $(echo '(import ./pkgs.nix).nix' | $NIX/nix-instantiate -)) -#nixDeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) -#echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))) >> $storePaths -#$NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -)) >> $storePaths +#nixDeps=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX/nix-instantiate -))) +#echo $($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX/nix-instantiate -))) >> $storePaths +#$NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX/nix-instantiate -)) >> $storePaths for i in $storeExpr do echo $i >> $storePaths echo '' >> $storePaths - deps=$($NIX_CMD_PATH/nix-store -q --references $i) + deps=$($NIX/nix-store -q --references $i) pkgs=$(echo $deps | wc -w) echo $pkgs >> $storePaths for j in $deps @@ -53,36 +54,39 @@ do tar -cf - $i | tar --directory=$archivesDir -xf - done -utilLinux=$(nix-store -r $(echo '(import ./pkgs.nix).utillinuxStatic' | $NIX_CMD_PATH/nix-instantiate -)) -coreUtilsDiet=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX_CMD_PATH/nix-instantiate -))) -e2fsProgs=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX_CMD_PATH/nix-instantiate -))) -modUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX_CMD_PATH/nix-instantiate -))) -Grub=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -))) -#gnuSed=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX_CMD_PATH/nix-instantiate -))) -#gnuGrep=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -))) -Kernel=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -))) -SysVinit=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -))) -BootPath=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -))) - -bashGlibc=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)) -bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bashStatic' | $NIX_CMD_PATH/nix-instantiate -)) -coreutilsdiet=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX_CMD_PATH/nix-instantiate -)) -coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -)) -findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX_CMD_PATH/nix-instantiate -)) -utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)) -e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX_CMD_PATH/nix-instantiate -)) -modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX_CMD_PATH/nix-instantiate -)) -grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -)) -mingettyWrapper=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).mingettyWrapper' | $NIX_CMD_PATH/nix-instantiate -)) -udev=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).udev' | $NIX_CMD_PATH/nix-instantiate -)) -dhcp=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX_CMD_PATH/nix-instantiate -)) -nano=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX_CMD_PATH/nix-instantiate -)) -gnugrep=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -)) -which=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).which' | $NIX_CMD_PATH/nix-instantiate -)) -gnutar=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX_CMD_PATH/nix-instantiate -)) -eject=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).eject' | $NIX_CMD_PATH/nix-instantiate -)) -sysklogd=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).sysklogd' | $NIX_CMD_PATH/nix-instantiate -)) -#kudzu=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).kudzu' | $NIX_CMD_PATH/nix-instantiate -)) +utilLinux=$(nix-store -r $(echo '(import ./pkgs.nix).utillinuxStatic' | $NIX/nix-instantiate -)) +coreUtilsDiet=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX/nix-instantiate -))) + +## temporarily normal e2fsprogs until I can get it to build with dietlibc +#e2fsProgs=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX/nix-instantiate -))) +e2fsProgs=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX/nix-instantiate -))) +modUtils=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -))) +Grub=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -))) +#gnuSed=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX/nix-instantiate -))) +#gnuGrep=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX/nix-instantiate -))) +Kernel=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -))) +SysVinit=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/nix-instantiate -))) +BootPath=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instantiate -))) + +bashGlibc=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX/nix-instantiate -)) +bash=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).bashStatic' | $NIX/nix-instantiate -)) +coreutilsdiet=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX/nix-instantiate -)) +coreutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX/nix-instantiate -)) +findutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) +utillinux=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX/nix-instantiate -)) +e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX/nix-instantiate -)) +modutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -)) +grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -)) +mingettyWrapper=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mingettyWrapper' | $NIX/nix-instantiate -)) +udev=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).udev' | $NIX/nix-instantiate -)) +dhcp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX/nix-instantiate -)) +nano=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX/nix-instantiate -)) +gnugrep=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX/nix-instantiate -)) +which=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).which' | $NIX/nix-instantiate -)) +gnutar=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX/nix-instantiate -)) +eject=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).eject' | $NIX/nix-instantiate -)) +sysklogd=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysklogd' | $NIX/nix-instantiate -)) +#kudzu=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kudzu' | $NIX/nix-instantiate -)) #(while read storepath; do #cp -fa --parents ${storepath} ${archivesDir} @@ -92,7 +96,7 @@ sysklogd=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).sysklogd' | $N #for i in $utilLinux; do # echo i $i -# deps=( $($NIX_CMD_PATH/nix-store -q --references $i) ) +# deps=( $($NIX/nix-store -q --references $i) ) # echo length ${#deps[@]} # if test "${#deps[@]}" = 0 # then @@ -173,7 +177,7 @@ mv $fill_disk.tmp $fill_disk sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@bootPath\@^$bootPath^g" \ - -e "s^@NIX_CMD_PATH\@^$nix^g" \ + -e "s^@NIX\@^$nix^g" \ -e "s^@bash\@^$bash^g" \ -e "s^@findutils\@^$findutils^g" \ -e "s^@coreutilsdiet\@^$coreutilsdiet^g" \ diff --git a/pkgs.nix b/pkgs.nix index 90d5e5646b3..6ded595d5e1 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -2,20 +2,22 @@ rec { inherit (import /nixpkgs/trunk/pkgs/top-level/all-packages.nix {}) stdenv kernel bash bashStatic coreutils coreutilsDiet findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogsDiet e2fsprogs - nettools nix subversion gcc wget which vim less screen openssh binutils + nettools nixUnstable subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic udev dhcpWrapper man nano eject sysklogd kudzu xawtv; boot = (import ./boot) {inherit stdenv bash bashStatic coreutils findutilsWrapper - utillinux utillinuxStatic sysvinit e2fsprogs nettools nix subversion gcc wget which vim + utillinux utillinuxStatic sysvinit e2fsprogs nettools subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper parted module_init_tools - udev dhcpWrapper man nano;}; + udev dhcpWrapper man nano; + nix = nixUnstable;}; init = (import ./init) {inherit stdenv bash bashStatic coreutilsDiet utillinux e2fsprogsDiet - nix shadowutils mingettyWrapper grubWrapper parted module_init_tools - dhcpWrapper man nano eject;}; + shadowutils mingettyWrapper grubWrapper parted module_init_tools + dhcpWrapper man nano eject; + nix = nixUnstable;}; everything = [boot sysvinit sysklogd kernel xawtv]; } -- GitLab From 32c8535c4d72a7612822b61ec95c3883189173d6 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 25 Jun 2006 10:42:17 +0000 Subject: [PATCH 0137/5331] reenable e2fsprogs compiled with dietlibc svn path=/nixu/trunk/; revision=5528 --- make-disk.sh | 5 +++-- pkgs.nix | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index 52a09680e06..fc62a697dea 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -58,8 +58,8 @@ utilLinux=$(nix-store -r $(echo '(import ./pkgs.nix).utillinuxStatic' | $NIX/nix coreUtilsDiet=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX/nix-instantiate -))) ## temporarily normal e2fsprogs until I can get it to build with dietlibc -#e2fsProgs=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX/nix-instantiate -))) -e2fsProgs=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX/nix-instantiate -))) +e2fsProgs=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX/nix-instantiate -))) +#e2fsProgs=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX/nix-instantiate -))) modUtils=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -))) Grub=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -))) #gnuSed=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX/nix-instantiate -))) @@ -75,6 +75,7 @@ coreutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX/nix- findutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) utillinux=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX/nix-instantiate -)) e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX/nix-instantiate -)) +#e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX/nix-instantiate -)) modutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -)) grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -)) mingettyWrapper=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mingettyWrapper' | $NIX/nix-instantiate -)) diff --git a/pkgs.nix b/pkgs.nix index 6ded595d5e1..f028a8e03d3 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -14,10 +14,11 @@ rec { udev dhcpWrapper man nano; nix = nixUnstable;}; - init = (import ./init) {inherit stdenv bash bashStatic coreutilsDiet utillinux e2fsprogsDiet + init = (import ./init) {inherit stdenv bash bashStatic coreutilsDiet utillinux shadowutils mingettyWrapper grubWrapper parted module_init_tools - dhcpWrapper man nano eject; - nix = nixUnstable;}; + dhcpWrapper man nano eject e2fsprogsDiet; + nix = nixUnstable; + }; everything = [boot sysvinit sysklogd kernel xawtv]; } -- GitLab From e76efef0d0d4fb53ab2081ec999704775f8e7044 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 2 Jul 2006 22:37:40 +0000 Subject: [PATCH 0138/5331] make sure we always have mktemp, by building our own version first using Nix. This makes it a bit more pure to build the NixOS iso. Still room for improvement though... svn path=/nixu/trunk/; revision=5559 --- make-disk.sh | 10 +++++++--- pkgs.nix | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index fc62a697dea..6043b61fcb2 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -3,7 +3,13 @@ # deps is an array declare -a deps -archivesDir=$(mktemp -d) +# determine where we can find the Nix binaries +NIX=$(dirname $(which nix-store)) + +# make sure we use our own mktemp, because it is more pure +mktemp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mktemp' | $NIX/nix-instantiate -)) +archivesDir=$($mktemp/bin/mktemp -d) + manifest=${archivesDir}/MANIFEST nixpkgs=/nixpkgs/trunk/pkgs fill_disk=$archivesDir/scripts/fill-disk.sh @@ -15,8 +21,6 @@ initrd=/tmp/initram.img initdir=${archivesDir}/initdir initscript=$archivesDir/scripts/init.sh -# determine where we can find the Nix binaries -NIX=$(dirname $(which nix-store)) storeExpr=$($NIX/nix-store -qR $($NIX/nix-store -r $(echo '(import ./pkgs.nix).everything' | $NIX/nix-instantiate -))) #$NIX/nix-push --copy $archivesDir $manifest $($NIX/nix-store -r $storeExpr) $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) diff --git a/pkgs.nix b/pkgs.nix index f028a8e03d3..66076370bc3 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -5,7 +5,7 @@ rec { nettools nixUnstable subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic udev - dhcpWrapper man nano eject sysklogd kudzu xawtv; + dhcpWrapper man nano eject sysklogd kudzu xawtv mktemp; boot = (import ./boot) {inherit stdenv bash bashStatic coreutils findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogs nettools subversion gcc wget which vim -- GitLab From a60d5c3bdb3ee213ad091c1f8a66acadef167be0 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 3 Jul 2006 08:39:52 +0000 Subject: [PATCH 0139/5331] also use sed and tar from Nixpkgs instead of the host system svn path=/nixu/trunk/; revision=5562 --- make-disk.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index 6043b61fcb2..aee054fd1e9 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -6,10 +6,13 @@ declare -a deps # determine where we can find the Nix binaries NIX=$(dirname $(which nix-store)) -# make sure we use our own mktemp, because it is more pure +# make sure we use many of our own tools, because it is more pure mktemp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mktemp' | $NIX/nix-instantiate -)) -archivesDir=$($mktemp/bin/mktemp -d) +gnused=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX/nix-instantiate -)) +gnutar=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX/nix-instantiate -)) + +archivesDir=$($mktemp/bin/mktemp -d) manifest=${archivesDir}/MANIFEST nixpkgs=/nixpkgs/trunk/pkgs fill_disk=$archivesDir/scripts/fill-disk.sh @@ -55,7 +58,7 @@ do echo $j >> $storePaths done echo copying from store: $i - tar -cf - $i | tar --directory=$archivesDir -xf - + $gnutar/bin/tar -cf - $i | $gnutar/bin/tar --directory=$archivesDir -xf - done utilLinux=$(nix-store -r $(echo '(import ./pkgs.nix).utillinuxStatic' | $NIX/nix-instantiate -)) @@ -88,7 +91,6 @@ dhcp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX/nix-ins nano=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX/nix-instantiate -)) gnugrep=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX/nix-instantiate -)) which=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).which' | $NIX/nix-instantiate -)) -gnutar=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX/nix-instantiate -)) eject=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).eject' | $NIX/nix-instantiate -)) sysklogd=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysklogd' | $NIX/nix-instantiate -)) #kudzu=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kudzu' | $NIX/nix-instantiate -)) @@ -153,11 +155,11 @@ echo copying scripts mkdir ${archivesDir}/scripts cp -fa * ${archivesDir}/scripts -sed -e "s^@bash\@^$bash^g" \ +$gnused/bin/sed -e "s^@bash\@^$bash^g" \ -e "s^@coreutils\@^$coreutilsdiet^g" \ < $initscript > $initscript.tmp mv $initscript.tmp $initscript -sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ +$gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@bootPath\@^$bootPath^g" \ -e "s^@nix\@^$nix^g" \ -e "s^@bash\@^$bash^g" \ @@ -180,7 +182,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ < $fill_disk > $fill_disk.tmp mv $fill_disk.tmp $fill_disk -sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ +$gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@bootPath\@^$bootPath^g" \ -e "s^@NIX\@^$nix^g" \ -e "s^@bash\@^$bash^g" \ -- GitLab From c984b735bddbb7c3fddd6af4d3d68d7062409f19 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 3 Jul 2006 09:32:15 +0000 Subject: [PATCH 0140/5331] also use mkisofs from Nixpkgs svn path=/nixu/trunk/; revision=5563 --- make-disk.sh | 7 ++++--- pkgs.nix | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index aee054fd1e9..e7b68b484eb 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -11,6 +11,7 @@ mktemp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mktemp' | $NIX/nix-instan gnused=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX/nix-instantiate -)) gnutar=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX/nix-instantiate -)) +cdrtools=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).cdrtools' | $NIX/nix-instantiate -)) archivesDir=$($mktemp/bin/mktemp -d) manifest=${archivesDir}/MANIFEST @@ -257,9 +258,9 @@ rm -f ${initrd} echo creating ISO image -mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin -c isolinux/boot.cat \ - -no-emul-boot -boot-load-size 4 -boot-info-table \ - ${archivesDir} +$cdrtools/bin/mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin \ + -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 \ + -boot-info-table ${archivesDir} # cleanup, be diskspace friendly diff --git a/pkgs.nix b/pkgs.nix index 66076370bc3..e2005944648 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -5,7 +5,7 @@ rec { nettools nixUnstable subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic udev - dhcpWrapper man nano eject sysklogd kudzu xawtv mktemp; + dhcpWrapper man nano eject sysklogd kudzu xawtv mktemp cdrtools; boot = (import ./boot) {inherit stdenv bash bashStatic coreutils findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogs nettools subversion gcc wget which vim -- GitLab From a1bd3698efacfa5e507b13c18a5d48d73f4bab1d Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 3 Jul 2006 22:20:22 +0000 Subject: [PATCH 0141/5331] also use our own coreutils svn path=/nixu/trunk/; revision=5564 --- make-disk.sh | 106 +++++++++++++++++++++++++-------------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index e7b68b484eb..603402c6343 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -12,6 +12,7 @@ mktemp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mktemp' | $NIX/nix-instan gnused=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX/nix-instantiate -)) gnutar=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX/nix-instantiate -)) cdrtools=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).cdrtools' | $NIX/nix-instantiate -)) +coreutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX/nix-instantiate -)) archivesDir=$($mktemp/bin/mktemp -d) manifest=${archivesDir}/MANIFEST @@ -52,7 +53,7 @@ do echo $i >> $storePaths echo '' >> $storePaths deps=$($NIX/nix-store -q --references $i) - pkgs=$(echo $deps | wc -w) + pkgs=$(echo $deps | $coreutils/bin/wc -w) echo $pkgs >> $storePaths for j in $deps do @@ -79,7 +80,6 @@ BootPath=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).boot' | bashGlibc=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX/nix-instantiate -)) bash=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).bashStatic' | $NIX/nix-instantiate -)) coreutilsdiet=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX/nix-instantiate -)) -coreutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX/nix-instantiate -)) findutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) utillinux=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX/nix-instantiate -)) e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX/nix-instantiate -)) @@ -114,27 +114,27 @@ sysklogd=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysklogd' | $NIX/nix-in echo creating directories for bootimage -mkdir ${initdir} -mkdir ${initdir}/bin -mkdir ${initdir}/cdrom -mkdir ${initdir}/dev -mkdir ${initdir}/etc -mkdir ${initdir}/etc/sysconfig -mkdir ${initdir}/installimage -mkdir ${initdir}/modules -mkdir ${initdir}/proc -mkdir ${initdir}/sbin -mkdir ${initdir}/sys -mkdir ${initdir}/tmp -mkdir -p ${initdir}/usr/bin -mkdir -p ${initdir}/usr/sbin -mkdir ${initdir}/var -mkdir ${initdir}/var/run +$coreutils/bin/mkdir ${initdir} +$coreutils/bin/mkdir ${initdir}/bin +$coreutils/bin/mkdir ${initdir}/cdrom +$coreutils/bin/mkdir ${initdir}/dev +$coreutils/bin/mkdir ${initdir}/etc +$coreutils/bin/mkdir ${initdir}/etc/sysconfig +$coreutils/bin/mkdir ${initdir}/installimage +$coreutils/bin/mkdir ${initdir}/modules +$coreutils/bin/mkdir ${initdir}/proc +$coreutils/bin/mkdir ${initdir}/sbin +$coreutils/bin/mkdir ${initdir}/sys +$coreutils/bin/mkdir ${initdir}/tmp +$coreutils/bin/mkdir -p ${initdir}/usr/bin +$coreutils/bin/mkdir -p ${initdir}/usr/sbin +$coreutils/bin/mkdir ${initdir}/var +$coreutils/bin/mkdir ${initdir}/var/run echo copying nixpkgs #svn export ${nixpkgs} ${archivesDir}/pkgs -cp -fa ${nixpkgs} ${archivesDir} +$coreutils/bin/cp -fa ${nixpkgs} ${archivesDir} #tar cf $archivesDir #echo copying packages from store @@ -154,12 +154,12 @@ cp -fa ${nixpkgs} ${archivesDir} echo copying scripts -mkdir ${archivesDir}/scripts -cp -fa * ${archivesDir}/scripts +$coreutils/bin/mkdir ${archivesDir}/scripts +$coreutils/bin/cp -fa * ${archivesDir}/scripts $gnused/bin/sed -e "s^@bash\@^$bash^g" \ -e "s^@coreutils\@^$coreutilsdiet^g" \ < $initscript > $initscript.tmp -mv $initscript.tmp $initscript +$coreutils/bin/mv $initscript.tmp $initscript $gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@bootPath\@^$bootPath^g" \ -e "s^@nix\@^$nix^g" \ @@ -181,7 +181,7 @@ $gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@gnutar\@^$gnutar^g" \ -e "s^@mingetty\@^$mingettyWrapper^g" \ < $fill_disk > $fill_disk.tmp -mv $fill_disk.tmp $fill_disk +$coreutils/bin/mv $fill_disk.tmp $fill_disk $gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@bootPath\@^$bootPath^g" \ @@ -200,61 +200,61 @@ $gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@gnutar\@^$gnutar^g" \ -e "s^@mingetty\@^$mingettyWrapper^g" \ < $ramdisk_login > $ramdisk_login.tmp -mv $ramdisk_login.tmp $ramdisk_login +$coreutils/bin/mv $ramdisk_login.tmp $ramdisk_login echo copying bootimage -mkdir ${archivesDir}/isolinux -cp ${syslinux}/lib/syslinux/isolinux.bin ${archivesDir}/isolinux -cp isolinux.cfg ${archivesDir}/isolinux -chmod u+w ${archivesDir}/isolinux/* +$coreutils/bin/mkdir ${archivesDir}/isolinux +$coreutils/bin/cp ${syslinux}/lib/syslinux/isolinux.bin ${archivesDir}/isolinux +$coreutils/bin/cp isolinux.cfg ${archivesDir}/isolinux +$coreutils/bin/chmod u+w ${archivesDir}/isolinux/* echo copying kernel # By following the symlink we don't have to know the version number # of the kernel here. -cp -L $kernel/vmlinuz ${archivesDir}/isolinux +$coreutils/bin/cp -L $kernel/vmlinuz ${archivesDir}/isolinux echo linking kernel modules -ln -s $kernel/lib $archivesDir/lib +$coreutils/bin/ln -s $kernel/lib $archivesDir/lib echo creating ramdisk -rm -f ${initrd} +$coreutils/bin/rm -f ${initrd} #cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init -cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/ -cp ${archivesDir}/scripts/ramdisk-login.sh ${initdir}/ -cp ${archivesDir}/scripts/init.sh ${initdir}/init +$coreutils/bin/cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/ +$coreutils/bin/cp ${archivesDir}/scripts/ramdisk-login.sh ${initdir}/ +$coreutils/bin/cp ${archivesDir}/scripts/init.sh ${initdir}/init #ln -s ${bash}/bin/bash ${initdir}/bin/sh -cp ${bash}/bin/bash ${initdir}/bin/sh -chmod u+x ${initdir}/init -chmod u+x ${initdir}/fill-disk.sh -chmod u+x ${initdir}/ramdisk-login.sh +$coreutils/bin/cp ${bash}/bin/bash ${initdir}/bin/sh +$coreutils/bin/chmod u+x ${initdir}/init +$coreutils/bin/chmod u+x ${initdir}/fill-disk.sh +$coreutils/bin/chmod u+x ${initdir}/ramdisk-login.sh #cp -fau --parents ${utilLinux} ${initdir} #cp -fau --parents ${coreUtilsDiet} ${initdir} #cp -fau --parents ${modUtils} ${initdir} -cp -fau --parents ${bash}/bin ${initdir} -cp -fau --parents ${utilLinux}/bin ${initdir} -chmod -R u+w ${initdir} -cp -fau --parents ${utilLinux}/sbin ${initdir} -cp -fau --parents ${e2fsProgs} ${initdir} -cp -fau --parents ${coreutilsdiet}/bin ${initdir} -cp -fau --parents ${modutils}/bin ${initdir} -chmod -R u+w ${initdir} +$coreutils/bin/cp -fau --parents ${bash}/bin ${initdir} +$coreutils/bin/cp -fau --parents ${utilLinux}/bin ${initdir} +$coreutils/bin/chmod -R u+w ${initdir} +$coreutils/bin/cp -fau --parents ${utilLinux}/sbin ${initdir} +$coreutils/bin/cp -fau --parents ${e2fsProgs} ${initdir} +$coreutils/bin/cp -fau --parents ${coreutilsdiet}/bin ${initdir} +$coreutils/bin/cp -fau --parents ${modutils}/bin ${initdir} +$coreutils/bin/chmod -R u+w ${initdir} echo modutils -cp -fau --parents ${modutils}/sbin ${initdir} +$coreutils/bin/cp -fau --parents ${modutils}/sbin ${initdir} #cp -fau --parents ${kudzu} ${initdir} -touch ${archivesDir}/NIXOS +$coreutils/bin/touch ${archivesDir}/NIXOS (cd ${initdir}; find . |cpio -H newc -o) | gzip -9 > ${initrd} -chmod -f -R +w ${initdir}/* -rm -rf ${initdir} +$coreutils/bin/chmod -f -R +w ${initdir}/* +$coreutils/bin/rm -rf ${initdir} -cp ${initrd} ${archivesDir}/isolinux -rm -f ${initrd} +$coreutils/bin/cp ${initrd} ${archivesDir}/isolinux +$coreutils/bin/rm -f ${initrd} echo creating ISO image @@ -266,5 +266,5 @@ $cdrtools/bin/mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin \ echo cleaning up -chmod -f -R +w ${archivesDir}/* +$coreutils/bin/chmod -f -R +w ${archivesDir}/* #rm -rf ${archivesDir}/* -- GitLab From 8a14c8d8864bda6e8270af9630df90abbaa12cd8 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 3 Jul 2006 22:40:56 +0000 Subject: [PATCH 0142/5331] wel also want to use our own gzip svn path=/nixu/trunk/; revision=5565 --- make-disk.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/make-disk.sh b/make-disk.sh index 603402c6343..fd6152fd2e8 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -13,6 +13,7 @@ gnused=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX/nix-instan gnutar=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX/nix-instantiate -)) cdrtools=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).cdrtools' | $NIX/nix-instantiate -)) coreutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX/nix-instantiate -)) +gzip=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).gzip' | $NIX/nix-instantiate -)) archivesDir=$($mktemp/bin/mktemp -d) manifest=${archivesDir}/MANIFEST @@ -248,7 +249,7 @@ $coreutils/bin/cp -fau --parents ${modutils}/sbin ${initdir} $coreutils/bin/touch ${archivesDir}/NIXOS -(cd ${initdir}; find . |cpio -H newc -o) | gzip -9 > ${initrd} +(cd ${initdir}; find . |cpio -H newc -o) | $gzip/bin/gzip -9 > ${initrd} $coreutils/bin/chmod -f -R +w ${initdir}/* $coreutils/bin/rm -rf ${initdir} -- GitLab From 45a2be1fbef27c9f4d16212e769f8f0ca1fa165f Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 3 Jul 2006 23:16:44 +0000 Subject: [PATCH 0143/5331] also use our own cpio. Make sure we don't just query nix expressions, but actually realize them as well. D'oh! svn path=/nixu/trunk/; revision=5566 --- make-disk.sh | 7 ++++--- pkgs.nix | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index fd6152fd2e8..101c1b7f977 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -12,8 +12,9 @@ mktemp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mktemp' | $NIX/nix-instan gnused=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX/nix-instantiate -)) gnutar=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX/nix-instantiate -)) cdrtools=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).cdrtools' | $NIX/nix-instantiate -)) -coreutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX/nix-instantiate -)) -gzip=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).gzip' | $NIX/nix-instantiate -)) +coreutils=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).coreutils' | $NIX/nix-instantiate -)) +gzip=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gzip' | $NIX/nix-instantiate -)) +cpio=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).cpio' | $NIX/nix-instantiate -)) archivesDir=$($mktemp/bin/mktemp -d) manifest=${archivesDir}/MANIFEST @@ -249,7 +250,7 @@ $coreutils/bin/cp -fau --parents ${modutils}/sbin ${initdir} $coreutils/bin/touch ${archivesDir}/NIXOS -(cd ${initdir}; find . |cpio -H newc -o) | $gzip/bin/gzip -9 > ${initrd} +(cd ${initdir}; find . |$cpio/bin/cpio -H newc -o) | $gzip/bin/gzip -9 > ${initrd} $coreutils/bin/chmod -f -R +w ${initdir}/* $coreutils/bin/rm -rf ${initdir} diff --git a/pkgs.nix b/pkgs.nix index e2005944648..0762f3e2099 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -5,7 +5,7 @@ rec { nettools nixUnstable subversion gcc wget which vim less screen openssh binutils strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic udev - dhcpWrapper man nano eject sysklogd kudzu xawtv mktemp cdrtools; + dhcpWrapper man nano eject sysklogd kudzu xawtv mktemp cdrtools cpio; boot = (import ./boot) {inherit stdenv bash bashStatic coreutils findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogs nettools subversion gcc wget which vim -- GitLab From afb7f5b95008dc2986535b3bae56695a7c9aef39 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 4 Jul 2006 18:12:48 +0000 Subject: [PATCH 0144/5331] actually build nix-unstable svn path=/nixu/trunk/; revision=5577 --- make-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-disk.sh b/make-disk.sh index 101c1b7f977..7311499b1e2 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -38,7 +38,7 @@ sysvinitPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/ni # Location of Nix boot scripts? bootPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instantiate -)) -nix=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).nixUnstable' | $NIX/nix-instantiate -)) +nix=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nixUnstable' | $NIX/nix-instantiate -)) syslinux=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).syslinux' | $NIX/nix-instantiate -)) -- GitLab From 89762236cfba6fa514bbee565a117f125870553d Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 4 Jul 2006 20:38:14 +0000 Subject: [PATCH 0145/5331] it is nice to have a few more ttys available in NixOS, so mknod them svn path=/nixu/trunk/; revision=5582 --- fill-disk.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fill-disk.sh b/fill-disk.sh index d39bbfb72c3..3ed5edc8bfc 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -196,6 +196,8 @@ mknod -m 0600 $root/dev/console c 5 1 mknod -m 0600 $root/dev/tty c 5 0 mknod -m 0600 $root/dev/tty0 c 4 0 mknod -m 0600 $root/dev/tty1 c 4 1 +mknod -m 0600 $root/dev/tty2 c 4 2 +mknod -m 0600 $root/dev/tty3 c 4 3 mknod -m 0444 $root/dev/urandom c 1 9 rm -f $root/etc/mtab -- GitLab From 95fa5b81b13dc6bd61b24aec180dbcff33854b26 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 9 Jul 2006 22:33:01 +0000 Subject: [PATCH 0146/5331] remove a dependency on an external coreutils (overlooked) svn path=/nixu/trunk/; revision=5669 --- make-disk.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index 7311499b1e2..10289da0042 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -3,8 +3,13 @@ # deps is an array declare -a deps +NIXSTORE=`which nix-store` +NIXINSTANTIATE=`which nix-instantiate` + +coreutils=$($NIXSTORE -r $(echo '(import ./pkgs.nix).coreutils' | $NIXINSTANTIATE -)) + # determine where we can find the Nix binaries -NIX=$(dirname $(which nix-store)) +NIX=$($coreutils/bin/dirname $(which nix-store)) # make sure we use many of our own tools, because it is more pure mktemp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mktemp' | $NIX/nix-instantiate -)) @@ -12,7 +17,6 @@ mktemp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mktemp' | $NIX/nix-instan gnused=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX/nix-instantiate -)) gnutar=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX/nix-instantiate -)) cdrtools=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).cdrtools' | $NIX/nix-instantiate -)) -coreutils=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).coreutils' | $NIX/nix-instantiate -)) gzip=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gzip' | $NIX/nix-instantiate -)) cpio=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).cpio' | $NIX/nix-instantiate -)) -- GitLab From 8c56a19d5505f37a348a9c1acde3aa0be17ff243 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 31 Jul 2006 15:16:10 +0000 Subject: [PATCH 0147/5331] take closure of statically linked bash, this makes it "deterministic" according to eelco ;) svn path=/nixu/trunk/; revision=6007 --- make-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-disk.sh b/make-disk.sh index 10289da0042..5710edecb97 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -84,7 +84,7 @@ SysVinit=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).sysvini BootPath=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instantiate -))) bashGlibc=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX/nix-instantiate -)) -bash=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).bashStatic' | $NIX/nix-instantiate -)) +bash=$($NIX/nix-store -qR $($NIX/nix-store -r $(echo '(import ./pkgs.nix).bashStatic' | $NIX/nix-instantiate -))) coreutilsdiet=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX/nix-instantiate -)) findutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) utillinux=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX/nix-instantiate -)) -- GitLab From 2c87da322d2781fee2f6cd65d1924651318f2dd8 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 2 Aug 2006 22:34:13 +0000 Subject: [PATCH 0148/5331] use less packages svn path=/nixu/trunk/; revision=6024 --- pkgs.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs.nix b/pkgs.nix index 0762f3e2099..de670d2eeda 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -2,10 +2,10 @@ rec { inherit (import /nixpkgs/trunk/pkgs/top-level/all-packages.nix {}) stdenv kernel bash bashStatic coreutils coreutilsDiet findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogsDiet e2fsprogs - nettools nixUnstable subversion gcc wget which vim less screen openssh binutils + nettools nixUnstable subversion gcc wget which vim less screen openssh binutils nixStatic strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic udev - dhcpWrapper man nano eject sysklogd kudzu xawtv mktemp cdrtools cpio; + dhcpWrapper man nano eject sysklogd mktemp cdrtools cpio; boot = (import ./boot) {inherit stdenv bash bashStatic coreutils findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogs nettools subversion gcc wget which vim @@ -20,5 +20,5 @@ rec { nix = nixUnstable; }; - everything = [boot sysvinit sysklogd kernel xawtv]; + everything = [boot sysvinit sysklogd kernel ]; } -- GitLab From 493661f8808f5c6fa35f85dea5f4e450ae92bb64 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 2 Aug 2006 22:42:56 +0000 Subject: [PATCH 0149/5331] This is a major big update for the install process for NixOS. This requires the latest patches to Nix itself, which were committed the last few days. Biggest changes: make-disk.sh: * use nix-push to generate NAR files and a manifest * use only copy a "few" packages (but probably still too many than we want) to the Nix store on the CD fill-disk.sh: * use nix-pull to register a manifest with a lot of packages. Only copy and register as valid the few packages that are in the Nix store on the installer CD, install the rest via nix-env and other tools (this needs to be reviewed thoroughly for optimizations). All in all the install process is a lot cleaner now, the login script is broken however (but should be relatively easy to fix with some Nix wizardry). NIX_ROOT is still broken, but we can work around most issues with relative ease now. svn path=/nixu/trunk/; revision=6025 --- fill-disk.sh | 54 ++++++++++++++++++++++++++++++++++++++++------------ make-disk.sh | 30 ++++++++++++++++++++--------- 2 files changed, 63 insertions(+), 21 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 3ed5edc8bfc..7664549e580 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,10 +1,10 @@ #! @bash@/bin/sh -e -export PATH=/bin:/sbin:@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@utilLinux@/bin:@utilLinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@eject@/bin:@kudzu@/sbin:@xawtv@/bin +export PATH=/bin:/sbin:@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@utilLinux@/bin:@utilLinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@eject@/bin:@kudzu@/sbin:@utillinux@/bin ## ## In the beginning we want to have a minimalistic environment, built with -## klibc. +## dietlibc. ## kernel=@kernel@ @@ -143,6 +143,7 @@ echo creating file system hierarchy on target drive make_dir 00755 /bin make_dir 00755 /boot +make_dir 00755 /cdrom make_dir 00755 /dev make_dir 00755 /dev/pts make_dir 00755 /etc # global non-constant configuration @@ -224,13 +225,18 @@ echo "Looking for CDROM in: $i" fi done -echo switch to /nix and /nixpkgs from CD -## starting here it's OK to have full blown glibc +echo mounting /cdrom in the target +mount --bind /cdrom $root/cdrom + +echo switch to /nix and /nixpkgs from CD +## starting here it's OK to have full blown glibc ln -s /cdrom/nixpkgs /nixpkgs + mount --bind /cdrom/nix /nix + echo probing for hardware... #kudzu @@ -260,9 +266,6 @@ tar --directory=/cdrom -cf - pkgs | tar --directory=$root/nixpkgs/trunk -xvf - make_dir 0755 /tmp/scripts cp -fa /cdrom/scripts $root/tmp -#echo adding manifest -#$NIX/nix-pull $manifest - echo adding packages export NIX_ROOT=$root @@ -283,20 +286,43 @@ cp /cdrom/mystorepaths $root/tmp echo copying store -#cp -fva /nix/store/* $root/nix/store +cp -fva /nix/store/* $root/nix/store tar cf - /nix/store | tar --directory=$root -xvf - echo registering valid paths... $NIX/nix-store --register-validity < $root/tmp/mystorepaths + +unset NIX_ROOT +export NIX_DATA_DIR=$root/nix/share +export NIX_LOG_DIR=$root/nix/log/nix +export NIX_STATE_DIR=$root/nix/var/nix +export NIX_CONF_DIR=$root/nix/etc + +echo creating /bin/sh +ln -s @bashGlibc@/bin/sh $root/bin/sh + +echo adding manifest +$NIX/nix-pull file:///cdrom/MANIFEST + +export NIX_ROOT=$root +unset NIX_DATA_DIR +unset NIX_LOG_DIR +unset NIX_STATE_DIR +unset NIX_CONF_DIR + +### Fix this. Probably nix-instantiate, then nix-store -r. +### Also make sure everything gets installed into an actual profile! $NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix nix $NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix coreutils +$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix gnugrep +$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix linux +$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix grub echo setting init symlink... rm -f $root/init #ln -s $sysvinitPath/sbin/init $root/init ln -s @sysvinitPath@/sbin/init $root/sbin/init -ln -s @bashGlibc@/bin/sh $root/bin/sh #ln -s @bash@/bin/bash $root/bin/bash echo setting up inittab... @@ -339,12 +365,12 @@ touch_file /etc/services ### ### Do kernel stuff here. ### -strippedName=$(basename @kernel@); +strippedName=$(basename $root/@kernel@); if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then strippedName=$(echo "$strippedName" | cut -c34- | cut -c 7-) fi -kernelhash=$(basename @kernel@); +kernelhash=$(basename $root/@kernel@); if echo "$kernelhash" | grep -q '^[a-z0-9]\{32\}-'; then kernelhash=$(echo "$kernelhash" | cut -c -32) fi @@ -355,7 +381,7 @@ make_dir 0755 /lib/modules/$version ln -s @kernel@/lib/modules/$version/build $root/lib/modules/$version/build ln -s @kernel@/lib/modules/$version/kernel $root/lib/modules/$version/kernel -cp @kernel@/lib/modules/$version/modules.* $root/lib/modules/$version +cp $root/@kernel@/lib/modules/$version/modules.* $root/lib/modules/$version chmod 644 $root/lib/modules/$version/modules.* ### @@ -382,9 +408,13 @@ title NixOS kernel @kernel@/vmlinuz root=$device GRUBEND +# clear substitutes here? +# nix-store --clear-substitutes ?? + echo copying install log cp /tmp/install-log $root/root +sleep 10; echo umounting filesystem diff --git a/make-disk.sh b/make-disk.sh index 5710edecb97..0cd081f0611 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -32,9 +32,16 @@ initrd=/tmp/initram.img initdir=${archivesDir}/initdir initscript=$archivesDir/scripts/init.sh +nix=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nixUnstable' | $NIX/nix-instantiate -)) + +nixDeps=$($NIX/nix-store -qR $nix) storeExpr=$($NIX/nix-store -qR $($NIX/nix-store -r $(echo '(import ./pkgs.nix).everything' | $NIX/nix-instantiate -))) -#$NIX/nix-push --copy $archivesDir $manifest $($NIX/nix-store -r $storeExpr) $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) +#storeExpr=$($NIX/nix-store -r $($NIX/nix-store -qR $(echo '(import ./pkgs.nix).everything' | $NIX/nix-instantiate -))) + +### make NAR files for everything we want to install and some more. Make sure +### the right URL is in there, so specify /cdrom and not cdrom +$NIX/nix-push --copy $archivesDir $manifest --target /cdrom $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) # Location of sysvinit? sysvinitPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/nix-instantiate -)) @@ -42,8 +49,6 @@ sysvinitPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/ni # Location of Nix boot scripts? bootPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instantiate -)) -nix=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nixUnstable' | $NIX/nix-instantiate -)) - syslinux=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).syslinux' | $NIX/nix-instantiate -)) kernel=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) @@ -54,7 +59,17 @@ kernel=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instan #echo $($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX/nix-instantiate -))) >> $storePaths #$NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX/nix-instantiate -)) >> $storePaths -for i in $storeExpr +utillinux=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX/nix-instantiate -)) + +gnugrep=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX/nix-instantiate -)) + +grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -)) + +combideps=$($NIX/nix-store -qR $nix $utillinux $gnugrep $grub) + +#for i in $storeExpr +#for i in $nixDeps +for i in $combideps do echo $i >> $storePaths echo '' >> $storePaths @@ -77,19 +92,18 @@ e2fsProgs=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fspr #e2fsProgs=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX/nix-instantiate -))) modUtils=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -))) Grub=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -))) -#gnuSed=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX/nix-instantiate -))) -#gnuGrep=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX/nix-instantiate -))) Kernel=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -))) SysVinit=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/nix-instantiate -))) BootPath=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instantiate -))) bashGlibc=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX/nix-instantiate -)) -bash=$($NIX/nix-store -qR $($NIX/nix-store -r $(echo '(import ./pkgs.nix).bashStatic' | $NIX/nix-instantiate -))) +bash=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).bashStatic' | $NIX/nix-instantiate -)) coreutilsdiet=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX/nix-instantiate -)) findutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) utillinux=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX/nix-instantiate -)) e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX/nix-instantiate -)) #e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX/nix-instantiate -)) +#e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX/nix-instantiate -)) modutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -)) grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -)) mingettyWrapper=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mingettyWrapper' | $NIX/nix-instantiate -)) @@ -248,9 +262,7 @@ $coreutils/bin/cp -fau --parents ${e2fsProgs} ${initdir} $coreutils/bin/cp -fau --parents ${coreutilsdiet}/bin ${initdir} $coreutils/bin/cp -fau --parents ${modutils}/bin ${initdir} $coreutils/bin/chmod -R u+w ${initdir} -echo modutils $coreutils/bin/cp -fau --parents ${modutils}/sbin ${initdir} -#cp -fau --parents ${kudzu} ${initdir} $coreutils/bin/touch ${archivesDir}/NIXOS -- GitLab From 71755c6176c218eeb969e5f4bacfeb7156e3c976 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 2 Aug 2006 22:54:44 +0000 Subject: [PATCH 0150/5331] unmount all filesystems properly before unmounting target disk svn path=/nixu/trunk/; revision=6026 --- fill-disk.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/fill-disk.sh b/fill-disk.sh index 7664549e580..3fba3c0619d 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -418,6 +418,7 @@ sleep 10; echo umounting filesystem +umount $root/cdrom umount $root #umount /nix umount /cdrom -- GitLab From fcc3b33cb9d410228812199c0d4b06e26fc94500 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 3 Aug 2006 13:43:44 +0000 Subject: [PATCH 0151/5331] pack Nix packages in a tarball, unpack tarball, don't copy it file for file from CD (== slow) svn path=/nixu/trunk/; revision=6030 --- fill-disk.sh | 13 +++++++------ make-disk.sh | 7 ++++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 3fba3c0619d..c0a71d1c85c 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=/bin:/sbin:@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@utilLinux@/bin:@utilLinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@eject@/bin:@kudzu@/sbin:@utillinux@/bin +export PATH=/bin:/sbin:@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@utilLinux@/bin:@utilLinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@eject@/bin:@kudzu@/sbin:@utillinux@/bin:@gzip@/bin ## ## In the beginning we want to have a minimalistic environment, built with @@ -165,8 +165,8 @@ make_dir 00755 /nix/var/nix/profiles make_dir 00755 /nix/var/nix/temproots make_dir 00755 /nix/var/log make_dir 00755 /nix/var/log/nix -make_dir 00755 /nixpkgs -make_dir 00755 /nixpkgs/trunk +#make_dir 00755 /nixpkgs +#make_dir 00755 /nixpkgs/trunk make_dir 00755 /proc make_dir 00750 /root make_dir 00755 /sbin @@ -230,9 +230,9 @@ echo mounting /cdrom in the target mount --bind /cdrom $root/cdrom -echo switch to /nix and /nixpkgs from CD +echo switch to /nix from CD ## starting here it's OK to have full blown glibc -ln -s /cdrom/nixpkgs /nixpkgs +#ln -s /cdrom/nixpkgs /nixpkgs mount --bind /cdrom/nix /nix @@ -261,7 +261,8 @@ $NIX/nix-store --verify echo copying nixpkgs... #cp -fLa /cdrom/pkgs $root/nixpkgs/trunk -tar --directory=/cdrom -cf - pkgs | tar --directory=$root/nixpkgs/trunk -xvf - +#tar --directory=/cdrom -cf - pkgs | tar --directory=$root/nixpkgs/trunk -xvf - +tar --directory=$root -zxvf /cdrom/nixpkgs.tgz make_dir 0755 /tmp/scripts cp -fa /cdrom/scripts $root/tmp diff --git a/make-disk.sh b/make-disk.sh index 0cd081f0611..84edfb8c5ed 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -65,7 +65,7 @@ gnugrep=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX/nix-inst grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -)) -combideps=$($NIX/nix-store -qR $nix $utillinux $gnugrep $grub) +combideps=$($NIX/nix-store -qR $nix $utillinux $gnugrep $grub $gzip) #for i in $storeExpr #for i in $nixDeps @@ -154,8 +154,8 @@ $coreutils/bin/mkdir ${initdir}/var/run echo copying nixpkgs #svn export ${nixpkgs} ${archivesDir}/pkgs -$coreutils/bin/cp -fa ${nixpkgs} ${archivesDir} -#tar cf $archivesDir +#$coreutils/bin/cp -fa ${nixpkgs} ${archivesDir} +tar -zcf ${archivesDir}/nixpkgs.tgz ${nixpkgs} #echo copying packages from store @@ -199,6 +199,7 @@ $gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@kudzu\@^$kudzu^g" \ -e "s^@sysklogd\@^$sysklogd^g" \ -e "s^@gnutar\@^$gnutar^g" \ + -e "s^@gzip\@^$gzip^g" \ -e "s^@mingetty\@^$mingettyWrapper^g" \ < $fill_disk > $fill_disk.tmp $coreutils/bin/mv $fill_disk.tmp $fill_disk -- GitLab From 6e030f736c743017b65bafc6ea36a28d90379299 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 3 Aug 2006 16:19:04 +0000 Subject: [PATCH 0152/5331] speed up the installation a *lot*, at the price of a bit more diskspace (49 MB currently) svn path=/nixu/trunk/; revision=6034 --- fill-disk.sh | 4 ++-- make-disk.sh | 16 ++-------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index c0a71d1c85c..b9915b8aa01 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -287,8 +287,8 @@ cp /cdrom/mystorepaths $root/tmp echo copying store -cp -fva /nix/store/* $root/nix/store -tar cf - /nix/store | tar --directory=$root -xvf - +#cp -fva /nix/store/* $root/nix/store +tar --directory=$root -zxvf /cdrom/nixstore.tgz echo registering valid paths... diff --git a/make-disk.sh b/make-disk.sh index 84edfb8c5ed..c0fc341896e 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -84,6 +84,8 @@ do $gnutar/bin/tar -cf - $i | $gnutar/bin/tar --directory=$archivesDir -xf - done +tar zcf ${archivesDir}/nixstore.tgz $combideps + utilLinux=$(nix-store -r $(echo '(import ./pkgs.nix).utillinuxStatic' | $NIX/nix-instantiate -)) coreUtilsDiet=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX/nix-instantiate -))) @@ -154,24 +156,10 @@ $coreutils/bin/mkdir ${initdir}/var/run echo copying nixpkgs #svn export ${nixpkgs} ${archivesDir}/pkgs -#$coreutils/bin/cp -fa ${nixpkgs} ${archivesDir} tar -zcf ${archivesDir}/nixpkgs.tgz ${nixpkgs} #echo copying packages from store -#cp -fa --parents ${nixDeps} ${archivesDir} -#cp -fvau --parents ${utilLinux} ${archivesDir} -#cp -fvau --parents ${Grub} ${archivesDir} -##cp -fau --parents ${gnuSed} ${archivesDir} -##cp -fau --parents ${gnuGrep} ${archivesDir} -#cp -fvau --parents ${Kernel} ${archivesDir} -#cp -fvau --parents ${SysVinit} ${archivesDir} -#cp -fvau --parents ${BootPath} ${archivesDir} -#cp -fvau --parents ${udev} ${archivesDir} -#cp -fvau --parents ${dhcp} ${archivesDir} -#cp -fvau --parents ${nano} ${archivesDir} -#cp -fvau --parents ${gnutar} ${archivesDir} - echo copying scripts $coreutils/bin/mkdir ${archivesDir}/scripts -- GitLab From e030a74c8747dbc177f663e95dc351e5b0c38061 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 3 Aug 2006 17:10:08 +0000 Subject: [PATCH 0153/5331] remove substitutes that point to the installer CD after installation svn path=/nixu/trunk/; revision=6035 --- fill-disk.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index b9915b8aa01..2c2a53a8e1f 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -320,6 +320,8 @@ $NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix gnugrep $NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix linux $NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix grub +$NIX/nix-store --clear-substitutes + echo setting init symlink... rm -f $root/init #ln -s $sysvinitPath/sbin/init $root/init @@ -410,12 +412,10 @@ title NixOS GRUBEND # clear substitutes here? -# nix-store --clear-substitutes ?? echo copying install log cp /tmp/install-log $root/root -sleep 10; echo umounting filesystem -- GitLab From 97690c23dac1ee319c8c2cff1fc1cec60e24da59 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Thu, 3 Aug 2006 18:00:32 +0000 Subject: [PATCH 0154/5331] cosmetic change svn path=/nixu/trunk/; revision=6036 --- pkgs.nix | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/pkgs.nix b/pkgs.nix index de670d2eeda..e773ea87390 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,24 +1,27 @@ rec { inherit (import /nixpkgs/trunk/pkgs/top-level/all-packages.nix {}) - stdenv kernel bash bashStatic coreutils coreutilsDiet findutilsWrapper utillinux utillinuxStatic sysvinit - e2fsprogsDiet e2fsprogs - nettools nixUnstable subversion gcc wget which vim less screen openssh binutils nixStatic - strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip - mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic udev - dhcpWrapper man nano eject sysklogd mktemp cdrtools cpio; + stdenv kernel bash bashStatic coreutils coreutilsDiet findutilsWrapper + utillinux utillinuxStatic sysvinit e2fsprogsDiet e2fsprogs nettools + nixUnstable subversion gcc wget which vim less screen openssh binutils + nixStatic strace shadowutils iputils gnumake curl gnused gnutar gnugrep + gzip mingettyWrapper grubWrapper syslinux parted module_init_tools + module_init_toolsStatic udev dhcpWrapper man nano eject sysklogd mktemp + cdrtools cpio; - boot = (import ./boot) {inherit stdenv bash bashStatic coreutils findutilsWrapper - utillinux utillinuxStatic sysvinit e2fsprogs nettools subversion gcc wget which vim - less screen openssh binutils strace shadowutils iputils gnumake curl - gnused gnutar gnugrep gzip mingettyWrapper grubWrapper parted module_init_tools - udev dhcpWrapper man nano; - nix = nixUnstable;}; + boot = (import ./boot) { + inherit stdenv bash bashStatic coreutils findutilsWrapper utillinux + utillinuxStatic sysvinit e2fsprogs nettools subversion gcc wget which + vim less screen openssh binutils strace shadowutils iputils gnumake curl + gnused gnutar gnugrep gzip mingettyWrapper grubWrapper parted + module_init_tools udev dhcpWrapper man nano; + nix = nixUnstable; + }; - init = (import ./init) {inherit stdenv bash bashStatic coreutilsDiet utillinux - shadowutils mingettyWrapper grubWrapper parted module_init_tools + init = (import ./init) {inherit stdenv bash bashStatic coreutilsDiet + utillinux shadowutils mingettyWrapper grubWrapper parted module_init_tools dhcpWrapper man nano eject e2fsprogsDiet; nix = nixUnstable; - }; + }; everything = [boot sysvinit sysklogd kernel ]; } -- GitLab From 183b838ed87bbe465d6c160334a89c33059b3549 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 4 Aug 2006 09:29:32 +0000 Subject: [PATCH 0155/5331] script cleanups svn path=/nixu/trunk/; revision=6041 --- fill-disk.sh | 50 +++++++++++++++++++------------------------------- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 2c2a53a8e1f..1f0b7a2fb7b 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -112,6 +112,9 @@ swapon $swapdevice # device=$1 #fi +## +## Two convenience shell functions +## make_dir() { mode=$1 @@ -121,7 +124,6 @@ make_dir() { chmod $mode $root/$name } - touch_file() { name=$1 echo touching $name... @@ -165,8 +167,6 @@ make_dir 00755 /nix/var/nix/profiles make_dir 00755 /nix/var/nix/temproots make_dir 00755 /nix/var/log make_dir 00755 /nix/var/log/nix -#make_dir 00755 /nixpkgs -#make_dir 00755 /nixpkgs/trunk make_dir 00755 /proc make_dir 00750 /root make_dir 00755 /sbin @@ -232,12 +232,10 @@ mount --bind /cdrom $root/cdrom echo switch to /nix from CD ## starting here it's OK to have full blown glibc -#ln -s /cdrom/nixpkgs /nixpkgs mount --bind /cdrom/nix /nix - -echo probing for hardware... +#echo probing for hardware... #kudzu @@ -260,8 +258,6 @@ echo verifying Nix DB... $NIX/nix-store --verify echo copying nixpkgs... -#cp -fLa /cdrom/pkgs $root/nixpkgs/trunk -#tar --directory=/cdrom -cf - pkgs | tar --directory=$root/nixpkgs/trunk -xvf - tar --directory=$root -zxvf /cdrom/nixpkgs.tgz make_dir 0755 /tmp/scripts @@ -275,19 +271,10 @@ unset NIX_LOG_DIR unset NIX_STATE_DIR unset NIX_CONF_DIR -storeExpr=$(echo '(import /tmp/scripts/pkgs.nix).kernel' | $NIX/nix-instantiate -v -v -) -#storeExpr=$(echo '(import /tmp/scripts/pkgs.nix).everything' | $NIX/nix-instantiate -v -v -) -#storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX/nix-instantiate -v -v -) -#$NIX/nix-store -r $storeExpr -echo $storeExpr > $root/tmp/storeExpr cp /cdrom/mystorepaths $root/tmp -#storeExpr2=$($NIX/nix-store -qR $($NIX/nix-store -r $storeExpr)) -#echo storeExpr $storeExpr -#echo $($NIX/nix-store -qR --include-outputs $storeExpr) echo copying store -#cp -fva /nix/store/* $root/nix/store tar --directory=$root -zxvf /cdrom/nixstore.tgz echo registering valid paths... @@ -312,16 +299,15 @@ unset NIX_LOG_DIR unset NIX_STATE_DIR unset NIX_CONF_DIR -### Fix this. Probably nix-instantiate, then nix-store -r. -### Also make sure everything gets installed into an actual profile! +## Fix this. Probably nix-instantiate, then nix-store -r. +## Also make sure everything gets installed into an actual profile! + $NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix nix $NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix coreutils $NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix gnugrep $NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix linux $NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix grub -$NIX/nix-store --clear-substitutes - echo setting init symlink... rm -f $root/init #ln -s $sysvinitPath/sbin/init $root/init @@ -365,9 +351,9 @@ echo "source @nix@/etc/profile.d/nix.sh" > $root/root/.profile touch_file /etc/login.defs touch_file /etc/services -### -### Do kernel stuff here. -### +## +## Do kernel stuff here. +## strippedName=$(basename $root/@kernel@); if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then strippedName=$(echo "$strippedName" | cut -c34- | cut -c 7-) @@ -387,16 +373,16 @@ ln -s @kernel@/lib/modules/$version/kernel $root/lib/modules/$version/kernel cp $root/@kernel@/lib/modules/$version/modules.* $root/lib/modules/$version chmod 644 $root/lib/modules/$version/modules.* -### -### init -### +## +## init +## ln -s $device $root/dev/root ln -s @sysvinitPath@/sbin/init /sbin/init -### -### Do funky stuff with grub here. -### +## +## Do funky stuff with grub here. +## echo installing bootloader @@ -411,7 +397,9 @@ title NixOS kernel @kernel@/vmlinuz root=$device GRUBEND -# clear substitutes here? +echo clearing substitutes + +$NIX/nix-store --clear-substitutes echo copying install log -- GitLab From 33940db2dc2f3d99ed9c0344c648f1bc6023f5fa Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Fri, 4 Aug 2006 23:39:59 +0000 Subject: [PATCH 0156/5331] re-enable the default debugging login shell svn path=/nixu/trunk/; revision=6048 --- boot/boot.sh | 3 --- boot/builder.sh | 3 --- boot/default.nix | 16 ++++++++-------- fill-disk.sh | 4 +++- make-disk.sh | 17 ++++++++++++----- pkgs.nix | 24 ++++++++++++------------ 6 files changed, 35 insertions(+), 32 deletions(-) diff --git a/boot/boot.sh b/boot/boot.sh index c964e410c41..a0cf0d74c90 100644 --- a/boot/boot.sh +++ b/boot/boot.sh @@ -21,9 +21,6 @@ mount -n -t devpts none /dev/pts echo "remounting / writable..." mount -n -o remount,rw /dev/root / -echo "starting udev..." -@udev@/sbin/udevstart - echo "setting up hostname..." hostname nixos diff --git a/boot/builder.sh b/boot/builder.sh index bf747933083..3c33a3669a8 100755 --- a/boot/builder.sh +++ b/boot/builder.sh @@ -9,11 +9,9 @@ for i in $boot $halt $login $env; do dst=$out/bin/$(basename $i | cut -c34-) sed \ -e "s^@bash\@^$bash^g" \ - -e "s^@bashStatic\@^$bashStatic^g" \ -e "s^@coreutils\@^$coreutils^g" \ -e "s^@findutilsWrapper\@^$findutilsWrapper^g" \ -e "s^@utillinux\@^$utillinux^g" \ - -e "s^@utillinuxStatic\@^$utillinuxStatic^g" \ -e "s^@sysvinit\@^$sysvinit^g" \ -e "s^@e2fsprogs\@^$e2fsprogs^g" \ -e "s^@nettools\@^$nettools^g" \ @@ -39,7 +37,6 @@ for i in $boot $halt $login $env; do -e "s^@mingettyWrapper\@^$mingettyWrapper^g" \ -e "s^@module_init_tools\@^$module_init_tools^g" \ -e "s^@grub\@^$grubWrapper^g" \ - -e "s^@udev\@^$udev^g" \ -e "s^@dhcpWrapper\@^$dhcpWrapper^g" \ -e "s^@man\@^$man^g" \ -e "s^@nano\@^$nano^g" \ diff --git a/boot/default.nix b/boot/default.nix index e6e31ca161b..f215104bfe5 100644 --- a/boot/default.nix +++ b/boot/default.nix @@ -1,8 +1,8 @@ -{ stdenv, bash, bashStatic, coreutils, findutilsWrapper, utillinux, utillinuxStatic, sysvinit, e2fsprogs +{ stdenv, bash, coreutils, findutilsWrapper, utillinux, sysvinit, e2fsprogs , nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh -, binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep -, gnutar, gzip, mingettyWrapper, grubWrapper, parted, module_init_tools -, udev, dhcpWrapper, man, nano}: +, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep , gnutar, gzip +, mingettyWrapper, grubWrapper, parted, module_init_tools, dhcpWrapper +, man, nano}: derivation { name = "boot"; @@ -12,9 +12,9 @@ derivation { halt = ./halt.sh; login = ./login.sh; env = ./env.sh; - inherit stdenv bash bashStatic coreutils findutilsWrapper utillinux sysvinit + inherit stdenv bash coreutils findutilsWrapper utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim less screen - openssh binutils strace shadowutils iputils gnumake curl gnused - gnutar gnugrep gzip mingettyWrapper grubWrapper parted module_init_tools - udev dhcpWrapper man nano; + openssh strace shadowutils iputils gnumake curl gnused + gnutar gnugrep gzip mingettyWrapper grubWrapper parted + module_init_tools dhcpWrapper man nano; } diff --git a/fill-disk.sh b/fill-disk.sh index 1f0b7a2fb7b..515c52ca574 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -10,7 +10,7 @@ export PATH=/bin:/sbin:@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils kernel=@kernel@ xawtv=@xawtv@ -storePaths=/mystorepaths +narStorePaths=/cdrom/narstorepaths sysvinitPath=@sysvinitPath@ bootPath=@bootPath@ @@ -308,6 +308,8 @@ $NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix gnugrep $NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix linux $NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix grub +cat $narStorePaths | xargs -n 1 -i% $NIX/nix-env -i % + echo setting init symlink... rm -f $root/init #ln -s $sysvinitPath/sbin/init $root/init diff --git a/make-disk.sh b/make-disk.sh index c0fc341896e..c1b1beff355 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -26,6 +26,7 @@ nixpkgs=/nixpkgs/trunk/pkgs fill_disk=$archivesDir/scripts/fill-disk.sh ramdisk_login=$archivesDir/scripts/ramdisk-login.sh storePaths=$archivesDir/mystorepaths +narStorePaths=$archivesDir/narstorepaths validatePaths=$archivesDir/validatepaths bootiso=/tmp/nixos.iso initrd=/tmp/initram.img @@ -36,7 +37,9 @@ nix=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nixUnstable' | $NIX/nix-inst nixDeps=$($NIX/nix-store -qR $nix) -storeExpr=$($NIX/nix-store -qR $($NIX/nix-store -r $(echo '(import ./pkgs.nix).everything' | $NIX/nix-instantiate -))) +#storeExpr=$($NIX/nix-store -qR $($NIX/nix-store -r $(echo '(import ./pkgs.nix).everything' | $NIX/nix-instantiate -))) +#storeExpr1=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instantiate -)) +storeExpr=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instantiate -)) #storeExpr=$($NIX/nix-store -r $($NIX/nix-store -qR $(echo '(import ./pkgs.nix).everything' | $NIX/nix-instantiate -))) ### make NAR files for everything we want to install and some more. Make sure @@ -65,9 +68,14 @@ gnugrep=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX/nix-inst grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -)) -combideps=$($NIX/nix-store -qR $nix $utillinux $gnugrep $grub $gzip) +findutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) + +combideps=$($NIX/nix-store -qR $nix $utillinux $gnugrep $grub $gzip $findutils) -#for i in $storeExpr +for i in $storeExpr +do + echo $i >> $narStorePaths +done #for i in $nixDeps for i in $combideps do @@ -101,7 +109,7 @@ BootPath=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).boot' | bashGlibc=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX/nix-instantiate -)) bash=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).bashStatic' | $NIX/nix-instantiate -)) coreutilsdiet=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX/nix-instantiate -)) -findutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) +#findutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) utillinux=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX/nix-instantiate -)) e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX/nix-instantiate -)) #e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX/nix-instantiate -)) @@ -109,7 +117,6 @@ e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX/ modutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -)) grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -)) mingettyWrapper=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mingettyWrapper' | $NIX/nix-instantiate -)) -udev=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).udev' | $NIX/nix-instantiate -)) dhcp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX/nix-instantiate -)) nano=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX/nix-instantiate -)) gnugrep=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX/nix-instantiate -)) diff --git a/pkgs.nix b/pkgs.nix index e773ea87390..2fb35f82494 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -5,23 +5,23 @@ rec { nixUnstable subversion gcc wget which vim less screen openssh binutils nixStatic strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted module_init_tools - module_init_toolsStatic udev dhcpWrapper man nano eject sysklogd mktemp + module_init_toolsStatic dhcpWrapper man nano eject sysklogd mktemp cdrtools cpio; boot = (import ./boot) { - inherit stdenv bash bashStatic coreutils findutilsWrapper utillinux - utillinuxStatic sysvinit e2fsprogs nettools subversion gcc wget which - vim less screen openssh binutils strace shadowutils iputils gnumake curl - gnused gnutar gnugrep gzip mingettyWrapper grubWrapper parted - module_init_tools udev dhcpWrapper man nano; + inherit stdenv bash coreutils findutilsWrapper utillinux sysvinit + e2fsprogs nettools subversion gcc wget which vim less screen openssh + strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip + mingettyWrapper grubWrapper parted module_init_tools dhcpWrapper man + nano; nix = nixUnstable; }; - init = (import ./init) {inherit stdenv bash bashStatic coreutilsDiet - utillinux shadowutils mingettyWrapper grubWrapper parted module_init_tools - dhcpWrapper man nano eject e2fsprogsDiet; - nix = nixUnstable; - }; + #init = (import ./init) {inherit stdenv bash bashStatic coreutilsDiet + # utillinux shadowutils mingettyWrapper grubWrapper parted module_init_tools + # dhcpWrapper man nano eject e2fsprogsDiet; + # nix = nixUnstable; + #}; - everything = [boot sysvinit sysklogd kernel ]; + everything = [boot sysvinit sysklogd kernel]; } -- GitLab From 7e6a7d64185a54a29e1d8f58861f1240eeef0922 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 6 Aug 2006 23:59:31 +0000 Subject: [PATCH 0157/5331] rewrite to use busybox TODO: rewrite some of the tools to use the busybox tools instead of the "normal" utilities during installation, so we can shave off another 15 MB from the installer svn path=/nixu/trunk/; revision=6063 --- fill-disk.sh | 8 +++++--- init.sh | 2 +- make-disk.sh | 35 ++++++++++------------------------- pkgs.nix | 2 +- ramdisk-login.sh | 2 +- 5 files changed, 18 insertions(+), 31 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 515c52ca574..0c1ecf8081f 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=/bin:/sbin:@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@utilLinux@/bin:@utilLinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@eject@/bin:@kudzu@/sbin:@utillinux@/bin:@gzip@/bin +export PATH=/bin:/sbin:@bash@/bin:@findutils@/bin:@busybox@/bin:@busybox@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@eject@/bin:@kudzu@/sbin: ## ## In the beginning we want to have a minimalistic environment, built with @@ -204,6 +204,8 @@ mknod -m 0444 $root/dev/urandom c 1 9 rm -f $root/etc/mtab ln -s /proc/mounts $root/etc/mtab +# prevent df from barfing +ln -s /proc/mounts /etc/mtab ## Probe for CD device which contains our CD here and mount /nix and ## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this. @@ -258,7 +260,7 @@ echo verifying Nix DB... $NIX/nix-store --verify echo copying nixpkgs... -tar --directory=$root -zxvf /cdrom/nixpkgs.tgz +tar --directory=$root -zxf /cdrom/nixpkgs.tgz make_dir 0755 /tmp/scripts cp -fa /cdrom/scripts $root/tmp @@ -275,7 +277,7 @@ cp /cdrom/mystorepaths $root/tmp echo copying store -tar --directory=$root -zxvf /cdrom/nixstore.tgz +tar --directory=$root -zxf /cdrom/nixstore.tgz echo registering valid paths... diff --git a/init.sh b/init.sh index b7ab17f20af..88ce09ccb2b 100644 --- a/init.sh +++ b/init.sh @@ -1,3 +1,3 @@ #! @bash@/bin/sh -e -exec ./fill-disk.sh | @coreutils@/bin/tee /tmp/install-log +exec ./fill-disk.sh | @busybox@/bin/tee /tmp/install-log diff --git a/make-disk.sh b/make-disk.sh index c1b1beff355..4f0f74ab27d 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -34,6 +34,7 @@ initdir=${archivesDir}/initdir initscript=$archivesDir/scripts/init.sh nix=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nixUnstable' | $NIX/nix-instantiate -)) +busybox=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).busybox' | $NIX/nix-instantiate -)) nixDeps=$($NIX/nix-store -qR $nix) @@ -58,10 +59,6 @@ kernel=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instan #nixDeps=$($NIX/nix-store -qR $(echo '(import ./pkgs.nix).nix' | $NIX/nix-instantiate -)) -#nixDeps=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX/nix-instantiate -))) -#echo $($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX/nix-instantiate -))) >> $storePaths -#$NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX/nix-instantiate -)) >> $storePaths - utillinux=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX/nix-instantiate -)) gnugrep=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX/nix-instantiate -)) @@ -70,7 +67,8 @@ grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-ins findutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) -combideps=$($NIX/nix-store -qR $nix $utillinux $gnugrep $grub $gzip $findutils) +#combideps=$($NIX/nix-store -qR $nix $utillinux $gnugrep $grub $gzip $findutils) +combideps=$($NIX/nix-store -qR $nix $busybox $grub $findutils) for i in $storeExpr do @@ -125,22 +123,6 @@ eject=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).eject' | $NIX/nix-instanti sysklogd=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysklogd' | $NIX/nix-instantiate -)) #kudzu=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kudzu' | $NIX/nix-instantiate -)) -#(while read storepath; do - #cp -fa --parents ${storepath} ${archivesDir} -#done) < $storePaths - -#echo utillinux $utilLinux - -#for i in $utilLinux; do -# echo i $i -# deps=( $($NIX/nix-store -q --references $i) ) -# echo length ${#deps[@]} -# if test "${#deps[@]}" = 0 -# then -# echo zarro -# fi -#done - echo creating directories for bootimage $coreutils/bin/mkdir ${initdir} @@ -173,6 +155,7 @@ $coreutils/bin/mkdir ${archivesDir}/scripts $coreutils/bin/cp -fa * ${archivesDir}/scripts $gnused/bin/sed -e "s^@bash\@^$bash^g" \ -e "s^@coreutils\@^$coreutilsdiet^g" \ + -e "s^@busybox\@^$busybox^g" \ < $initscript > $initscript.tmp $coreutils/bin/mv $initscript.tmp $initscript $gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ @@ -181,6 +164,7 @@ $gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@bash\@^$bash^g" \ -e "s^@bashGlibc\@^$bashGlibc^g" \ -e "s^@findutils\@^$findutils^g" \ + -e "s^@busybox\@^$busybox^g" \ -e "s^@coreutilsdiet\@^$coreutilsdiet^g" \ -e "s^@coreutils\@^$coreutils^g" \ -e "s^@utilLinux\@^$utilLinux^g" \ @@ -251,14 +235,15 @@ $coreutils/bin/chmod u+x ${initdir}/ramdisk-login.sh #cp -fau --parents ${coreUtilsDiet} ${initdir} #cp -fau --parents ${modUtils} ${initdir} $coreutils/bin/cp -fau --parents ${bash}/bin ${initdir} -$coreutils/bin/cp -fau --parents ${utilLinux}/bin ${initdir} -$coreutils/bin/chmod -R u+w ${initdir} -$coreutils/bin/cp -fau --parents ${utilLinux}/sbin ${initdir} +#$coreutils/bin/cp -fau --parents ${utilLinux}/bin ${initdir} +#$coreutils/bin/chmod -R u+w ${initdir} +#$coreutils/bin/cp -fau --parents ${utilLinux}/sbin ${initdir} $coreutils/bin/cp -fau --parents ${e2fsProgs} ${initdir} -$coreutils/bin/cp -fau --parents ${coreutilsdiet}/bin ${initdir} +#$coreutils/bin/cp -fau --parents ${coreutilsdiet}/bin ${initdir} $coreutils/bin/cp -fau --parents ${modutils}/bin ${initdir} $coreutils/bin/chmod -R u+w ${initdir} $coreutils/bin/cp -fau --parents ${modutils}/sbin ${initdir} +$coreutils/bin/cp -fau --parents ${busybox} ${initdir} $coreutils/bin/touch ${archivesDir}/NIXOS diff --git a/pkgs.nix b/pkgs.nix index 2fb35f82494..2365e939c13 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -6,7 +6,7 @@ rec { nixStatic strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic dhcpWrapper man nano eject sysklogd mktemp - cdrtools cpio; + cdrtools cpio busybox; boot = (import ./boot) { inherit stdenv bash coreutils findutilsWrapper utillinux sysvinit diff --git a/ramdisk-login.sh b/ramdisk-login.sh index 5ef5117cfe9..e684fc3ce26 100644 --- a/ramdisk-login.sh +++ b/ramdisk-login.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin +export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@busybox@/bin tty=$1 -- GitLab From ddc27b231383b8703bcd43782e5a22e56f70ddb1 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 7 Aug 2006 19:48:18 +0000 Subject: [PATCH 0158/5331] use "kernelscripts" package to install the kernel and extra modules. This is actually bad, because in theory a different kernel could be chosen to be installed and then we could not load any modules...but even communism works...in theory! svn path=/nixu/trunk/; revision=6068 --- fill-disk.sh | 18 +++++++----------- make-disk.sh | 7 ++++++- pkgs.nix | 16 ++++++++-------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 0c1ecf8081f..fac7eb56197 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -304,11 +304,12 @@ unset NIX_CONF_DIR ## Fix this. Probably nix-instantiate, then nix-store -r. ## Also make sure everything gets installed into an actual profile! -$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix nix -$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix coreutils -$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix gnugrep -$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix linux -$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix grub +$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix -A nixUnstable +$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix -A coreutils +$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix -A gnugrep +#$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix -A kernel +$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix -A kernelscripts +$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix -A grub cat $narStorePaths | xargs -n 1 -i% $NIX/nix-env -i % @@ -370,12 +371,7 @@ fi version=$strippedName-$kernelhash -make_dir 0755 /lib/modules/$version - -ln -s @kernel@/lib/modules/$version/build $root/lib/modules/$version/build -ln -s @kernel@/lib/modules/$version/kernel $root/lib/modules/$version/kernel -cp $root/@kernel@/lib/modules/$version/modules.* $root/lib/modules/$version -chmod 644 $root/lib/modules/$version/modules.* +ln -s @kernelscripts@/lib/modules/$version $root/lib/modules/$version ## ## init diff --git a/make-disk.sh b/make-disk.sh index 4f0f74ab27d..d340c8d0a31 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -43,9 +43,11 @@ nixDeps=$($NIX/nix-store -qR $nix) storeExpr=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instantiate -)) #storeExpr=$($NIX/nix-store -r $($NIX/nix-store -qR $(echo '(import ./pkgs.nix).everything' | $NIX/nix-instantiate -))) +kernelscripts=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernelscripts' | $NIX/nix-instantiate -)) + ### make NAR files for everything we want to install and some more. Make sure ### the right URL is in there, so specify /cdrom and not cdrom -$NIX/nix-push --copy $archivesDir $manifest --target /cdrom $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) +$NIX/nix-push --copy $archivesDir $manifest --target /cdrom $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts # Location of sysvinit? sysvinitPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/nix-instantiate -)) @@ -56,6 +58,7 @@ bootPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instan syslinux=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).syslinux' | $NIX/nix-instantiate -)) kernel=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) +kernelscripts=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernelscripts' | $NIX/nix-instantiate -)) #nixDeps=$($NIX/nix-store -qR $(echo '(import ./pkgs.nix).nix' | $NIX/nix-instantiate -)) @@ -173,6 +176,7 @@ $gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@modutils\@^$modutils^g" \ -e "s^@grub\@^$grub^g" \ -e "s^@kernel\@^$kernel^g" \ + -e "s^@kernelscripts\@^$kernelscripts^g" \ -e "s^@gnugrep\@^$gnugrep^g" \ -e "s^@which\@^$which^g" \ -e "s^@kudzu\@^$kudzu^g" \ @@ -195,6 +199,7 @@ $gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@modutils\@^$modutils^g" \ -e "s^@grub\@^$grub^g" \ -e "s^@kernel\@^$kernel^g" \ + -e "s^@kernelscripts\@^$kernelscripts^g" \ -e "s^@gnugrep\@^$gnugrep^g" \ -e "s^@which\@^$which^g" \ -e "s^@gnutar\@^$gnutar^g" \ diff --git a/pkgs.nix b/pkgs.nix index 2365e939c13..5f70904f92b 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,12 +1,12 @@ rec { inherit (import /nixpkgs/trunk/pkgs/top-level/all-packages.nix {}) - stdenv kernel bash bashStatic coreutils coreutilsDiet findutilsWrapper - utillinux utillinuxStatic sysvinit e2fsprogsDiet e2fsprogs nettools - nixUnstable subversion gcc wget which vim less screen openssh binutils - nixStatic strace shadowutils iputils gnumake curl gnused gnutar gnugrep - gzip mingettyWrapper grubWrapper syslinux parted module_init_tools - module_init_toolsStatic dhcpWrapper man nano eject sysklogd mktemp - cdrtools cpio busybox; + stdenv kernelscripts kernel bash bashStatic coreutils coreutilsDiet + findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogsDiet + e2fsprogs nettools nixUnstable subversion gcc wget which vim less screen + openssh binutils nixStatic strace shadowutils iputils gnumake curl gnused + gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted + module_init_tools module_init_toolsStatic dhcpWrapper man nano eject + sysklogd mktemp cdrtools cpio busybox; boot = (import ./boot) { inherit stdenv bash coreutils findutilsWrapper utillinux sysvinit @@ -23,5 +23,5 @@ rec { # nix = nixUnstable; #}; - everything = [boot sysvinit sysklogd kernel]; + everything = [boot sysvinit sysklogd kernelscripts kernel]; } -- GitLab From 9626049ec5a2e114a7cbfe90fdf5d2a10221867c Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 8 Aug 2006 20:24:33 +0000 Subject: [PATCH 0159/5331] first attempt at using network installs svn path=/nixu/trunk/; revision=6076 --- fill-disk.sh | 14 ++++++++++---- make-disk.sh | 40 +++++++++++++++++++++++++++++++++++----- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index fac7eb56197..7c077b85d80 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=/bin:/sbin:@bash@/bin:@findutils@/bin:@busybox@/bin:@busybox@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@eject@/bin:@kudzu@/sbin: +export PATH=/bin:/sbin:@bash@/bin:@findutils@/bin:@busybox@/bin:@busybox@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@eject@/bin:@dhcp@/sbin:@modutils@/sbin ## ## In the beginning we want to have a minimalistic environment, built with @@ -153,7 +153,6 @@ make_dir 00755 /etc/ssh make_dir 00755 /etc/sysconfig make_dir 00755 /home make_dir 00755 /lib -make_dir 00755 /lib/modules make_dir 00755 /mnt make_dir 00755 /mnt/host make_dir 00755 /nix @@ -227,10 +226,10 @@ echo "Looking for CDROM in: $i" fi done - echo mounting /cdrom in the target mount --bind /cdrom $root/cdrom +mount --bind /cdrom/lib /lib echo switch to /nix from CD ## starting here it's OK to have full blown glibc @@ -247,7 +246,14 @@ export NIX_STATE_DIR=$root/nix/var/nix export NIX_CONF_DIR=$root/nix/etc NIX=@nix@/bin -#echo bringing up networking... +echo bringing up networking... + +modprobe 3c59x +dhclient eth0 + +while true; do + sleep 60; +done #nic=`kudzu -p | grep eth | sort | uniq | cut -d ' ' -f 2` diff --git a/make-disk.sh b/make-disk.sh index d340c8d0a31..87aad70a968 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -21,6 +21,7 @@ gzip=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gzip' | $NIX/nix-instantiat cpio=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).cpio' | $NIX/nix-instantiate -)) archivesDir=$($mktemp/bin/mktemp -d) +archivesDir2=$($mktemp/bin/mktemp -d) manifest=${archivesDir}/MANIFEST nixpkgs=/nixpkgs/trunk/pkgs fill_disk=$archivesDir/scripts/fill-disk.sh @@ -47,7 +48,8 @@ kernelscripts=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernelscripts' | $ ### make NAR files for everything we want to install and some more. Make sure ### the right URL is in there, so specify /cdrom and not cdrom -$NIX/nix-push --copy $archivesDir $manifest --target /cdrom $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts +#$NIX/nix-push --copy $archivesDir $manifest --target file:///cdrom $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts +$NIX/nix-push --copy $archivesDir2 $manifest --target http://losser.labs.cs.uu.nl/~armijn/.nix/ $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts # Location of sysvinit? sysvinitPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/nix-instantiate -)) @@ -70,8 +72,12 @@ grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-ins findutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) +modutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -)) + +dhcp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX/nix-instantiate -)) + #combideps=$($NIX/nix-store -qR $nix $utillinux $gnugrep $grub $gzip $findutils) -combideps=$($NIX/nix-store -qR $nix $busybox $grub $findutils) +combideps=$($NIX/nix-store -qR $nix $busybox $grub $findutils $modutils $dhcp) for i in $storeExpr do @@ -135,6 +141,7 @@ $coreutils/bin/mkdir ${initdir}/dev $coreutils/bin/mkdir ${initdir}/etc $coreutils/bin/mkdir ${initdir}/etc/sysconfig $coreutils/bin/mkdir ${initdir}/installimage +$coreutils/bin/mkdir ${initdir}/lib $coreutils/bin/mkdir ${initdir}/modules $coreutils/bin/mkdir ${initdir}/proc $coreutils/bin/mkdir ${initdir}/sbin @@ -144,6 +151,7 @@ $coreutils/bin/mkdir -p ${initdir}/usr/bin $coreutils/bin/mkdir -p ${initdir}/usr/sbin $coreutils/bin/mkdir ${initdir}/var $coreutils/bin/mkdir ${initdir}/var/run +$coreutils/bin/mkdir -p ${initdir}/var/state/dhcp echo copying nixpkgs @@ -179,7 +187,7 @@ $gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@kernelscripts\@^$kernelscripts^g" \ -e "s^@gnugrep\@^$gnugrep^g" \ -e "s^@which\@^$which^g" \ - -e "s^@kudzu\@^$kudzu^g" \ + -e "s^@dhcp\@^$dhcp^g" \ -e "s^@sysklogd\@^$sysklogd^g" \ -e "s^@gnutar\@^$gnutar^g" \ -e "s^@gzip\@^$gzip^g" \ @@ -220,12 +228,34 @@ echo copying kernel # of the kernel here. $coreutils/bin/cp -L $kernel/vmlinuz ${archivesDir}/isolinux -echo linking kernel modules +strippedName=$(basename $kernel); +if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then + strippedName=$(echo "$strippedName" | cut -c34- | cut -c 7-) +fi + +kernelhash=$(basename $root/$kernel); +if echo "$kernelhash" | grep -q '^[a-z0-9]\{32\}-'; then + kernelhash=$(echo "$kernelhash" | cut -c -32) +fi -$coreutils/bin/ln -s $kernel/lib $archivesDir/lib +version=$strippedName-$kernelhash + +echo version: $version + +#echo linking kernel modules +#$coreutils/bin/ln -s $kernel/lib $archivesDir/lib + +echo copying network drivers +#$coreutils/bin/cp -fau --parents --no-preserve=mode $kernel/lib/modules/*/modules.* $archivesDir +#$coreutils/bin/cp -fau --parents --no-preserve=mode $kernel/lib/modules/*/kernel/drivers/net/* $archivesDir + +$gnutar/bin/tar -cf - $kernel/lib/modules/*/modules.* | $gnutar/bin/tar --directory=$archivesDir --strip-components 3 -xf - +$gnutar/bin/tar -cf - $kernel/lib/modules/*/kernel/drivers/net/* | $gnutar/bin/tar --directory=$archivesDir --strip-components 3 -xf - echo creating ramdisk +umask 0022 + $coreutils/bin/rm -f ${initrd} #cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init $coreutils/bin/cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/ -- GitLab From 297d159c8d00eb266d9c8ba5fec7dcaac391e2a3 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 8 Aug 2006 21:31:34 +0000 Subject: [PATCH 0160/5331] make sure /etc/resolv.conf is available in our chroot svn path=/nixu/trunk/; revision=6077 --- fill-disk.sh | 13 +++++++++---- make-disk.sh | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 7c077b85d80..4a8088341a2 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -248,12 +248,13 @@ NIX=@nix@/bin echo bringing up networking... -modprobe 3c59x +#labmachine has 3c59x +#modprobe 3c59x +#vmware has pcnet32 +modprobe pcnet32 dhclient eth0 -while true; do - sleep 60; -done +cp /etc/resolv.conf $root/etc/resolv.conf #nic=`kudzu -p | grep eth | sort | uniq | cut -d ' ' -f 2` @@ -407,6 +408,10 @@ echo clearing substitutes $NIX/nix-store --clear-substitutes +echo clearing network information + +rm $root/etc/resolv.conf + echo copying install log cp /tmp/install-log $root/root diff --git a/make-disk.sh b/make-disk.sh index 87aad70a968..f10ac09c00d 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -49,7 +49,7 @@ kernelscripts=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernelscripts' | $ ### make NAR files for everything we want to install and some more. Make sure ### the right URL is in there, so specify /cdrom and not cdrom #$NIX/nix-push --copy $archivesDir $manifest --target file:///cdrom $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts -$NIX/nix-push --copy $archivesDir2 $manifest --target http://losser.labs.cs.uu.nl/~armijn/.nix/ $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts +$NIX/nix-push --copy $archivesDir2 $manifest --target http://losser.labs.cs.uu.nl/~armijn/.nix $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts # Location of sysvinit? sysvinitPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/nix-instantiate -)) -- GitLab From 65203abef4d5b46c16a085ea30348145b4cd99c6 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 8 Aug 2006 22:35:40 +0000 Subject: [PATCH 0161/5331] make sure /lib/modules exists on the target drive. Whoopsie. svn path=/nixu/trunk/; revision=6078 --- fill-disk.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/fill-disk.sh b/fill-disk.sh index 4a8088341a2..fd3d3cbf405 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -153,6 +153,7 @@ make_dir 00755 /etc/ssh make_dir 00755 /etc/sysconfig make_dir 00755 /home make_dir 00755 /lib +make_dir 00755 /lib/modules make_dir 00755 /mnt make_dir 00755 /mnt/host make_dir 00755 /nix -- GitLab From 65742f6eb9ea15e6fd3107c4920a96dbeb34ddb1 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 27 Aug 2006 14:14:59 +0000 Subject: [PATCH 0162/5331] refactor install process: * user is dropped into a shell, where the user can run tools like fdisk to partition a disk * user needs to add a file called "disklayout" where it specifies SWAP, INSTALLDEVICE and TARGETDRIVE * depending on the values of these the installscript might need to be fixed to get the GRUB configuration right It's still somewhat inflexible, but it gives the user a bit more control than the old scheme svn path=/nixu/trunk/; revision=6271 --- fill-disk.sh | 106 +++++++++------------------------------------------ init.sh | 78 ++++++++++++++++++++++++++++++++++++- install.sh | 3 ++ login.sh | 15 ++++++++ make-disk.sh | 29 +++++++++++++- 5 files changed, 141 insertions(+), 90 deletions(-) create mode 100644 install.sh create mode 100644 login.sh diff --git a/fill-disk.sh b/fill-disk.sh index fd3d3cbf405..2895f957e8b 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,11 +1,6 @@ #! @bash@/bin/sh -e -export PATH=/bin:/sbin:@bash@/bin:@findutils@/bin:@busybox@/bin:@busybox@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@eject@/bin:@dhcp@/sbin:@modutils@/sbin - -## -## In the beginning we want to have a minimalistic environment, built with -## dietlibc. -## +export PATH=/bin:/sbin:@bash@/bin:@findutils@/bin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@eject@/bin:@dhcp@/sbin:@modutils@/sbin:@busybox@/bin:@busybox@/sbin kernel=@kernel@ xawtv=@xawtv@ @@ -17,87 +12,23 @@ bootPath=@bootPath@ modutils=@modutils@ mingetty=@mingetty@ -echo mounting special filesystems - -mount -t proc proc /proc -mount -t sysfs sys /sys - -# make a complete /dev filesystem -# ripped permissions and everything from anaconda (loader2/devices.h) - -echo making device nodes - -# consoles - -#mknod -m 0600 /dev/console c 5 1 -mknod -m 0600 /dev/ttyS0 c 4 64 -mknod -m 0600 /dev/ttyS1 c 4 65 -mknod -m 0600 /dev/ttyS2 c 4 66 -mknod -m 0600 /dev/ttyS3 c 4 67 - -# base UNIX devices -mknod -m 0600 /dev/mem c 1 1 -mknod -m 0666 /dev/null c 1 3 -mknod -m 0666 /dev/zero c 1 5 - -# tty -mknod -m 0600 /dev/tty c 5 0 -mknod -m 0600 /dev/tty0 c 4 0 -mknod -m 0600 /dev/tty1 c 4 1 -mknod -m 0600 /dev/tty2 c 4 2 -mknod -m 0600 /dev/tty3 c 4 3 -mknod -m 0600 /dev/tty4 c 4 4 -mknod -m 0600 /dev/tty5 c 4 5 -mknod -m 0600 /dev/tty6 c 4 6 -mknod -m 0600 /dev/tty7 c 4 7 -mknod -m 0600 /dev/tty8 c 4 8 -mknod -m 0600 /dev/tty9 c 4 9 - -mkdir -m 0755 /dev/pts -mknod -m 0666 /dev/ptmx c 5 2 - -# random - -mknod -m 0644 /dev/random c 1 8 -mknod -m 0644 /dev/urandom c 1 9 - -mknod -m 0660 /dev/hda b 3 0 -mknod -m 0660 /dev/hda1 b 3 1 -mknod -m 0660 /dev/hda2 b 3 2 -mknod -m 0660 /dev/hda3 b 3 3 - -mknod -m 0660 /dev/hdb b 3 64 -mknod -m 0660 /dev/hdb1 b 3 65 -mknod -m 0660 /dev/hdb2 b 3 66 -mknod -m 0660 /dev/hdb3 b 3 67 - -mknod -m 0660 /dev/hdc b 22 0 -mknod -m 0660 /dev/hdc1 b 22 1 -mknod -m 0660 /dev/hdc2 b 22 2 -mknod -m 0660 /dev/hdc3 b 22 3 - -mknod -m 0660 /dev/hdd b 22 64 -mknod -m 0660 /dev/hdd1 b 22 65 -mknod -m 0660 /dev/hdd2 b 22 66 -mknod -m 0660 /dev/hdd3 b 22 67 - -#mknod -m 0660 /dev/sda b 8 0 -#mknod -m 0660 /dev/sda1 b 8 1 -#mknod -m 0660 /dev/sda2 b 8 2 -#mknod -m 0660 /dev/sda3 b 8 3 - -mknod -m 0600 /dev/initctl p - -echo starting emergency shell on tty2 - -exec ./ramdisk-login.sh /dev/tty2 & - echo formatting target device -targetdrive=/dev/hda -device=${targetdrive}1 +if test -e disklayout; then + source disklayout +else + echo no disk layout configuration present...exiting + exit 1 +fi + +# $targetdrive is also used by GRUB! +#targetdrive=/dev/hda +targetdrive=${TARGETDRIVE} +#device=${targetdrive}1 +device=${INSTALLDEVICE} mkfs.ext2 ${device} -swapdevice=${targetdrive}2 +#swapdevice=${targetdrive}2 +swapdevice=${SWAP} mkswap $swapdevice echo enabling swap @@ -428,7 +359,8 @@ umount /cdrom echo install done echo it\'s safe to turn off your machine +echo exiting install process -while true; do - sleep 60; -done +#while true; do + #sleep 60; +#done diff --git a/init.sh b/init.sh index 88ce09ccb2b..b17a6637f67 100644 --- a/init.sh +++ b/init.sh @@ -1,3 +1,79 @@ #! @bash@/bin/sh -e -exec ./fill-disk.sh | @busybox@/bin/tee /tmp/install-log +export PATH=/bin:/sbin:@bash@/bin:@findutils@/bin:@busybox@/bin:@busybox@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@eject@/bin:@dhcp@/sbin:@modutils@/sbin + +echo mounting special filesystems + +mount -t proc proc /proc +mount -t sysfs sys /sys + +# make a complete /dev filesystem +# ripped permissions and everything from anaconda (loader2/devices.h) + +echo making device nodes + +# consoles + +#mknod -m 0600 /dev/console c 5 1 +mknod -m 0600 /dev/ttyS0 c 4 64 +mknod -m 0600 /dev/ttyS1 c 4 65 +mknod -m 0600 /dev/ttyS2 c 4 66 +mknod -m 0600 /dev/ttyS3 c 4 67 + +# base UNIX devices +mknod -m 0600 /dev/mem c 1 1 +mknod -m 0666 /dev/null c 1 3 +mknod -m 0666 /dev/zero c 1 5 + +# tty +mknod -m 0600 /dev/tty c 5 0 +mknod -m 0600 /dev/tty0 c 4 0 +mknod -m 0600 /dev/tty1 c 4 1 +mknod -m 0600 /dev/tty2 c 4 2 +mknod -m 0600 /dev/tty3 c 4 3 +mknod -m 0600 /dev/tty4 c 4 4 +mknod -m 0600 /dev/tty5 c 4 5 +mknod -m 0600 /dev/tty6 c 4 6 +mknod -m 0600 /dev/tty7 c 4 7 +mknod -m 0600 /dev/tty8 c 4 8 +mknod -m 0600 /dev/tty9 c 4 9 + +mkdir -m 0755 /dev/pts +mknod -m 0666 /dev/ptmx c 5 2 + +# random + +mknod -m 0644 /dev/random c 1 8 +mknod -m 0644 /dev/urandom c 1 9 + +mknod -m 0660 /dev/hda b 3 0 +mknod -m 0660 /dev/hda1 b 3 1 +mknod -m 0660 /dev/hda2 b 3 2 +mknod -m 0660 /dev/hda3 b 3 3 + +mknod -m 0660 /dev/hdb b 3 64 +mknod -m 0660 /dev/hdb1 b 3 65 +mknod -m 0660 /dev/hdb2 b 3 66 +mknod -m 0660 /dev/hdb3 b 3 67 + +mknod -m 0660 /dev/hdc b 22 0 +mknod -m 0660 /dev/hdc1 b 22 1 +mknod -m 0660 /dev/hdc2 b 22 2 +mknod -m 0660 /dev/hdc3 b 22 3 + +mknod -m 0660 /dev/hdd b 22 64 +mknod -m 0660 /dev/hdd1 b 22 65 +mknod -m 0660 /dev/hdd2 b 22 66 +mknod -m 0660 /dev/hdd3 b 22 67 + +#mknod -m 0660 /dev/sda b 8 0 +#mknod -m 0660 /dev/sda1 b 8 1 +#mknod -m 0660 /dev/sda2 b 8 2 +#mknod -m 0660 /dev/sda3 b 8 3 + +mknod -m 0600 /dev/initctl p + +echo starting emergency shell on tty2 + +exec ./ramdisk-login.sh /dev/tty2 & +exec ./login.sh diff --git a/install.sh b/install.sh new file mode 100644 index 00000000000..88ce09ccb2b --- /dev/null +++ b/install.sh @@ -0,0 +1,3 @@ +#! @bash@/bin/sh -e + +exec ./fill-disk.sh | @busybox@/bin/tee /tmp/install-log diff --git a/login.sh b/login.sh new file mode 100644 index 00000000000..c94a8e48d20 --- /dev/null +++ b/login.sh @@ -0,0 +1,15 @@ +#! @bash@/bin/sh -e + +export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@busybox@/bin:@busybox@/sbin + +#tty=$1 + +#exec < $tty > $tty 2>&1 + +echo +echo "=== Welcome to Nix! ===" + +export HOME=/ +cd $HOME + +exec @bash@/bin/sh diff --git a/make-disk.sh b/make-disk.sh index f10ac09c00d..0710bf4aee2 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -26,6 +26,7 @@ manifest=${archivesDir}/MANIFEST nixpkgs=/nixpkgs/trunk/pkgs fill_disk=$archivesDir/scripts/fill-disk.sh ramdisk_login=$archivesDir/scripts/ramdisk-login.sh +login_script=$archivesDir/scripts/login.sh storePaths=$archivesDir/mystorepaths narStorePaths=$archivesDir/narstorepaths validatePaths=$archivesDir/validatepaths @@ -48,8 +49,8 @@ kernelscripts=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernelscripts' | $ ### make NAR files for everything we want to install and some more. Make sure ### the right URL is in there, so specify /cdrom and not cdrom -#$NIX/nix-push --copy $archivesDir $manifest --target file:///cdrom $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts -$NIX/nix-push --copy $archivesDir2 $manifest --target http://losser.labs.cs.uu.nl/~armijn/.nix $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts +$NIX/nix-push --copy $archivesDir $manifest --target file:///cdrom $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts +#$NIX/nix-push --copy $archivesDir2 $manifest --target http://losser.labs.cs.uu.nl/~armijn/.nix $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts # Location of sysvinit? sysvinitPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/nix-instantiate -)) @@ -212,9 +213,31 @@ $gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@which\@^$which^g" \ -e "s^@gnutar\@^$gnutar^g" \ -e "s^@mingetty\@^$mingettyWrapper^g" \ + -e "s^@busybox\@^$busybox^g" \ < $ramdisk_login > $ramdisk_login.tmp $coreutils/bin/mv $ramdisk_login.tmp $ramdisk_login +$gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ + -e "s^@bootPath\@^$bootPath^g" \ + -e "s^@NIX\@^$nix^g" \ + -e "s^@bash\@^$bash^g" \ + -e "s^@findutils\@^$findutils^g" \ + -e "s^@coreutilsdiet\@^$coreutilsdiet^g" \ + -e "s^@coreutils\@^$coreutils^g" \ + -e "s^@utillinux\@^$utilLinux^g" \ + -e "s^@e2fsprogs\@^$e2fsprogs^g" \ + -e "s^@modutils\@^$modutils^g" \ + -e "s^@grub\@^$grub^g" \ + -e "s^@kernel\@^$kernel^g" \ + -e "s^@kernelscripts\@^$kernelscripts^g" \ + -e "s^@gnugrep\@^$gnugrep^g" \ + -e "s^@which\@^$which^g" \ + -e "s^@gnutar\@^$gnutar^g" \ + -e "s^@mingetty\@^$mingettyWrapper^g" \ + -e "s^@busybox\@^$busybox^g" \ + < $login_script > $login_script.tmp +$coreutils/bin/mv $login_script.tmp $login_script + echo copying bootimage $coreutils/bin/mkdir ${archivesDir}/isolinux @@ -260,12 +283,14 @@ $coreutils/bin/rm -f ${initrd} #cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init $coreutils/bin/cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/ $coreutils/bin/cp ${archivesDir}/scripts/ramdisk-login.sh ${initdir}/ +$coreutils/bin/cp ${archivesDir}/scripts/login.sh ${initdir}/ $coreutils/bin/cp ${archivesDir}/scripts/init.sh ${initdir}/init #ln -s ${bash}/bin/bash ${initdir}/bin/sh $coreutils/bin/cp ${bash}/bin/bash ${initdir}/bin/sh $coreutils/bin/chmod u+x ${initdir}/init $coreutils/bin/chmod u+x ${initdir}/fill-disk.sh $coreutils/bin/chmod u+x ${initdir}/ramdisk-login.sh +$coreutils/bin/chmod u+x ${initdir}/login.sh #cp -fau --parents ${utilLinux} ${initdir} #cp -fau --parents ${coreUtilsDiet} ${initdir} #cp -fau --parents ${modUtils} ${initdir} -- GitLab From f7c69397b7adef2d6451b3d6389e05d8ba6c00fe Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 27 Aug 2006 15:34:24 +0000 Subject: [PATCH 0163/5331] update howto to reflect new changes svn path=/nixu/trunk/; revision=6274 --- doc/howto | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/doc/howto b/doc/howto index 646f2c2ebf6..cb5f572535f 100644 --- a/doc/howto +++ b/doc/howto @@ -14,22 +14,34 @@ Make sure mktemp is installed. Run ./make-disk.sh. Wait. Use your favourite tool to burn the ISO image to a CD. - Preparing the host machine + Installing Currently NixOS can only be installed with machines that have a specific hardware set up: An ATA harddisk on the first ATA controller (hda) with: -- data partition (hda1) -- swap partition (hda2) +- data partition +- swap partition All data on these two partitions will be wiped and the bootloader in the Master Boot Record (MBR) will be overwritten with GRUB. - Booting +The NixOS installer will drop you into a shell, from which you can run +fdisk. Then it expects to find a file called "disklayout" with three +variables: -Insert the CD, make sure it can boot from CD and reboot. Let it run for a -while. +SWAP :: partition to use as swap +INSTALLDEVICE :: partition that will be /root +TARGETDRIVE :: drive on which grub will be installed + +This file will be read by the install script automatically when you launch +the script: + +# sh fill-disk.sh + +The configuration data that grub writes to disk might not be correct. The +grub configuration writes a file to disk which assumes /dev/hda1 is the root +partition. Configuring -- GitLab From 1323e55ad3a094212fb4b007ec82dd4b7ae697b6 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 27 Aug 2006 22:18:39 +0000 Subject: [PATCH 0164/5331] remove the root(hd0,0) line, because it wasn't needed. At least, not in our situation. I don't know how it will it work with something like dual booting and chain loading, so that is unsupported right now :P svn path=/nixu/trunk/; revision=6282 --- fill-disk.sh | 2 +- make-disk.sh | 6 ++++-- pkgs.nix | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 2895f957e8b..a09b3bc5444 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -332,7 +332,6 @@ cat > $root/boot/grub/menu.lst << GRUBEND default=0 timeout=5 title NixOS - root (hd0,0) kernel @kernel@/vmlinuz root=$device GRUBEND @@ -348,6 +347,7 @@ echo copying install log cp /tmp/install-log $root/root +# bizar. busybox umount doesn't like things with --bind it seems. echo umounting filesystem umount $root/cdrom diff --git a/make-disk.sh b/make-disk.sh index 0710bf4aee2..3b392115c6a 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -47,9 +47,11 @@ storeExpr=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-insta kernelscripts=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernelscripts' | $NIX/nix-instantiate -)) +mkinitrd=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mkinitrd' | $NIX/nix-instantiate -)) + ### make NAR files for everything we want to install and some more. Make sure ### the right URL is in there, so specify /cdrom and not cdrom -$NIX/nix-push --copy $archivesDir $manifest --target file:///cdrom $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts +$NIX/nix-push --copy $archivesDir $manifest --target file:///cdrom $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts $mkinitrd #$NIX/nix-push --copy $archivesDir2 $manifest --target http://losser.labs.cs.uu.nl/~armijn/.nix $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts # Location of sysvinit? @@ -80,7 +82,7 @@ dhcp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX/nix-ins #combideps=$($NIX/nix-store -qR $nix $utillinux $gnugrep $grub $gzip $findutils) combideps=$($NIX/nix-store -qR $nix $busybox $grub $findutils $modutils $dhcp) -for i in $storeExpr +for i in $storeExpr $mkinitrd do echo $i >> $narStorePaths done diff --git a/pkgs.nix b/pkgs.nix index 5f70904f92b..41efb92c99e 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -6,7 +6,7 @@ rec { openssh binutils nixStatic strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic dhcpWrapper man nano eject - sysklogd mktemp cdrtools cpio busybox; + sysklogd mktemp cdrtools cpio busybox mkinitrd; boot = (import ./boot) { inherit stdenv bash coreutils findutilsWrapper utillinux sysvinit @@ -23,5 +23,5 @@ rec { # nix = nixUnstable; #}; - everything = [boot sysvinit sysklogd kernelscripts kernel]; + everything = [boot sysvinit sysklogd kernelscripts kernel mkinitrd]; } -- GitLab From 4a8b316cf6f14b5e1f7e6bee04070b685c69881b Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 27 Aug 2006 22:31:35 +0000 Subject: [PATCH 0165/5331] * show installation instructions at install time * update manual to reflect new method better svn path=/nixu/trunk/; revision=6285 --- doc/howto | 14 +++++++------- login.sh | 12 ++++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/doc/howto b/doc/howto index cb5f572535f..58e3344d6ea 100644 --- a/doc/howto +++ b/doc/howto @@ -1,4 +1,4 @@ -NixOS installation HOWTO -- October 3, 2005 +NixOS installation HOWTO -- August 28, 2006 This is small HOWTO of how to build and install the current version of NixOS. @@ -39,16 +39,16 @@ the script: # sh fill-disk.sh -The configuration data that grub writes to disk might not be correct. The -grub configuration writes a file to disk which assumes /dev/hda1 is the root -partition. +The configuration data that grub writes to disk might not be correct (should +be). When something goes wrong you probably won't have to reinstall. The +manual for grub is quite helpful in these cases. Configuring To get NixOS in a working state, do the following: -- load the networkdriver. This is machine dependent. On the labmachines this -is the e1000 driver: +- load the networkdriver. This is machine dependent. On the labmachines (Dell +Optiplex GX-260) this is the e1000 driver: # modprobe e1000 @@ -93,7 +93,7 @@ NixOS machine (needed for mingetty). Alternatively, do: - relaunch init - Making hotplugging work + Making hotplugging work -- BROKEN RIGHT NOW Many devices (USB, Firewire) are controlled by so called "hot plugging". The kernel executes a program -- usually /sbin/hotplug, but this is configurable diff --git a/login.sh b/login.sh index c94a8e48d20..3a6b9983885 100644 --- a/login.sh +++ b/login.sh @@ -8,6 +8,18 @@ export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@util echo echo "=== Welcome to Nix! ===" +echo "NixOS Installation instructions" +echo "" +echo "* edit the file called 'disklayout' (vi is provided) and provide" +echo " the following name=value pairs:" +echo " * INSTALLDEVICE (root device, for example /dev/hda1)" +echo " * SWAP (swap device, for example /dev/hda2)" +echo " * TARGETDRIVE (target drive to install grub, for example /dev/hda)" +echo "* run: sh fill-disk.sh" +echo "" +echo "" +echo "" +echo "" export HOME=/ cd $HOME -- GitLab From b5bdf9b4534fc999e6ad4e943330271769a8b76c Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 28 Aug 2006 13:41:41 +0000 Subject: [PATCH 0166/5331] -r, not -q svn path=/nixu/trunk/; revision=6295 --- make-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-disk.sh b/make-disk.sh index 3b392115c6a..6866b2a2e87 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -75,7 +75,7 @@ grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-ins findutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) -modutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -)) +modutils=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -)) dhcp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX/nix-instantiate -)) -- GitLab From 964780812de8cdf7fe9d958829976144e17c52d9 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 29 Aug 2006 21:58:33 +0000 Subject: [PATCH 0167/5331] fix NIXOS-38 svn path=/nixu/trunk/; revision=6317 --- fill-disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fill-disk.sh b/fill-disk.sh index a09b3bc5444..3cce7aab512 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -123,7 +123,7 @@ make_dir 00755 /var/tmp echo making device nodes on target drive -mknod $root/dev/null c 1 3 +mknod -m 0666 $root/dev/null c 1 3 mknod -m 0600 $root/dev/console c 5 1 mknod -m 0600 $root/dev/tty c 5 0 mknod -m 0600 $root/dev/tty0 c 4 0 -- GitLab From e876f67580b1726e67a5630a4a107669fa56ffb3 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 30 Aug 2006 00:15:02 +0000 Subject: [PATCH 0168/5331] pass nano. Not that it actually works, because it also needs ncurses for terminal information... svn path=/nixu/trunk/; revision=6321 --- fill-disk.sh | 3 +++ login.sh | 2 +- make-disk.sh | 7 +++++-- pkgs.nix | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 3cce7aab512..e9e974b3586 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -132,6 +132,9 @@ mknod -m 0600 $root/dev/tty2 c 4 2 mknod -m 0600 $root/dev/tty3 c 4 3 mknod -m 0444 $root/dev/urandom c 1 9 +## needed for sshd and friends. Should actually be made by udev. +mknod -m 0666 $root/dev/ptmx c 5 2 + rm -f $root/etc/mtab ln -s /proc/mounts $root/etc/mtab diff --git a/login.sh b/login.sh index 3a6b9983885..1c33a2ebc91 100644 --- a/login.sh +++ b/login.sh @@ -1,6 +1,6 @@ #! @bash@/bin/sh -e -export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@busybox@/bin:@busybox@/sbin +export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@busybox@/bin:@busybox@/sbin:@nano@/bin #tty=$1 diff --git a/make-disk.sh b/make-disk.sh index 6866b2a2e87..f263f6d51c6 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -37,6 +37,8 @@ initscript=$archivesDir/scripts/init.sh nix=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nixUnstable' | $NIX/nix-instantiate -)) busybox=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).busybox' | $NIX/nix-instantiate -)) +nano=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX/nix-instantiate -)) +nanoDiet=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nanoDiet' | $NIX/nix-instantiate -)) nixDeps=$($NIX/nix-store -qR $nix) @@ -80,7 +82,7 @@ modutils=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).module_init_toolsStatic dhcp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX/nix-instantiate -)) #combideps=$($NIX/nix-store -qR $nix $utillinux $gnugrep $grub $gzip $findutils) -combideps=$($NIX/nix-store -qR $nix $busybox $grub $findutils $modutils $dhcp) +combideps=$($NIX/nix-store -qR $nix $busybox $grub $findutils $modutils $dhcp $nano) for i in $storeExpr $mkinitrd do @@ -128,7 +130,6 @@ modutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).module_init_toolsStatic grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -)) mingettyWrapper=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mingettyWrapper' | $NIX/nix-instantiate -)) dhcp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX/nix-instantiate -)) -nano=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX/nix-instantiate -)) gnugrep=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX/nix-instantiate -)) which=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).which' | $NIX/nix-instantiate -)) eject=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).eject' | $NIX/nix-instantiate -)) @@ -237,6 +238,7 @@ $gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ -e "s^@gnutar\@^$gnutar^g" \ -e "s^@mingetty\@^$mingettyWrapper^g" \ -e "s^@busybox\@^$busybox^g" \ + -e "s^@nano\@^$nanoDiet^g" \ < $login_script > $login_script.tmp $coreutils/bin/mv $login_script.tmp $login_script @@ -306,6 +308,7 @@ $coreutils/bin/cp -fau --parents ${modutils}/bin ${initdir} $coreutils/bin/chmod -R u+w ${initdir} $coreutils/bin/cp -fau --parents ${modutils}/sbin ${initdir} $coreutils/bin/cp -fau --parents ${busybox} ${initdir} +$coreutils/bin/cp -fau --parents ${nanoDiet} ${initdir} $coreutils/bin/touch ${archivesDir}/NIXOS diff --git a/pkgs.nix b/pkgs.nix index 41efb92c99e..f202283eecc 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -5,8 +5,8 @@ rec { e2fsprogs nettools nixUnstable subversion gcc wget which vim less screen openssh binutils nixStatic strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted - module_init_tools module_init_toolsStatic dhcpWrapper man nano eject - sysklogd mktemp cdrtools cpio busybox mkinitrd; + module_init_tools module_init_toolsStatic dhcpWrapper man nano nanoDiet + eject sysklogd mktemp cdrtools cpio busybox mkinitrd; boot = (import ./boot) { inherit stdenv bash coreutils findutilsWrapper utillinux sysvinit -- GitLab From 62f61928e7a7cb20b2498cb2936248f810e76521 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 30 Aug 2006 00:40:15 +0000 Subject: [PATCH 0169/5331] also copy a statically linked ncurses to the installer, so at least we get all the right terminfo thingies. svn path=/nixu/trunk/; revision=6326 --- make-disk.sh | 2 ++ pkgs.nix | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/make-disk.sh b/make-disk.sh index f263f6d51c6..844ffe58c3c 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -39,6 +39,7 @@ nix=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nixUnstable' | $NIX/nix-inst busybox=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).busybox' | $NIX/nix-instantiate -)) nano=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX/nix-instantiate -)) nanoDiet=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nanoDiet' | $NIX/nix-instantiate -)) +ncurses=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).ncursesDiet' | $NIX/nix-instantiate -)) nixDeps=$($NIX/nix-store -qR $nix) @@ -309,6 +310,7 @@ $coreutils/bin/chmod -R u+w ${initdir} $coreutils/bin/cp -fau --parents ${modutils}/sbin ${initdir} $coreutils/bin/cp -fau --parents ${busybox} ${initdir} $coreutils/bin/cp -fau --parents ${nanoDiet} ${initdir} +$coreutils/bin/cp -fau --parents ${ncurses} ${initdir} $coreutils/bin/touch ${archivesDir}/NIXOS diff --git a/pkgs.nix b/pkgs.nix index f202283eecc..b774ce33fb7 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -6,7 +6,7 @@ rec { openssh binutils nixStatic strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic dhcpWrapper man nano nanoDiet - eject sysklogd mktemp cdrtools cpio busybox mkinitrd; + eject sysklogd mktemp cdrtools cpio busybox mkinitrd ncursesDiet; boot = (import ./boot) { inherit stdenv bash coreutils findutilsWrapper utillinux sysvinit -- GitLab From da7b60735b9b6139577ce899d1fd958c83ab3b6b Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sat, 23 Sep 2006 23:06:28 +0000 Subject: [PATCH 0170/5331] -r, not -q svn path=/nixu/trunk/; revision=6589 --- make-disk.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index 844ffe58c3c..186e42e549b 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -76,7 +76,7 @@ gnugrep=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX/nix-inst grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -)) -findutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) +findutils=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) modutils=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -)) @@ -119,15 +119,15 @@ Kernel=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | SysVinit=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/nix-instantiate -))) BootPath=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instantiate -))) -bashGlibc=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX/nix-instantiate -)) -bash=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).bashStatic' | $NIX/nix-instantiate -)) -coreutilsdiet=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX/nix-instantiate -)) +bashGlibc=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX/nix-instantiate -)) +bash=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).bashStatic' | $NIX/nix-instantiate -)) +coreutilsdiet=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX/nix-instantiate -)) #findutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) -utillinux=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX/nix-instantiate -)) -e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX/nix-instantiate -)) +utillinux=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX/nix-instantiate -)) +e2fsprogs=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX/nix-instantiate -)) #e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX/nix-instantiate -)) #e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX/nix-instantiate -)) -modutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -)) +modutils=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -)) grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -)) mingettyWrapper=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mingettyWrapper' | $NIX/nix-instantiate -)) dhcp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX/nix-instantiate -)) -- GitLab From edcdb69c5772798023185e45fb70bb6e4a220794 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 24 Sep 2006 22:03:33 +0000 Subject: [PATCH 0171/5331] make it easier to relocate the location of nixpkgs. svn path=/nixu/trunk/; revision=6602 --- fill-disk.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index e9e974b3586..fc9fc78deb7 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -12,6 +12,8 @@ bootPath=@bootPath@ modutils=@modutils@ mingetty=@mingetty@ +nixpkgs=/nixpkgs/trunk + echo formatting target device if test -e disklayout; then @@ -246,12 +248,12 @@ unset NIX_CONF_DIR ## Fix this. Probably nix-instantiate, then nix-store -r. ## Also make sure everything gets installed into an actual profile! -$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix -A nixUnstable -$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix -A coreutils -$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix -A gnugrep -#$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix -A kernel -$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix -A kernelscripts -$NIX/nix-env -iKf /nixpkgs/trunk/pkgs/top-level/all-packages.nix -A grub +$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A nixUnstable +$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A coreutils +$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A gnugrep +#$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A kernel +$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A kernelscripts +$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A grub cat $narStorePaths | xargs -n 1 -i% $NIX/nix-env -i % -- GitLab From c8b64ef689442f9989f818d9d592542da95843a4 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Sun, 8 Oct 2006 22:05:06 +0000 Subject: [PATCH 0172/5331] we can safely use the stable version again svn path=/nixu/trunk/; revision=6680 --- fill-disk.sh | 2 +- make-disk.sh | 2 +- pkgs.nix | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index fc9fc78deb7..52078fad147 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -248,7 +248,7 @@ unset NIX_CONF_DIR ## Fix this. Probably nix-instantiate, then nix-store -r. ## Also make sure everything gets installed into an actual profile! -$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A nixUnstable +$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A nix $NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A coreutils $NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A gnugrep #$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A kernel diff --git a/make-disk.sh b/make-disk.sh index 186e42e549b..6e9893a345a 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -35,7 +35,7 @@ initrd=/tmp/initram.img initdir=${archivesDir}/initdir initscript=$archivesDir/scripts/init.sh -nix=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nixUnstable' | $NIX/nix-instantiate -)) +nix=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX/nix-instantiate -)) busybox=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).busybox' | $NIX/nix-instantiate -)) nano=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX/nix-instantiate -)) nanoDiet=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nanoDiet' | $NIX/nix-instantiate -)) diff --git a/pkgs.nix b/pkgs.nix index b774ce33fb7..794ccce4ed8 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -2,7 +2,7 @@ rec { inherit (import /nixpkgs/trunk/pkgs/top-level/all-packages.nix {}) stdenv kernelscripts kernel bash bashStatic coreutils coreutilsDiet findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogsDiet - e2fsprogs nettools nixUnstable subversion gcc wget which vim less screen + e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils nixStatic strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic dhcpWrapper man nano nanoDiet @@ -13,8 +13,7 @@ rec { e2fsprogs nettools subversion gcc wget which vim less screen openssh strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingettyWrapper grubWrapper parted module_init_tools dhcpWrapper man - nano; - nix = nixUnstable; + nano nix; }; #init = (import ./init) {inherit stdenv bash bashStatic coreutilsDiet -- GitLab From 89c31b1c2c99b8accd2e7efc13a68067c07d8845 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 11 Oct 2006 11:11:41 +0000 Subject: [PATCH 0173/5331] * Sketch for purely functional NixOS configuration. svn path=/nixu/trunk/; revision=6694 --- pure/devices.nix | 20 +++++++++++ pure/disks.nix | 84 +++++++++++++++++++++++++++++++++++++++++++++ pure/networking.nix | 58 +++++++++++++++++++++++++++++++ pure/top-level.nix | 26 ++++++++++++++ 4 files changed, 188 insertions(+) create mode 100644 pure/devices.nix create mode 100644 pure/disks.nix create mode 100644 pure/networking.nix create mode 100644 pure/top-level.nix diff --git a/pure/devices.nix b/pure/devices.nix new file mode 100644 index 00000000000..140f8afb7e6 --- /dev/null +++ b/pure/devices.nix @@ -0,0 +1,20 @@ +[ + { id = "net-dev-1"; + comment = "Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express"; + location = { + busId = "pci-0000:02:00.0"; + macAddr = "00:14:22:bc:68:51"; + prefer = "macAddr"; # i.e., don't care if busId changes + }; + extraModules = []; # tg3 + } + + { id = "keyboard-1"; + comment = "Dell Computer Corp. SK-8125 Keyboard"; + location = { + busId = "usb-003-003"; + }; + extraModules = []; + } + +] diff --git a/pure/disks.nix b/pure/disks.nix new file mode 100644 index 00000000000..c1ad104fbd9 --- /dev/null +++ b/pure/disks.nix @@ -0,0 +1,84 @@ +{ + + /* Old school. */ + + volume1 = { + mountPoint = "/"; + filesystem = "ext3"; + location = { + device = "/dev/hda1"; + }; + creationParams = { + disk = "/dev/hda"; + partition = 1; + startCylinder = 1; + endCylinder = 1000; + }; + }; + + volume2 = { + filesystem = "swap"; + location = { + device = "/dev/hda2"; + }; + creationParams = { + disk = "/dev/hda"; + startCylinder = 1001; + endCylinder = 1100; + }; + }; + + + /* With partition labels; don't care which device holds the file + system. */ + + volume1 = { + mountPoint = "/"; + filesystem = "auto"; + location = { + label = "ROOT_DISK"; + }; + # Only relevant when creating. + creationParams = { + disk = "/dev/hda"; + partition = 1; + startCylinder = 1; + endCylinder = 1000; + filesystem = "ext3"; + }; + }; + + + /* LVM. */ + + volume1 = { + mountPoint = "/data"; + filesystem = "auto"; + location = { + lvmVolumeGroup = "system"; + lvmVolumeName = "big-volume"; # -> /dev/mapper/system-big-volume + }; + }; + + lvmConfig = { + devices = [ + ... + ]; + groups = [ + { name = "system"; + volumes = [ + { name = "big-volume"; + size = 1048576; # -> 1 GiB + } + { name = "blah"; + size = 1048576; # -> 1 GiB + } + ]; + # When realising this configuration, only delete explicitly + # listed volumes for safety. + canDelete = ["foobar"]; + }; + ]; + }; + +} diff --git a/pure/networking.nix b/pure/networking.nix new file mode 100644 index 00000000000..0f3b550a8f5 --- /dev/null +++ b/pure/networking.nix @@ -0,0 +1,58 @@ +{ + + identification = { + fromDHCP = false; + hostname = "foobar"; + }; + + + interfaces = [ + + # Manual configuration. + { name = "eth0"; + hardware = { + type = "ethernet"; + device = "net-dev-1"; + }; + link = { + ip4 = { + address = "192.168.1.2"; + nameservers = [ # to be used when this interface is up + "1.2.3.4"; + "1.2.3.5"; + ]; + routes = [ # idem, add when up + { destination = "0.0.0.0"; + netmask = "0.0.0.0"; + gateway = "192.168.1.1"; + # iface implied (eth0) + } + { destination = "192.168.1.0"; + netmask = "255.255.255.0"; + # iface implied (eth0) + } + ]; + }; + ip6 = ...; + }; + } + + # Automatic configuration via DHCP + { name = "eth0"; + hardware = { + type = "ethernet"; + device = "net-dev-1"; + }; + link = { + useDHCP = true; + }; + } + + ]; + + + firewall = { + # ... + }; + +} \ No newline at end of file diff --git a/pure/top-level.nix b/pure/top-level.nix new file mode 100644 index 00000000000..46c220f5c8e --- /dev/null +++ b/pure/top-level.nix @@ -0,0 +1,26 @@ +rec { + + devices = import ./devices.nix; + + disks = import ./disks.nix; + + networking = import ./networking.nix; + + systemServices = [ + terminalRunner + syslogServer + dhcpClient + sshServer + subversionServer + ]; + + systemInit = { + inherit devices disks networking; + inherit systemServices; + }; + + kernel = import ... { + externalModules = [nvidia vmware ...]; + } + +} -- GitLab From 319489bf8b73f744ed78d3d9218e8aa84d112fe3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 31 Oct 2006 12:15:08 +0000 Subject: [PATCH 0174/5331] * Don't use hardcoded /nixpkgs. svn path=/nixu/trunk/; revision=6914 --- pkgs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs.nix b/pkgs.nix index 794ccce4ed8..2fc4be64d55 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,5 +1,5 @@ rec { - inherit (import /nixpkgs/trunk/pkgs/top-level/all-packages.nix {}) + inherit (import ./pkgs/top-level/all-packages.nix {}) stdenv kernelscripts kernel bash bashStatic coreutils coreutilsDiet findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogsDiet e2fsprogs nettools nix subversion gcc wget which vim less screen -- GitLab From c55460a027ae723f14a4cada7fed9bc5c2595cc5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 31 Oct 2006 17:39:55 +0000 Subject: [PATCH 0175/5331] * Use tar 1.15.1 for now (1.16 is buggy). * Honour $TMPDIR (my /tmp is full). svn path=/nixu/trunk/; revision=6918 --- make-disk.sh | 14 +++++++++----- pkgs.nix | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index 6e9893a345a..037f8aaeb80 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -1,12 +1,16 @@ #! /bin/sh -e +set -x + +if test -z "$TMPDIR"; then export TMPDIR=/tmp; fi + # deps is an array declare -a deps NIXSTORE=`which nix-store` NIXINSTANTIATE=`which nix-instantiate` -coreutils=$($NIXSTORE -r $(echo '(import ./pkgs.nix).coreutils' | $NIXINSTANTIATE -)) +coreutils=$(nix-store -r $(nix-instantiate ./pkgs.nix -A coreutils)) # determine where we can find the Nix binaries NIX=$($coreutils/bin/dirname $(which nix-store)) @@ -15,7 +19,7 @@ NIX=$($coreutils/bin/dirname $(which nix-store)) mktemp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mktemp' | $NIX/nix-instantiate -)) gnused=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX/nix-instantiate -)) -gnutar=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnutar' | $NIX/nix-instantiate -)) +gnutar=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnutar151' | $NIX/nix-instantiate -)) cdrtools=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).cdrtools' | $NIX/nix-instantiate -)) gzip=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gzip' | $NIX/nix-instantiate -)) cpio=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).cpio' | $NIX/nix-instantiate -)) @@ -23,15 +27,15 @@ cpio=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).cpio' | $NIX/nix-instantiat archivesDir=$($mktemp/bin/mktemp -d) archivesDir2=$($mktemp/bin/mktemp -d) manifest=${archivesDir}/MANIFEST -nixpkgs=/nixpkgs/trunk/pkgs +nixpkgs=./pkgs fill_disk=$archivesDir/scripts/fill-disk.sh ramdisk_login=$archivesDir/scripts/ramdisk-login.sh login_script=$archivesDir/scripts/login.sh storePaths=$archivesDir/mystorepaths narStorePaths=$archivesDir/narstorepaths validatePaths=$archivesDir/validatepaths -bootiso=/tmp/nixos.iso -initrd=/tmp/initram.img +bootiso=$TMPDIR/nixos.iso +initrd=$TMPDIR/initram.img initdir=${archivesDir}/initdir initscript=$archivesDir/scripts/init.sh diff --git a/pkgs.nix b/pkgs.nix index 2fc4be64d55..00cc0ff6dab 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -4,7 +4,7 @@ rec { findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogsDiet e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils nixStatic strace shadowutils iputils gnumake curl gnused - gnutar gnugrep gzip mingettyWrapper grubWrapper syslinux parted + gnutar gnutar151 gnugrep gzip mingettyWrapper grubWrapper syslinux parted module_init_tools module_init_toolsStatic dhcpWrapper man nano nanoDiet eject sysklogd mktemp cdrtools cpio busybox mkinitrd ncursesDiet; -- GitLab From 2b995a1150ce46827fc5fe5cbb88ffa1d864ec84 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 31 Oct 2006 20:28:35 +0000 Subject: [PATCH 0176/5331] * Turns out that nested backticks (like $(... $(...))) are evil, since bash doesn't check the exit status of the inner commands. Replace the $(nix-store -r $(nix-instantiate)) calls with nix-build. * Some of the diet packages are gone now, use the dietlibc stdenv. svn path=/nixu/trunk/; revision=6920 --- make-disk.sh | 115 ++++++++++++++++++++++++--------------------------- pkgs.nix | 24 +++++++++-- 2 files changed, 74 insertions(+), 65 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index 037f8aaeb80..46eb96a1fe0 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -7,22 +7,21 @@ if test -z "$TMPDIR"; then export TMPDIR=/tmp; fi # deps is an array declare -a deps -NIXSTORE=`which nix-store` -NIXINSTANTIATE=`which nix-instantiate` +build="nix-build --no-out-link" -coreutils=$(nix-store -r $(nix-instantiate ./pkgs.nix -A coreutils)) +coreutils=$($build ./pkgs.nix -A coreutils) # determine where we can find the Nix binaries NIX=$($coreutils/bin/dirname $(which nix-store)) # make sure we use many of our own tools, because it is more pure -mktemp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mktemp' | $NIX/nix-instantiate -)) +mktemp=$($build ./pkgs.nix -A mktemp) -gnused=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX/nix-instantiate -)) -gnutar=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnutar151' | $NIX/nix-instantiate -)) -cdrtools=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).cdrtools' | $NIX/nix-instantiate -)) -gzip=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gzip' | $NIX/nix-instantiate -)) -cpio=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).cpio' | $NIX/nix-instantiate -)) +gnused=$($build ./pkgs.nix -A gnused) +gnutar=$($build ./pkgs.nix -A gnutar151) +cdrtools=$($build ./pkgs.nix -A cdrtools) +gzip=$($build ./pkgs.nix -A gzip) +cpio=$($build ./pkgs.nix -A cpio) archivesDir=$($mktemp/bin/mktemp -d) archivesDir2=$($mktemp/bin/mktemp -d) @@ -39,52 +38,47 @@ initrd=$TMPDIR/initram.img initdir=${archivesDir}/initdir initscript=$archivesDir/scripts/init.sh -nix=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nix' | $NIX/nix-instantiate -)) -busybox=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).busybox' | $NIX/nix-instantiate -)) -nano=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nano' | $NIX/nix-instantiate -)) -nanoDiet=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).nanoDiet' | $NIX/nix-instantiate -)) -ncurses=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).ncursesDiet' | $NIX/nix-instantiate -)) +nix=$($build ./pkgs.nix -A nix) +busybox=$($build ./pkgs.nix -A busybox) +nano=$($build ./pkgs.nix -A nano) +nanoDiet=$($build ./pkgs.nix -A nanoDiet) +ncurses=$($build ./pkgs.nix -A ncursesDiet) nixDeps=$($NIX/nix-store -qR $nix) -#storeExpr=$($NIX/nix-store -qR $($NIX/nix-store -r $(echo '(import ./pkgs.nix).everything' | $NIX/nix-instantiate -))) -#storeExpr1=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instantiate -)) -storeExpr=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instantiate -)) -#storeExpr=$($NIX/nix-store -r $($NIX/nix-store -qR $(echo '(import ./pkgs.nix).everything' | $NIX/nix-instantiate -))) +storeExpr=$($build ./pkgs.nix -A boot) -kernelscripts=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernelscripts' | $NIX/nix-instantiate -)) +kernelscripts=$($build ./pkgs.nix -A kernelscripts) -mkinitrd=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mkinitrd' | $NIX/nix-instantiate -)) +mkinitrd=$($build ./pkgs.nix -A mkinitrd) ### make NAR files for everything we want to install and some more. Make sure ### the right URL is in there, so specify /cdrom and not cdrom -$NIX/nix-push --copy $archivesDir $manifest --target file:///cdrom $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts $mkinitrd -#$NIX/nix-push --copy $archivesDir2 $manifest --target http://losser.labs.cs.uu.nl/~armijn/.nix $storeExpr $($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) $kernelscripts +$NIX/nix-push --copy $archivesDir $manifest --target file:///cdrom $storeExpr $($build ./pkgs.nix -A kernel) $kernelscripts $mkinitrd +#$NIX/nix-push --copy $archivesDir2 $manifest --target http://losser.labs.cs.uu.nl/~armijn/.nix $storeExpr $($build ./pkgs.nix -A kernel) $kernelscripts # Location of sysvinit? -sysvinitPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/nix-instantiate -)) +sysvinitPath=$($build ./pkgs.nix -A sysvinit) # Location of Nix boot scripts? -bootPath=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instantiate -)) +bootPath=$($build ./pkgs.nix -A boot) -syslinux=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).syslinux' | $NIX/nix-instantiate -)) +syslinux=$($build ./pkgs.nix -A syslinux) -kernel=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -)) -kernelscripts=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kernelscripts' | $NIX/nix-instantiate -)) +kernel=$($build ./pkgs.nix -A kernel) +kernelscripts=$($build ./pkgs.nix -A kernelscripts) -#nixDeps=$($NIX/nix-store -qR $(echo '(import ./pkgs.nix).nix' | $NIX/nix-instantiate -)) +utillinux=$($build ./pkgs.nix -A utillinux) -utillinux=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX/nix-instantiate -)) +gnugrep=$($build ./pkgs.nix -A gnugrep) -gnugrep=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX/nix-instantiate -)) +grub=$($build ./pkgs.nix -A grubWrapper) -grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -)) +findutils=$($build ./pkgs.nix -A findutilsWrapper) -findutils=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) +modutils=$($build ./pkgs.nix -A module_init_toolsStatic) -modutils=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -)) - -dhcp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX/nix-instantiate -)) +dhcp=$($build ./pkgs.nix -A dhcpWrapper) #combideps=$($NIX/nix-store -qR $nix $utillinux $gnugrep $grub $gzip $findutils) combideps=$($NIX/nix-store -qR $nix $busybox $grub $findutils $modutils $dhcp $nano) @@ -111,35 +105,32 @@ done tar zcf ${archivesDir}/nixstore.tgz $combideps -utilLinux=$(nix-store -r $(echo '(import ./pkgs.nix).utillinuxStatic' | $NIX/nix-instantiate -)) -coreUtilsDiet=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX/nix-instantiate -))) +utilLinux=$($build ./pkgs.nix -A utillinuxStatic) +coreUtilsDiet=$($NIX/nix-store -qR $($build ./pkgs.nix -A coreutilsDiet)) ## temporarily normal e2fsprogs until I can get it to build with dietlibc -e2fsProgs=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX/nix-instantiate -))) -#e2fsProgs=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX/nix-instantiate -))) -modUtils=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -))) -Grub=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -))) -Kernel=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX/nix-instantiate -))) -SysVinit=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX/nix-instantiate -))) -BootPath=$($NIX/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX/nix-instantiate -))) - -bashGlibc=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX/nix-instantiate -)) -bash=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).bashStatic' | $NIX/nix-instantiate -)) -coreutilsdiet=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).coreutilsDiet' | $NIX/nix-instantiate -)) -#findutils=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).findutilsWrapper' | $NIX/nix-instantiate -)) -utillinux=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX/nix-instantiate -)) -e2fsprogs=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).e2fsprogsDiet' | $NIX/nix-instantiate -)) -#e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX/nix-instantiate -)) -#e2fsprogs=$($NIX/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX/nix-instantiate -)) -modutils=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).module_init_toolsStatic' | $NIX/nix-instantiate -)) -grub=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX/nix-instantiate -)) -mingettyWrapper=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).mingettyWrapper' | $NIX/nix-instantiate -)) -dhcp=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).dhcpWrapper' | $NIX/nix-instantiate -)) -gnugrep=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX/nix-instantiate -)) -which=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).which' | $NIX/nix-instantiate -)) -eject=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).eject' | $NIX/nix-instantiate -)) -sysklogd=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).sysklogd' | $NIX/nix-instantiate -)) -#kudzu=$($NIX/nix-store -r $(echo '(import ./pkgs.nix).kudzu' | $NIX/nix-instantiate -)) +e2fsProgs=$($NIX/nix-store -qR $($build ./pkgs.nix -A e2fsprogsDiet)) +#e2fsProgs=$($NIX/nix-store -qR $($build ./pkgs.nix -A e2fsprogs)) +modUtils=$($NIX/nix-store -qR $($build ./pkgs.nix -A module_init_toolsStatic)) +Grub=$($NIX/nix-store -qR $($build ./pkgs.nix -A grubWrapper)) +Kernel=$($NIX/nix-store -qR $($build ./pkgs.nix -A kernel)) +SysVinit=$($NIX/nix-store -qR $($build ./pkgs.nix -A sysvinit)) +BootPath=$($NIX/nix-store -qR $($build ./pkgs.nix -A boot)) + +bashGlibc=$($build ./pkgs.nix -A bash) +bash=$($build ./pkgs.nix -A diet.bash) +coreutilsdiet=$($build ./pkgs.nix -A diet.coreutils) +utillinux=$($build ./pkgs.nix -A utillinux) +e2fsprogs=$($build ./pkgs.nix -A e2fsprogsDiet) +modutils=$($build ./pkgs.nix -A module_init_toolsStatic) +grub=$($build ./pkgs.nix -A grubWrapper) +mingettyWrapper=$($build ./pkgs.nix -A mingettyWrapper) +dhcp=$($build ./pkgs.nix -A dhcpWrapper) +gnugrep=$($build ./pkgs.nix -A gnugrep) +which=$($build ./pkgs.nix -A which) +eject=$($build ./pkgs.nix -A eject) +sysklogd=$($build ./pkgs.nix -A sysklogd) +#kudzu=$($build ./pkgs.nix -A kudzu) echo creating directories for bootimage diff --git a/pkgs.nix b/pkgs.nix index 00cc0ff6dab..ea530f649d1 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -1,6 +1,21 @@ -rec { - inherit (import ./pkgs/top-level/all-packages.nix {}) - stdenv kernelscripts kernel bash bashStatic coreutils coreutilsDiet +let + + pkgs = import ./pkgs/top-level/all-packages.nix {}; + + # !!! copied from stdenv/linux/make-bootstrap-tools.nix. + pkgsToRemove = + [ "binutils" "gcc" "coreutils" "findutils" "diffutils" "gnused" "gnugrep" + "gawk" "gnutar" "gzip" "bzip2" "gnumake" "bash" "patch" "patchelf" + ]; + + pkgsDiet = import ./pkgs/top-level/all-packages.nix { + bootStdenv = removeAttrs (pkgs.useDietLibC pkgs.stdenv) pkgsToRemove; + }; + +in rec { + + inherit (pkgs) + stdenv kernelscripts kernel bash coreutils coreutilsDiet findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogsDiet e2fsprogs nettools nix subversion gcc wget which vim less screen openssh binutils nixStatic strace shadowutils iputils gnumake curl gnused @@ -8,6 +23,8 @@ rec { module_init_tools module_init_toolsStatic dhcpWrapper man nano nanoDiet eject sysklogd mktemp cdrtools cpio busybox mkinitrd ncursesDiet; + diet = pkgsDiet; + boot = (import ./boot) { inherit stdenv bash coreutils findutilsWrapper utillinux sysvinit e2fsprogs nettools subversion gcc wget which vim less screen openssh @@ -23,4 +40,5 @@ rec { #}; everything = [boot sysvinit sysklogd kernelscripts kernel mkinitrd]; + } -- GitLab From f546cad4b7e721a0b499940cc0f2286015febd19 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 1 Nov 2006 12:07:22 +0000 Subject: [PATCH 0177/5331] * Some fixes. svn path=/nixu/trunk/; revision=6923 --- fill-disk.sh | 23 +++++++++++++---------- make-disk.sh | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 52078fad147..43edcb4dfab 100755 --- a/fill-disk.sh +++ b/fill-disk.sh @@ -1,4 +1,6 @@ -#! @bash@/bin/sh -e +#! @bash@/bin/sh + +set -e export PATH=/bin:/sbin:@bash@/bin:@findutils@/bin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@eject@/bin:@dhcp@/sbin:@modutils@/sbin:@busybox@/bin:@busybox@/sbin @@ -12,7 +14,7 @@ bootPath=@bootPath@ modutils=@modutils@ mingetty=@mingetty@ -nixpkgs=/nixpkgs/trunk +nixpkgs=/nixpkgs echo formatting target device @@ -188,10 +190,10 @@ echo bringing up networking... #labmachine has 3c59x #modprobe 3c59x #vmware has pcnet32 -modprobe pcnet32 -dhclient eth0 +#modprobe pcnet32 +#dhclient eth0 -cp /etc/resolv.conf $root/etc/resolv.conf +#cp /etc/resolv.conf $root/etc/resolv.conf #nic=`kudzu -p | grep eth | sort | uniq | cut -d ' ' -f 2` @@ -204,7 +206,8 @@ echo verifying Nix DB... $NIX/nix-store --verify echo copying nixpkgs... -tar --directory=$root -zxf /cdrom/nixpkgs.tgz +mkdir -p $root/nixpkgs/pkgs +tar --directory=$root/nixpkgs/pkgs -zxf /cdrom/nixpkgs.tgz make_dir 0755 /tmp/scripts cp -fa /cdrom/scripts $root/tmp @@ -344,13 +347,13 @@ echo clearing substitutes $NIX/nix-store --clear-substitutes -echo clearing network information +#echo clearing network information -rm $root/etc/resolv.conf +#rm $root/etc/resolv.conf -echo copying install log +#echo copying install log -cp /tmp/install-log $root/root +#cp /tmp/install-log $root/root # bizar. busybox umount doesn't like things with --bind it seems. echo umounting filesystem diff --git a/make-disk.sh b/make-disk.sh index 46eb96a1fe0..4d0a12e08f9 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -156,7 +156,7 @@ $coreutils/bin/mkdir -p ${initdir}/var/state/dhcp echo copying nixpkgs #svn export ${nixpkgs} ${archivesDir}/pkgs -tar -zcf ${archivesDir}/nixpkgs.tgz ${nixpkgs} +(cd $nixpkgs && tar -zcf ${archivesDir}/nixpkgs.tgz .) #echo copying packages from store -- GitLab From fff70110669973a561019f2c23e59fca5c9d0244 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 2 Nov 2006 17:56:50 +0000 Subject: [PATCH 0178/5331] Purifying the NixOS build stuff. * make-initrd.nix: builds a initial RAM disk. The resulting initrd will contain just a Nix store containing the specified lists of packages, with a symlink `/init' to the actual init program in the Nix store. * make-iso9660-image.nix: builds a bootable ISO image. * rescue-system.nix: builds a bootable ISO image (using the two function above) that boots into a very minimal Linux environment containing (at the moment) the dietlibc-based bash and coreutils, loaded from the initrd. Eventually this should become a two-stage boot (load kernel modules from the initrd, mount the actual root file system (e.g., the installation CD), call the real init). The rescue system (probably a misnomer) should become the minimal environment necessary for the installer (on CD) and the boot process of an installed NixOS (on HD). svn path=/nixu/trunk/; revision=6926 --- test/isolinux.cfg | 6 +++++ test/make-initrd.nix | 20 ++++++++++++++++ test/make-initrd.sh | 20 ++++++++++++++++ test/make-iso9660-image.nix | 28 ++++++++++++++++++++++ test/make-iso9660-image.sh | 10 ++++++++ test/rescue-system.nix | 47 +++++++++++++++++++++++++++++++++++++ 6 files changed, 131 insertions(+) create mode 100644 test/isolinux.cfg create mode 100644 test/make-initrd.nix create mode 100644 test/make-initrd.sh create mode 100644 test/make-iso9660-image.nix create mode 100644 test/make-iso9660-image.sh create mode 100644 test/rescue-system.nix diff --git a/test/isolinux.cfg b/test/isolinux.cfg new file mode 100644 index 00000000000..be947a949f7 --- /dev/null +++ b/test/isolinux.cfg @@ -0,0 +1,6 @@ +default linux +prompt 1 +timeout 60 +label linux + kernel vmlinuz + append initrd=initrd diff --git a/test/make-initrd.nix b/test/make-initrd.nix new file mode 100644 index 00000000000..f850e1cf657 --- /dev/null +++ b/test/make-initrd.nix @@ -0,0 +1,20 @@ +# Create an initial ramdisk containing the specified set of packages. +# An initial ramdisk is used during the initial stages of booting a +# Linux system. It is loaded by the boot loader along with the kernel +# image. It's supposed to contain everything (such as kernel modules) +# necessary to allow us to mount the root file system. Once the root +# file system is mounted, the `real' boot script can be called. +# +# An initrd is really just a gzipped cpio archive. +# +# A symlink `/init' is made to the store path passed in the `init' +# argument. + +{stdenv, cpio, packages, init}: + +stdenv.mkDerivation { + name = "initrd"; + builder = ./make-initrd.sh; + buildInputs = [cpio]; + inherit packages init; +} diff --git a/test/make-initrd.sh b/test/make-initrd.sh new file mode 100644 index 00000000000..f3b522d5384 --- /dev/null +++ b/test/make-initrd.sh @@ -0,0 +1,20 @@ +source $stdenv/setup + +set -o pipefail + +# Get the paths in the closure of `packages'. Unfortunately, the only +# way to get the closure is to call Nix, which is strictly speaking +# forbidden. But we do it anyway. In time, we should add a feature +# to Nix to let Nix pass closures to builders. +packagesClosure=$(/nix/bin/nix-store -qR $packages $init) + +# Paths in cpio archives *must* be relative, otherwise the kernel +# won't unpack 'em. +mkdir root +cd root +cp -prvd --parents $packagesClosure . + +# Put the closure in a gzipped cpio archive. +ensureDir $out +ln -s $init init +find * -print0 | cpio -ov -H newc --null | gzip -9 > $out/initrd diff --git a/test/make-iso9660-image.nix b/test/make-iso9660-image.nix new file mode 100644 index 00000000000..976f7047fd4 --- /dev/null +++ b/test/make-iso9660-image.nix @@ -0,0 +1,28 @@ +{ stdenv, cdrtools + + # The file name of the resulting ISO image. +, isoName ? "cd.iso" + +, # The files and directories to be placed in the ISO file system. + # This is a list of attribute sets {source, target} where `source' + # is the file system object (regular file or directory) to be + # grafted in the file system at path `target'. + contents + + # Whether this should be an El-Torito bootable CD. +, bootable ? false + + # The path (in the ISO file system) of the boot image. +, bootImage ? "" + +}: + +assert bootable -> bootImage != ""; + +stdenv.mkDerivation { + name = "iso9660-image"; + builder = ./make-iso9660-image.sh; + buildInputs = [cdrtools]; + inherit isoName bootable bootImage; + graftList = map ({source, target}: target + "=" + source) contents; +} diff --git a/test/make-iso9660-image.sh b/test/make-iso9660-image.sh new file mode 100644 index 00000000000..7e9017f41a1 --- /dev/null +++ b/test/make-iso9660-image.sh @@ -0,0 +1,10 @@ +source $stdenv/setup + +ensureDir $out + +if test -n "$bootable"; then + bootFlags="-b $bootImage -c boot.cat -no-emul-boot -boot-load-size 4" +fi + +# !!! -f is a quick hack. +mkisofs -r -J -f -o $out/$isoName $bootFlags -graft-points $graftList diff --git a/test/rescue-system.nix b/test/rescue-system.nix new file mode 100644 index 00000000000..ba8e0151037 --- /dev/null +++ b/test/rescue-system.nix @@ -0,0 +1,47 @@ +rec { + + pkgs = import ./pkgs/top-level/all-packages.nix {}; + + stdenvLinuxStuff = import ./pkgs/stdenv/linux { + system = pkgs.stdenv.system; + allPackages = import ./pkgs/top-level/all-packages.nix; + }; + + bash = pkgs.bash; + + + initialRamdisk = import ./make-initrd.nix { + inherit (pkgs) stdenv cpio; + packages = [ + stdenvLinuxStuff.staticTools + ]; + init = stdenvLinuxStuff.bootstrapTools.bash; + }; + + + rescueCD = import ./make-iso9660-image.nix { + inherit (pkgs) stdenv cdrtools; + isoName = "nixos.iso"; + + contents = [ + { source = pkgs.syslinux + "/lib/syslinux/isolinux.bin"; + target = "isolinux/isolinux.bin"; + } + { source = ./isolinux.cfg; + target = "isolinux/isolinux.cfg"; + } + { source = pkgs.kernel + "/vmlinuz"; + target = "isolinux/vmlinuz"; + } + { source = initialRamdisk + "/initrd"; + #/boot/initrd-2.6.13-15.12-default; + target = "isolinux/initrd"; + } + ]; + + bootable = true; + bootImage = "isolinux/isolinux.bin"; + }; + + +} -- GitLab From 333632578118f10eede229e1a43200cc61d911c3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 2 Nov 2006 17:58:33 +0000 Subject: [PATCH 0179/5331] * Remove cruft. BTW, to build the rescue ISO image: $ nix-build ./rescue-system.nix -A rescueCD Point VMware at ./result/nixos.iso and voila. svn path=/nixu/trunk/; revision=6927 --- test/rescue-system.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/test/rescue-system.nix b/test/rescue-system.nix index ba8e0151037..f652e429b77 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -34,7 +34,6 @@ rec { target = "isolinux/vmlinuz"; } { source = initialRamdisk + "/initrd"; - #/boot/initrd-2.6.13-15.12-default; target = "isolinux/initrd"; } ]; -- GitLab From 2d31e1b6d6a6f474ed525344bc1667279a7c36a6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 2 Nov 2006 22:48:01 +0000 Subject: [PATCH 0180/5331] * A minimal boot script for stage 1 of the boot (loading kernel modules). The closure of the boot script is all we need in the initrd. svn path=/nixu/trunk/; revision=6929 --- test/boot-stage-1-init.sh | 17 +++++++++++++++++ test/boot-stage-1.nix | 16 ++++++++++++++++ test/isolinux.cfg | 2 +- test/rescue-system.nix | 25 ++++++++++++++++++++----- 4 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 test/boot-stage-1-init.sh create mode 100644 test/boot-stage-1.nix diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh new file mode 100644 index 00000000000..da5d4e56f76 --- /dev/null +++ b/test/boot-stage-1-init.sh @@ -0,0 +1,17 @@ +#! @shell@ + +# Print a greeting. +cat <>> + +EOF + +# Set the PATH. +export PATH=/empty +for i in @path@; do + PATH=$PATH:$i/bin +done + +# Start an interactive shell. +exec @shell@ diff --git a/test/boot-stage-1.nix b/test/boot-stage-1.nix new file mode 100644 index 00000000000..da053a9e6c9 --- /dev/null +++ b/test/boot-stage-1.nix @@ -0,0 +1,16 @@ +# This Nix expression builds the script that performs the first stage +# of booting the system: it loads the modules necessary to mount the +# root file system, then calls /init in the root file system to start +# the second boot stage. The closure of the result of this expression +# is supposed to be put into an initial RAM disk (initrd). + +{genericSubstituter, shell, staticTools}: + +genericSubstituter { + src = ./boot-stage-1-init.sh; + isExecutable = true; + inherit shell; + path = [ + staticTools + ]; +} diff --git a/test/isolinux.cfg b/test/isolinux.cfg index be947a949f7..ff19e84c098 100644 --- a/test/isolinux.cfg +++ b/test/isolinux.cfg @@ -3,4 +3,4 @@ prompt 1 timeout 60 label linux kernel vmlinuz - append initrd=initrd + append initrd=initrd selinux=0 apm=on acpi=on diff --git a/test/rescue-system.nix b/test/rescue-system.nix index f652e429b77..994723eef1f 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -2,6 +2,10 @@ rec { pkgs = import ./pkgs/top-level/all-packages.nix {}; + pkgsDiet = import ./pkgs/top-level/all-packages.nix { + bootStdenv = pkgs.useDietLibC pkgs.stdenv; + }; + stdenvLinuxStuff = import ./pkgs/stdenv/linux { system = pkgs.stdenv.system; allPackages = import ./pkgs/top-level/all-packages.nix; @@ -9,16 +13,27 @@ rec { bash = pkgs.bash; + + # The init script of boot stage 1 (loading kernel modules for + # mounting the root FS). + bootStage1 = import ./boot-stage-1.nix { + inherit (pkgs) genericSubstituter; + shell = stdenvLinuxStuff.bootstrapTools.bash; + staticTools = stdenvLinuxStuff.staticTools; + }; + + # The closure of the init script of boot stage 1 is what we put in + # the initial RAM disk. initialRamdisk = import ./make-initrd.nix { inherit (pkgs) stdenv cpio; - packages = [ - stdenvLinuxStuff.staticTools - ]; - init = stdenvLinuxStuff.bootstrapTools.bash; + packages = []; + init = bootStage1; }; - + + # Create an ISO image containing the isolinux boot loader, the + # kernel, and initrd produced above. rescueCD = import ./make-iso9660-image.nix { inherit (pkgs) stdenv cdrtools; isoName = "nixos.iso"; -- GitLab From ae4b6973bb738b4c68a77f500beaf96725c8d883 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 2 Nov 2006 22:50:30 +0000 Subject: [PATCH 0181/5331] * Oops. svn path=/nixu/trunk/; revision=6930 --- test/boot-stage-1-init.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index da5d4e56f76..c3dd9e88878 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -1,11 +1,9 @@ #! @shell@ # Print a greeting. -cat <>> - -EOF +echo +echo "<<< NixOS Stage 1 >>>" +echo # Set the PATH. export PATH=/empty -- GitLab From 707dd205382f1b8d060681b9edbea123f84f5164 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 2 Nov 2006 23:58:06 +0000 Subject: [PATCH 0182/5331] * Make device nodes in the stage 1 init (copied from ../init.sh). svn path=/nixu/trunk/; revision=6932 --- test/boot-stage-1-init.sh | 3 ++ test/boot-stage-1.nix | 1 + test/make-devices.sh | 58 +++++++++++++++++++++++++++++++++++++++ test/make-initrd.sh | 2 +- 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 test/make-devices.sh diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index c3dd9e88878..782ff485c41 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -11,5 +11,8 @@ for i in @path@; do PATH=$PATH:$i/bin done +# Create device nodes in /dev. +source @makeDevices@ + # Start an interactive shell. exec @shell@ diff --git a/test/boot-stage-1.nix b/test/boot-stage-1.nix index da053a9e6c9..e5477888862 100644 --- a/test/boot-stage-1.nix +++ b/test/boot-stage-1.nix @@ -13,4 +13,5 @@ genericSubstituter { path = [ staticTools ]; + makeDevices = ./make-devices.sh; } diff --git a/test/make-devices.sh b/test/make-devices.sh new file mode 100644 index 00000000000..dead9814f7a --- /dev/null +++ b/test/make-devices.sh @@ -0,0 +1,58 @@ +#mknod -m 0600 /dev/console c 5 1 +mknod -m 0600 /dev/ttyS0 c 4 64 +mknod -m 0600 /dev/ttyS1 c 4 65 +mknod -m 0600 /dev/ttyS2 c 4 66 +mknod -m 0600 /dev/ttyS3 c 4 67 + +# base UNIX devices +mknod -m 0600 /dev/mem c 1 1 +mknod -m 0666 /dev/null c 1 3 +mknod -m 0666 /dev/zero c 1 5 + +# tty +mknod -m 0600 /dev/tty c 5 0 +mknod -m 0600 /dev/tty0 c 4 0 +mknod -m 0600 /dev/tty1 c 4 1 +mknod -m 0600 /dev/tty2 c 4 2 +mknod -m 0600 /dev/tty3 c 4 3 +mknod -m 0600 /dev/tty4 c 4 4 +mknod -m 0600 /dev/tty5 c 4 5 +mknod -m 0600 /dev/tty6 c 4 6 +mknod -m 0600 /dev/tty7 c 4 7 +mknod -m 0600 /dev/tty8 c 4 8 +mknod -m 0600 /dev/tty9 c 4 9 + +mkdir -m 0755 /dev/pts +mknod -m 0666 /dev/ptmx c 5 2 + +# random + +mknod -m 0644 /dev/random c 1 8 +mknod -m 0644 /dev/urandom c 1 9 + +mknod -m 0660 /dev/hda b 3 0 +mknod -m 0660 /dev/hda1 b 3 1 +mknod -m 0660 /dev/hda2 b 3 2 +mknod -m 0660 /dev/hda3 b 3 3 + +mknod -m 0660 /dev/hdb b 3 64 +mknod -m 0660 /dev/hdb1 b 3 65 +mknod -m 0660 /dev/hdb2 b 3 66 +mknod -m 0660 /dev/hdb3 b 3 67 + +mknod -m 0660 /dev/hdc b 22 0 +mknod -m 0660 /dev/hdc1 b 22 1 +mknod -m 0660 /dev/hdc2 b 22 2 +mknod -m 0660 /dev/hdc3 b 22 3 + +mknod -m 0660 /dev/hdd b 22 64 +mknod -m 0660 /dev/hdd1 b 22 65 +mknod -m 0660 /dev/hdd2 b 22 66 +mknod -m 0660 /dev/hdd3 b 22 67 + +#mknod -m 0660 /dev/sda b 8 0 +#mknod -m 0660 /dev/sda1 b 8 1 +#mknod -m 0660 /dev/sda2 b 8 2 +#mknod -m 0660 /dev/sda3 b 8 3 + +mknod -m 0600 /dev/initctl p diff --git a/test/make-initrd.sh b/test/make-initrd.sh index f3b522d5384..2620b90eec7 100644 --- a/test/make-initrd.sh +++ b/test/make-initrd.sh @@ -12,7 +12,7 @@ packagesClosure=$(/nix/bin/nix-store -qR $packages $init) # won't unpack 'em. mkdir root cd root -cp -prvd --parents $packagesClosure . +cp -prd --parents $packagesClosure . # Put the closure in a gzipped cpio archive. ensureDir $out -- GitLab From 23381ed03f0bc4783c57e72288afa52c85429f81 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Nov 2006 00:36:08 +0000 Subject: [PATCH 0183/5331] * Add the module tools, util-linux and the kernel modules to the initrd. Of course, the next step is to only add the kernel modules that we're going to need. svn path=/nixu/trunk/; revision=6934 --- test/boot-stage-1-init.sh | 15 +++++++++++++++ test/boot-stage-1.nix | 8 ++++++-- test/rescue-system.nix | 10 +++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index 782ff485c41..629e6c24745 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -9,10 +9,25 @@ echo export PATH=/empty for i in @path@; do PATH=$PATH:$i/bin + if test -e $i/sbin; then + PATH=$PATH:$i/sbin + fi done +# Mount special file systems. +mkdir /etc # to shut up mount +touch /etc/fstab # idem +mkdir /proc +mount -t proc proc /proc +mkdir /sys +mount -t sysfs sys /sys + # Create device nodes in /dev. source @makeDevices@ +# Load some kernel modules. +export MODULE_DIR=@kernel@ +modprobe ide_disk + # Start an interactive shell. exec @shell@ diff --git a/test/boot-stage-1.nix b/test/boot-stage-1.nix index e5477888862..9fed0020c76 100644 --- a/test/boot-stage-1.nix +++ b/test/boot-stage-1.nix @@ -4,14 +4,18 @@ # the second boot stage. The closure of the result of this expression # is supposed to be put into an initial RAM disk (initrd). -{genericSubstituter, shell, staticTools}: +{ genericSubstituter, shell, staticTools +, module_init_tools, utillinux, kernel +}: genericSubstituter { src = ./boot-stage-1-init.sh; isExecutable = true; - inherit shell; + inherit shell kernel; path = [ staticTools + module_init_tools + utillinux ]; makeDevices = ./make-devices.sh; } diff --git a/test/rescue-system.nix b/test/rescue-system.nix index 994723eef1f..9491e8538e5 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -14,10 +14,18 @@ rec { bash = pkgs.bash; + # Determine the set of modules that we need to mount the root FS. + modulesClosure = import ./modules-closure.nix { + inherit (pkgs) stdenv kernel; + rootModules = "ide-cd"; + }; + + # The init script of boot stage 1 (loading kernel modules for # mounting the root FS). bootStage1 = import ./boot-stage-1.nix { - inherit (pkgs) genericSubstituter; + inherit (pkgs) genericSubstituter + module_init_tools utillinux kernel; shell = stdenvLinuxStuff.bootstrapTools.bash; staticTools = stdenvLinuxStuff.staticTools; }; -- GitLab From 6eb94a9bfd5271cab21a3f4b75e289bf8ce0f145 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Nov 2006 09:45:06 +0000 Subject: [PATCH 0184/5331] * Load some modules, mount the install CD. svn path=/nixu/trunk/; revision=6936 --- test/boot-stage-1-init.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index 629e6c24745..a5957fada5f 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -26,8 +26,15 @@ mount -t sysfs sys /sys source @makeDevices@ # Load some kernel modules. -export MODULE_DIR=@kernel@ -modprobe ide_disk +export MODULE_DIR=@kernel@/lib/modules/ +modprobe ide-generic +modprobe ide-disk +modprobe ide-cd + +# Mount the installation CD. +mkdir /mnt +mkdir /mnt/cdrom +mount -o ro /dev/hdc /mnt/cdrom # Start an interactive shell. exec @shell@ -- GitLab From 412fcfe2f7029742ac5f9c14c19d4503ef789ba5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Nov 2006 09:49:34 +0000 Subject: [PATCH 0185/5331] * Fixes. svn path=/nixu/trunk/; revision=6937 --- make-disk.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/make-disk.sh b/make-disk.sh index 4d0a12e08f9..d3fe502301a 100755 --- a/make-disk.sh +++ b/make-disk.sh @@ -24,7 +24,6 @@ gzip=$($build ./pkgs.nix -A gzip) cpio=$($build ./pkgs.nix -A cpio) archivesDir=$($mktemp/bin/mktemp -d) -archivesDir2=$($mktemp/bin/mktemp -d) manifest=${archivesDir}/MANIFEST nixpkgs=./pkgs fill_disk=$archivesDir/scripts/fill-disk.sh @@ -55,7 +54,6 @@ mkinitrd=$($build ./pkgs.nix -A mkinitrd) ### make NAR files for everything we want to install and some more. Make sure ### the right URL is in there, so specify /cdrom and not cdrom $NIX/nix-push --copy $archivesDir $manifest --target file:///cdrom $storeExpr $($build ./pkgs.nix -A kernel) $kernelscripts $mkinitrd -#$NIX/nix-push --copy $archivesDir2 $manifest --target http://losser.labs.cs.uu.nl/~armijn/.nix $storeExpr $($build ./pkgs.nix -A kernel) $kernelscripts # Location of sysvinit? sysvinitPath=$($build ./pkgs.nix -A sysvinit) @@ -106,7 +104,7 @@ done tar zcf ${archivesDir}/nixstore.tgz $combideps utilLinux=$($build ./pkgs.nix -A utillinuxStatic) -coreUtilsDiet=$($NIX/nix-store -qR $($build ./pkgs.nix -A coreutilsDiet)) +coreUtilsDiet=$($build ./pkgs.nix -A diet.coreutils) ## temporarily normal e2fsprogs until I can get it to build with dietlibc e2fsProgs=$($NIX/nix-store -qR $($build ./pkgs.nix -A e2fsprogsDiet)) -- GitLab From a94dd5c8b1c71ccda2e77047a926efc219392c36 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Nov 2006 11:47:40 +0000 Subject: [PATCH 0186/5331] * Given a kernel build (with modules in $kernel/lib/modules/VERSION), `modules-closure.nix' produces a module tree in $out/lib/modules/VERSION that contains only the modules identified by `rootModules', plus their dependencies. It also generates an appropriate modules.dep. This is useful for initrds, as we obviously don't want a copy of the entire kernel module tree in the initial RAM disk. svn path=/nixu/trunk/; revision=6939 --- test/boot-stage-1-init.sh | 2 +- test/boot-stage-1.nix | 6 +++--- test/modules-closure.nix | 13 +++++++++++++ test/modules-closure.sh | 37 +++++++++++++++++++++++++++++++++++++ test/rescue-system.nix | 11 +++++------ 5 files changed, 59 insertions(+), 10 deletions(-) create mode 100644 test/modules-closure.nix create mode 100644 test/modules-closure.sh diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index a5957fada5f..f216f05e237 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -26,7 +26,7 @@ mount -t sysfs sys /sys source @makeDevices@ # Load some kernel modules. -export MODULE_DIR=@kernel@/lib/modules/ +export MODULE_DIR=@modules@/lib/modules/ modprobe ide-generic modprobe ide-disk modprobe ide-cd diff --git a/test/boot-stage-1.nix b/test/boot-stage-1.nix index 9fed0020c76..1099fe08a21 100644 --- a/test/boot-stage-1.nix +++ b/test/boot-stage-1.nix @@ -5,17 +5,17 @@ # is supposed to be put into an initial RAM disk (initrd). { genericSubstituter, shell, staticTools -, module_init_tools, utillinux, kernel +, module_init_tools, utillinux, modules }: genericSubstituter { src = ./boot-stage-1-init.sh; isExecutable = true; - inherit shell kernel; + inherit shell modules; path = [ staticTools module_init_tools - utillinux +# utillinux ]; makeDevices = ./make-devices.sh; } diff --git a/test/modules-closure.nix b/test/modules-closure.nix new file mode 100644 index 00000000000..86015a8b182 --- /dev/null +++ b/test/modules-closure.nix @@ -0,0 +1,13 @@ +# Given a kernel build (with modules in $kernel/lib/modules/VERSION), +# produce a module tree in $out/lib/modules/VERSION that contains only +# the modules identified by `rootModules', plus their dependencies. +# Also generate an appropriate modules.dep. + +{stdenv, kernel, rootModules, module_init_tools}: + +stdenv.mkDerivation { + name = kernel.name + "-shrunk"; + builder = ./modules-closure.sh; + inherit kernel rootModules module_init_tools; + allowedReferences = ["out"]; +} diff --git a/test/modules-closure.sh b/test/modules-closure.sh new file mode 100644 index 00000000000..c5fcbba87f1 --- /dev/null +++ b/test/modules-closure.sh @@ -0,0 +1,37 @@ +source $stdenv/setup + +set -o pipefail + +PATH=$module_init_tools/sbin:$PATH + +version=$(cd $kernel/lib/modules && ls -d *) + +echo "kernel version is $version" + +export MODULE_DIR=$kernel/lib/modules/ + +# Determine the dependencies of each root module. +closure= +for module in $rootModules; do + echo "root module: $module" + deps=$(modprobe --set-version "$version" --show-depends "$module" \ + | sed 's/^insmod //') + for i in $deps; do echo $i; done + closure="$closure $deps" +done + +# Remove duplicates. +closure=$(for i in $closure; do echo $i; done | sort | uniq) + +echo "closure:" +ensureDir $out +for module in $closure; do + echo $module + target=$(echo $module | sed "s^$kernel^$out^") + mkdir -p $(dirname $target) + cp $module $target + grep "^$module" $kernel/lib/modules/$version/modules.dep \ + | sed "s^$kernel^$out^g" \ + >> $out/lib/modules/$version/modules.dep +done + diff --git a/test/rescue-system.nix b/test/rescue-system.nix index 9491e8538e5..b42030b659c 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -11,21 +11,20 @@ rec { allPackages = import ./pkgs/top-level/all-packages.nix; }; - bash = pkgs.bash; - # Determine the set of modules that we need to mount the root FS. modulesClosure = import ./modules-closure.nix { - inherit (pkgs) stdenv kernel; - rootModules = "ide-cd"; + inherit (pkgs) stdenv kernel module_init_tools; + rootModules = ["ide-cd" "ide-disk" "ide-generic"]; }; # The init script of boot stage 1 (loading kernel modules for # mounting the root FS). bootStage1 = import ./boot-stage-1.nix { - inherit (pkgs) genericSubstituter - module_init_tools utillinux kernel; + inherit (pkgs) genericSubstituter utillinux; + inherit (pkgsDiet) module_init_tools; + modules = modulesClosure; shell = stdenvLinuxStuff.bootstrapTools.bash; staticTools = stdenvLinuxStuff.staticTools; }; -- GitLab From 1aa35c8267d1a6319bef51ce969f8863b7928558 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Nov 2006 13:35:02 +0000 Subject: [PATCH 0187/5331] * Instead of adding all of util-linux to the initd, add just mount (and nuke its references so that we don't get glibc etc.). The initrd is now 3.2 MB (and that includes the entire staticTools from the stdenv bootstrap, most of which we don't actually need). svn path=/nixu/trunk/; revision=6942 --- test/boot-stage-1.nix | 4 ++-- test/rescue-system.nix | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/test/boot-stage-1.nix b/test/boot-stage-1.nix index 1099fe08a21..329ca513a95 100644 --- a/test/boot-stage-1.nix +++ b/test/boot-stage-1.nix @@ -5,7 +5,7 @@ # is supposed to be put into an initial RAM disk (initrd). { genericSubstituter, shell, staticTools -, module_init_tools, utillinux, modules +, module_init_tools, extraUtils, modules }: genericSubstituter { @@ -15,7 +15,7 @@ genericSubstituter { path = [ staticTools module_init_tools -# utillinux + extraUtils ]; makeDevices = ./make-devices.sh; } diff --git a/test/rescue-system.nix b/test/rescue-system.nix index b42030b659c..5e1e47a112f 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -6,6 +6,10 @@ rec { bootStdenv = pkgs.useDietLibC pkgs.stdenv; }; + pkgsStatic = import ./pkgs/top-level/all-packages.nix { + bootStdenv = pkgs.makeStaticBinaries pkgs.stdenv; + }; + stdenvLinuxStuff = import ./pkgs/stdenv/linux { system = pkgs.stdenv.system; allPackages = import ./pkgs/top-level/all-packages.nix; @@ -19,11 +23,24 @@ 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; ensureDir $out/bin; cp $utillinux/bin/mount $out/bin; nuke-refs $out/bin/mount"; + buildInputs = [pkgs.nukeReferences]; + inherit (pkgsStatic) utillinux; + }; + + # The init script of boot stage 1 (loading kernel modules for # mounting the root FS). bootStage1 = import ./boot-stage-1.nix { - inherit (pkgs) genericSubstituter utillinux; + inherit (pkgs) genericSubstituter; inherit (pkgsDiet) module_init_tools; + inherit extraUtils; modules = modulesClosure; shell = stdenvLinuxStuff.bootstrapTools.bash; staticTools = stdenvLinuxStuff.staticTools; -- GitLab From 14cc7b88289ce90470f9b5556707e9cd2becb519 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Nov 2006 23:41:57 +0000 Subject: [PATCH 0188/5331] * Support adding the closure of a set of store paths to the ISO image (along with an /init symlink for stage 2 of the boot process). svn path=/nixu/trunk/; revision=6944 --- test/make-iso9660-image.nix | 14 ++++++++++++-- test/make-iso9660-image.sh | 23 ++++++++++++++++++++++- test/rescue-system.nix | 2 ++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/test/make-iso9660-image.nix b/test/make-iso9660-image.nix index 976f7047fd4..f08aac3abc5 100644 --- a/test/make-iso9660-image.nix +++ b/test/make-iso9660-image.nix @@ -9,6 +9,15 @@ # grafted in the file system at path `target'. contents +, # In addition to `contents', the closure of the store paths listed + # in `packages' are also placed in the file system. + packages ? [] + +, # `init' should be a store path, the closure of which is added to + # the image, just like `packages'. However, in addition, a symlink + # `/init' to `init' will be created. + init ? null + # Whether this should be an El-Torito bootable CD. , bootable ? false @@ -23,6 +32,7 @@ stdenv.mkDerivation { name = "iso9660-image"; builder = ./make-iso9660-image.sh; buildInputs = [cdrtools]; - inherit isoName bootable bootImage; - graftList = map ({source, target}: target + "=" + source) contents; + inherit isoName packages init bootable bootImage; + sources = map ({source, target}: source) contents; + targets = map ({source, target}: target) contents; } diff --git a/test/make-iso9660-image.sh b/test/make-iso9660-image.sh index 7e9017f41a1..a2d98044c13 100644 --- a/test/make-iso9660-image.sh +++ b/test/make-iso9660-image.sh @@ -6,5 +6,26 @@ if test -n "$bootable"; then bootFlags="-b $bootImage -c boot.cat -no-emul-boot -boot-load-size 4" fi +graftList= +sources_=($sources) +targets_=($targets) +for ((i = 0; i < ${#targets_[@]}; i++)); do + graftList="$graftList ${targets_[$i]}=$(readlink -f ${sources_[$i]})" +done + +# !!! Just as with make-initrd.nix, the call to Nix here needs to be +# fixed. +packagesClosure=$(/nix/bin/nix-store -qR $packages $init) + +for i in $packagesClosure; do + graftList="$graftList ${i:1}=$i" +done + +if test -n "$init"; then + ln -s $init init + graftList="$graftList init=init" +fi + # !!! -f is a quick hack. -mkisofs -r -J -f -o $out/$isoName $bootFlags -graft-points $graftList +mkisofs -r -J -o $out/$isoName $bootFlags \ + -graft-points $graftList diff --git a/test/rescue-system.nix b/test/rescue-system.nix index 5e1e47a112f..d87de72715e 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -76,6 +76,8 @@ rec { target = "isolinux/initrd"; } ]; + + init = pkgs.bash + "/bin/sh"; bootable = true; bootImage = "isolinux/isolinux.bin"; -- GitLab From 1691c6667326f5e3b9209444c38be28451f3820a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 4 Nov 2006 00:01:13 +0000 Subject: [PATCH 0189/5331] * Nix expression for stage 2. * Start stage 2 from stage 1. svn path=/nixu/trunk/; revision=6945 --- test/boot-stage-1-init.sh | 7 ++++++- test/boot-stage-2-init.sh | 31 +++++++++++++++++++++++++++++++ test/boot-stage-2.nix | 14 ++++++++++++++ test/rescue-system.nix | 10 +++++++++- 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 test/boot-stage-2-init.sh create mode 100644 test/boot-stage-2.nix diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index f216f05e237..2100d864d04 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -36,5 +36,10 @@ mkdir /mnt mkdir /mnt/cdrom mount -o ro /dev/hdc /mnt/cdrom -# Start an interactive shell. +# Start stage 2. !!! We use chroot for now, but I guess that should +# be pivot_root or so. +chroot /mnt/cdrom /init + +# If starting stage 2 failed, start an interactive shell. +echo "Stage 2 failed, starting emergency shell..." exec @shell@ diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh new file mode 100644 index 00000000000..4be4a29de2d --- /dev/null +++ b/test/boot-stage-2-init.sh @@ -0,0 +1,31 @@ +#! @shell@ + +# !!! copied from stage 1; remove duplication + +# Print a greeting. +echo +echo "<<< NixOS Stage 2 >>>" +echo + +# Set the PATH. +export PATH=/empty +for i in @path@; do + PATH=$PATH:$i/bin + if test -e $i/sbin; then + PATH=$PATH:$i/sbin + fi +done + +# Mount special file systems. +mkdir /etc # to shut up mount +touch /etc/fstab # idem +mkdir /proc +mount -t proc proc /proc +mkdir /sys +mount -t sysfs sys /sys + +# Create device nodes in /dev. +source @makeDevices@ + +# Start an interactive shell. +exec @shell@ diff --git a/test/boot-stage-2.nix b/test/boot-stage-2.nix new file mode 100644 index 00000000000..5605bd593a5 --- /dev/null +++ b/test/boot-stage-2.nix @@ -0,0 +1,14 @@ +{ genericSubstituter, shell, coreutils +, utillinux +}: + +genericSubstituter { + src = ./boot-stage-2-init.sh; + isExecutable = true; + inherit shell; + path = [ + coreutils + utillinux + ]; + makeDevices = ./make-devices.sh; +} diff --git a/test/rescue-system.nix b/test/rescue-system.nix index d87de72715e..b20a662c599 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -56,6 +56,14 @@ rec { }; + # The init script of boot stage 2, which is supposed to do + # everything else to bring up the system. + bootStage2 = import ./boot-stage-2.nix { + inherit (pkgs) genericSubstituter coreutils utillinux; + shell = pkgs.bash + "/bin/sh"; + }; + + # Create an ISO image containing the isolinux boot loader, the # kernel, and initrd produced above. rescueCD = import ./make-iso9660-image.nix { @@ -77,7 +85,7 @@ rec { } ]; - init = pkgs.bash + "/bin/sh"; + init = bootStage2; bootable = true; bootImage = "isolinux/isolinux.bin"; -- GitLab From db08678bd4a6d102eaf51092255059fea2603d66 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 4 Nov 2006 00:18:22 +0000 Subject: [PATCH 0190/5331] * Create dummy mount points in the ISO image for /proc etc. svn path=/nixu/trunk/; revision=6946 --- test/boot-stage-1-init.sh | 4 ++-- test/boot-stage-2-init.sh | 10 +++++----- test/rescue-system.nix | 11 +++++++++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index 2100d864d04..091dc4310de 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -18,9 +18,9 @@ done mkdir /etc # to shut up mount touch /etc/fstab # idem mkdir /proc -mount -t proc proc /proc +mount -t proc none /proc mkdir /sys -mount -t sysfs sys /sys +mount -t sysfs none /sys # Create device nodes in /dev. source @makeDevices@ diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 4be4a29de2d..a9e9c63708b 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -17,12 +17,12 @@ for i in @path@; do done # Mount special file systems. -mkdir /etc # to shut up mount +mount -t tmpfs none /etc -n # to shut up mount touch /etc/fstab # idem -mkdir /proc -mount -t proc proc /proc -mkdir /sys -mount -t sysfs sys /sys +mount -t proc none /proc +mount -t sysfs none /sys +mount -t tmpfs none /dev +mount -t tmpfs none /tmp # Create device nodes in /dev. source @makeDevices@ diff --git a/test/rescue-system.nix b/test/rescue-system.nix index b20a662c599..da1c2544401 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -64,6 +64,14 @@ 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; mkdir $out; cd $out; mkdir proc sys tmp etc dev"; + }; + + # Create an ISO image containing the isolinux boot loader, the # kernel, and initrd produced above. rescueCD = import ./make-iso9660-image.nix { @@ -83,6 +91,9 @@ rec { { source = initialRamdisk + "/initrd"; target = "isolinux/initrd"; } + { source = cdMountPoints; + target = "/"; + } ]; init = bootStage2; -- GitLab From eb1c50ebc91cf79f167964331fed932b3c24b400 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 4 Nov 2006 11:27:08 +0000 Subject: [PATCH 0191/5331] * Version number, stable marker. svn path=/nixu/trunk/; revision=6947 --- STABLE | 1 + VERSION | 1 + 2 files changed, 2 insertions(+) create mode 100644 STABLE create mode 100644 VERSION diff --git a/STABLE b/STABLE new file mode 100644 index 00000000000..c227083464f --- /dev/null +++ b/STABLE @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/VERSION b/VERSION new file mode 100644 index 00000000000..ceab6e11ece --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1 \ No newline at end of file -- GitLab From b3c6510393233f1e6b851f8f7db0fb95fcb95c8d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 4 Nov 2006 12:00:05 +0000 Subject: [PATCH 0192/5331] * Conform to build farm conventions. svn path=/nixu/trunk/; revision=6948 --- test/make-iso9660-image.sh | 8 +++++--- test/rescue-system.nix | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test/make-iso9660-image.sh b/test/make-iso9660-image.sh index a2d98044c13..b4994bfa013 100644 --- a/test/make-iso9660-image.sh +++ b/test/make-iso9660-image.sh @@ -1,7 +1,5 @@ source $stdenv/setup -ensureDir $out - if test -n "$bootable"; then bootFlags="-b $bootImage -c boot.cat -no-emul-boot -boot-load-size 4" fi @@ -27,5 +25,9 @@ if test -n "$init"; then fi # !!! -f is a quick hack. -mkisofs -r -J -o $out/$isoName $bootFlags \ +ensureDir $out/files +mkisofs -r -J -o $out/files/$isoName $bootFlags \ -graft-points $graftList + +ensureDir $out/nix-support +echo $system > $out/nix-support/system diff --git a/test/rescue-system.nix b/test/rescue-system.nix index da1c2544401..69899180baf 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -1,12 +1,16 @@ +{system ? __currentSystem}: + rec { - pkgs = import ./pkgs/top-level/all-packages.nix {}; + pkgs = import ./pkgs/top-level/all-packages.nix {inherit system;}; pkgsDiet = import ./pkgs/top-level/all-packages.nix { + inherit system; bootStdenv = pkgs.useDietLibC pkgs.stdenv; }; pkgsStatic = import ./pkgs/top-level/all-packages.nix { + inherit system; bootStdenv = pkgs.makeStaticBinaries pkgs.stdenv; }; -- GitLab From 07d2f691f0293a3772b5ab67633efd7b8b4bdc00 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 4 Nov 2006 12:07:16 +0000 Subject: [PATCH 0193/5331] * Doh. svn path=/nixu/trunk/; revision=6949 --- test/make-iso9660-image.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/make-iso9660-image.sh b/test/make-iso9660-image.sh index b4994bfa013..b708c05ee31 100644 --- a/test/make-iso9660-image.sh +++ b/test/make-iso9660-image.sh @@ -25,8 +25,8 @@ if test -n "$init"; then fi # !!! -f is a quick hack. -ensureDir $out/files -mkisofs -r -J -o $out/files/$isoName $bootFlags \ +ensureDir $out +mkisofs -r -J -o $out/$isoName $bootFlags \ -graft-points $graftList ensureDir $out/nix-support -- GitLab From 09cdc88291520419a0ae4c760b4c7199e26d7802 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 4 Nov 2006 12:08:02 +0000 Subject: [PATCH 0194/5331] * Doh x2. svn path=/nixu/trunk/; revision=6950 --- test/make-iso9660-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/make-iso9660-image.sh b/test/make-iso9660-image.sh index b708c05ee31..b8fcce5dddd 100644 --- a/test/make-iso9660-image.sh +++ b/test/make-iso9660-image.sh @@ -26,7 +26,7 @@ fi # !!! -f is a quick hack. ensureDir $out -mkisofs -r -J -o $out/$isoName $bootFlags \ +mkisofs -r -J -o $out/iso/$isoName $bootFlags \ -graft-points $graftList ensureDir $out/nix-support -- GitLab From 2e2af9df0a1ab66590ba0fdf6f23add44281ac48 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 4 Nov 2006 12:08:10 +0000 Subject: [PATCH 0195/5331] * Doh x3. svn path=/nixu/trunk/; revision=6951 --- test/make-iso9660-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/make-iso9660-image.sh b/test/make-iso9660-image.sh index b8fcce5dddd..17f44e78ff0 100644 --- a/test/make-iso9660-image.sh +++ b/test/make-iso9660-image.sh @@ -25,7 +25,7 @@ if test -n "$init"; then fi # !!! -f is a quick hack. -ensureDir $out +ensureDir $out/iso mkisofs -r -J -o $out/iso/$isoName $bootFlags \ -graft-points $graftList -- GitLab From 1cec62ba5d76dd842b4cd1afe014bf86fb94b036 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 4 Nov 2006 13:25:10 +0000 Subject: [PATCH 0196/5331] * Add additional packages to the path of the interactive shell started at the end of stage 2. * Stage 2: set MODULE_DIR to point at a full module tree. svn path=/nixu/trunk/; revision=6954 --- test/boot-stage-2-init.sh | 11 +++++++++++ test/boot-stage-2.nix | 5 +++-- test/rescue-system.nix | 24 +++++++++++++++++++++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index a9e9c63708b..02b440f5a36 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -27,5 +27,16 @@ mount -t tmpfs none /tmp # Create device nodes in /dev. source @makeDevices@ +# Ensure that the module tools can find the kernel modules. +export MODULE_DIR=@kernel@/lib/modules/ + +# Additional path for the interactive shell. +for i in @extraPath@; do + PATH=$PATH:$i/bin + if test -e $i/sbin; then + PATH=$PATH:$i/sbin + fi +done + # Start an interactive shell. exec @shell@ diff --git a/test/boot-stage-2.nix b/test/boot-stage-2.nix index 5605bd593a5..8f68858f536 100644 --- a/test/boot-stage-2.nix +++ b/test/boot-stage-2.nix @@ -1,14 +1,15 @@ { genericSubstituter, shell, coreutils -, utillinux +, utillinux, kernel, path ? [] }: genericSubstituter { src = ./boot-stage-2-init.sh; isExecutable = true; - inherit shell; + inherit shell kernel; path = [ coreutils utillinux ]; + extraPath = path; makeDevices = ./make-devices.sh; } diff --git a/test/rescue-system.nix b/test/rescue-system.nix index 69899180baf..216cf2009f9 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -63,8 +63,30 @@ rec { # The init script of boot stage 2, which is supposed to do # everything else to bring up the system. bootStage2 = import ./boot-stage-2.nix { - inherit (pkgs) genericSubstituter coreutils utillinux; + inherit (pkgs) genericSubstituter coreutils utillinux kernel; shell = pkgs.bash + "/bin/sh"; + + # Additional stuff; add whatever you want here. + path = [ + pkgs.bash + pkgs.bzip2 + pkgs.cpio + pkgs.curl + pkgs.e2fsprogs + pkgs.findutils + pkgs.gnugrep + pkgs.gnused + pkgs.gnutar + pkgs.grub + pkgs.gzip + pkgs.iputils + pkgs.less + pkgs.module_init_tools + pkgs.nano + pkgs.netcat + pkgs.nettools + pkgs.vim + ]; }; -- GitLab From 8a43fcd57c2718c92d5f29019b795d135db8e6de Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 6 Nov 2006 22:21:50 +0000 Subject: [PATCH 0197/5331] * Stage 1: clean up better (unmount /proc and /sys, remount new root to /). * Stage 2: use sysvinit to create a bunch of mingetty's on virtual consoles 1-6. Show a nice welcoming message. Start syslogd and log everything to tty10. svn path=/nixu/trunk/; revision=6963 --- test/boot-stage-1-init.sh | 12 +++++++--- test/boot-stage-2-init.sh | 46 ++++++++++++++++++++++++++++++++++++++- test/boot-stage-2.nix | 5 +++-- test/make-devices.sh | 17 +++++---------- test/rescue-system.nix | 20 ++++++++++++----- 5 files changed, 78 insertions(+), 22 deletions(-) diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index 091dc4310de..b9e2d1f4434 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -36,9 +36,15 @@ mkdir /mnt mkdir /mnt/cdrom mount -o ro /dev/hdc /mnt/cdrom -# Start stage 2. !!! We use chroot for now, but I guess that should -# be pivot_root or so. -chroot /mnt/cdrom /init +# Start stage 2. +# !!! Note: we can't use pivot_root here (the kernel gods have +# decreed), but we could use run-init from klibc, which deletes all +# files in the initramfs, remounts the target root on /, and chroots. +cd /mnt/cdrom +mount --move . / +umount /proc # cleanup +umount /sys +exec chroot . /init # If starting stage 2 failed, start an interactive shell. echo "Stage 2 failed, starting emergency shell..." diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 02b440f5a36..28ed1d19de3 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -23,6 +23,12 @@ mount -t proc none /proc mount -t sysfs none /sys mount -t tmpfs none /dev mount -t tmpfs none /tmp +mount -t tmpfs none /var +mount -t tmpfs none /nix/var + +mkdir -p /nix/var/nix/db +mkdir -p /nix/var/nix/gcroots +mkdir -p /nix/var/nix/temproots # Create device nodes in /dev. source @makeDevices@ @@ -38,5 +44,43 @@ for i in @extraPath@; do fi done +# Start syslogd. +mkdir -p /var/run +#mkdir -p /var/log +#touch /var/log/messages +echo "*.* /dev/tty10" > /etc/syslog.conf +echo "syslog 514/udp" > /etc/services # required, even if we don't use it +@sysklogd@/sbin/syslogd & + +# login/su absolutely need this. +touch /etc/login.defs + +# Enable a password-less root login. +echo "root::0:0:root:/:@shell@" > /etc/passwd +echo "root:*:0" > /etc/group + +cat > /etc/profile <> /etc/inittab +done + +# Show a nice greeting on each terminal. +cat > /etc/issue <>> + +You can log in as \`root'. + + +EOF + # Start an interactive shell. -exec @shell@ +#exec @shell@ + +# Start init. +exec init 2 diff --git a/test/boot-stage-2.nix b/test/boot-stage-2.nix index 8f68858f536..f1aff2d59a9 100644 --- a/test/boot-stage-2.nix +++ b/test/boot-stage-2.nix @@ -1,11 +1,12 @@ { genericSubstituter, shell, coreutils -, utillinux, kernel, path ? [] +, utillinux, kernel, sysklogd, mingetty +, path ? [] }: genericSubstituter { src = ./boot-stage-2-init.sh; isExecutable = true; - inherit shell kernel; + inherit shell kernel sysklogd mingetty; path = [ coreutils utillinux diff --git a/test/make-devices.sh b/test/make-devices.sh index dead9814f7a..1e9f9719ea4 100644 --- a/test/make-devices.sh +++ b/test/make-devices.sh @@ -1,4 +1,3 @@ -#mknod -m 0600 /dev/console c 5 1 mknod -m 0600 /dev/ttyS0 c 4 64 mknod -m 0600 /dev/ttyS1 c 4 65 mknod -m 0600 /dev/ttyS2 c 4 66 @@ -11,16 +10,12 @@ mknod -m 0666 /dev/zero c 1 5 # tty mknod -m 0600 /dev/tty c 5 0 -mknod -m 0600 /dev/tty0 c 4 0 -mknod -m 0600 /dev/tty1 c 4 1 -mknod -m 0600 /dev/tty2 c 4 2 -mknod -m 0600 /dev/tty3 c 4 3 -mknod -m 0600 /dev/tty4 c 4 4 -mknod -m 0600 /dev/tty5 c 4 5 -mknod -m 0600 /dev/tty6 c 4 6 -mknod -m 0600 /dev/tty7 c 4 7 -mknod -m 0600 /dev/tty8 c 4 8 -mknod -m 0600 /dev/tty9 c 4 9 +if ! test -e /dev/console; then + mknod -m 0600 /dev/console c 5 1 +fi +for i in $(seq 0 10); do + mknod -m 0600 /dev/tty$i c 4 $i +done mkdir -m 0755 /dev/pts mknod -m 0666 /dev/ptmx c 5 2 diff --git a/test/rescue-system.nix b/test/rescue-system.nix index 216cf2009f9..044bf1a7065 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -33,7 +33,7 @@ rec { extraUtils = pkgs.stdenv.mkDerivation { name = "extra-utils"; builder = builtins.toFile "builder.sh" - "source $stdenv/setup; ensureDir $out/bin; cp $utillinux/bin/mount $out/bin; nuke-refs $out/bin/mount"; + "source $stdenv/setup; ensureDir $out/bin; cp $utillinux/bin/mount $utillinux/bin/umount $utillinux/sbin/pivot_root $out/bin; nuke-refs $out/bin/*"; buildInputs = [pkgs.nukeReferences]; inherit (pkgsStatic) utillinux; }; @@ -63,7 +63,8 @@ rec { # The init script of boot stage 2, which is supposed to do # everything else to bring up the system. bootStage2 = import ./boot-stage-2.nix { - inherit (pkgs) genericSubstituter coreutils utillinux kernel; + inherit (pkgs) genericSubstituter coreutils utillinux kernel + sysklogd; shell = pkgs.bash + "/bin/sh"; # Additional stuff; add whatever you want here. @@ -86,7 +87,15 @@ rec { pkgs.netcat pkgs.nettools pkgs.vim + pkgs.nix + pkgs.strace + pkgs.sysvinit + pkgs.procps + pkgs.shadowutils + pkgs.sysklogd ]; + + mingetty = pkgs.mingettyWrapper; }; @@ -94,12 +103,13 @@ rec { cdMountPoints = pkgs.stdenv.mkDerivation { name = "mount-points"; builder = builtins.toFile "builder.sh" - "source $stdenv/setup; mkdir $out; cd $out; mkdir proc sys tmp etc dev"; + "source $stdenv/setup; mkdir $out; cd $out; mkdir proc sys tmp etc dev var mnt nix nix/var"; }; # Create an ISO image containing the isolinux boot loader, the - # kernel, and initrd produced above. + # kernel, the initrd produced above, and the closure of the stage 2 + # init. rescueCD = import ./make-iso9660-image.nix { inherit (pkgs) stdenv cdrtools; isoName = "nixos.iso"; @@ -128,5 +138,5 @@ rec { bootImage = "isolinux/isolinux.bin"; }; - + } -- GitLab From da8cec4795de1b3992f6963e0c5832cffdc9f57e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 7 Nov 2006 22:05:27 +0000 Subject: [PATCH 0198/5331] * Use udevtrigger to create device nodes for all known devices. * Plug and play: load kernel modules for all supported PCI devices automatically. svn path=/nixu/trunk/; revision=6975 --- test/boot-stage-2-init.sh | 45 ++++++++++++++++++++++++++------------- test/boot-stage-2.nix | 8 +++++-- test/rescue-system.nix | 6 ++---- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 28ed1d19de3..50069ebe216 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -30,19 +30,20 @@ mkdir -p /nix/var/nix/db mkdir -p /nix/var/nix/gcroots mkdir -p /nix/var/nix/temproots -# Create device nodes in /dev. -source @makeDevices@ - # Ensure that the module tools can find the kernel modules. export MODULE_DIR=@kernel@/lib/modules/ -# Additional path for the interactive shell. -for i in @extraPath@; do - PATH=$PATH:$i/bin - if test -e $i/sbin; then - PATH=$PATH:$i/sbin - fi -done +# Create device nodes in /dev. +#source @makeDevices@ + +# Start udev. +udevd --daemon + +# Let udev create device nodes for all modules that have already been +# loaded into the kernel (or for which support is built into the +# kernel). +udevtrigger +udevsettle # wait for udev to finish # Start syslogd. mkdir -p /var/run @@ -52,6 +53,12 @@ echo "*.* /dev/tty10" > /etc/syslog.conf echo "syslog 514/udp" > /etc/services # required, even if we don't use it @sysklogd@/sbin/syslogd & +# Try to load modules for all PCI devices. +for i in /sys/bus/pci/devices/*/modalias; do + echo "Trying to load a module for $(basename $(dirname $i))..." + modprobe $(cat $i) +done + # login/su absolutely need this. touch /etc/login.defs @@ -59,11 +66,6 @@ touch /etc/login.defs echo "root::0:0:root:/:@shell@" > /etc/passwd echo "root:*:0" > /etc/group -cat > /etc/profile <> /etc/inittab @@ -79,6 +81,19 @@ You can log in as \`root'. EOF +# Additional path for the interactive shell. +for i in @extraPath@; do + PATH=$PATH:$i/bin + if test -e $i/sbin; then + PATH=$PATH:$i/sbin + fi +done + +cat > /etc/profile < Date: Tue, 7 Nov 2006 22:45:42 +0000 Subject: [PATCH 0199/5331] * Automatically bring up the network devices and start dhclient on them. svn path=/nixu/trunk/; revision=6976 --- test/boot-stage-2-init.sh | 12 ++++++++++++ test/boot-stage-2.nix | 4 +++- test/rescue-system.nix | 7 ++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 50069ebe216..8235715e09e 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -59,6 +59,18 @@ for i in /sys/bus/pci/devices/*/modalias; do modprobe $(cat $i) done +# Bring up the network devices. +modprobe af_packet +for i in $(cd /sys/class/net && ls -d *); do + echo "Bringing up network device $i..." + if ifconfig $i up; then + if test "$i" != "lo"; then + mkdir -p /var/state/dhcp + dhclient $i + fi + fi +done + # login/su absolutely need this. touch /etc/login.defs diff --git a/test/boot-stage-2.nix b/test/boot-stage-2.nix index 4b7ab3c318e..4514d1779ad 100644 --- a/test/boot-stage-2.nix +++ b/test/boot-stage-2.nix @@ -1,6 +1,6 @@ { genericSubstituter, shell, coreutils, findutils , utillinux, kernel, sysklogd, mingetty, udev -, module_init_tools +, module_init_tools, nettools, dhcp , path ? [] }: @@ -14,6 +14,8 @@ genericSubstituter { utillinux udev module_init_tools + nettools + dhcp ]; extraPath = path; makeDevices = ./make-devices.sh; diff --git a/test/rescue-system.nix b/test/rescue-system.nix index eda7cf599d4..fd22e482f2e 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -64,8 +64,10 @@ rec { # everything else to bring up the system. bootStage2 = import ./boot-stage-2.nix { inherit (pkgs) genericSubstituter coreutils findutils - utillinux kernel sysklogd udev module_init_tools; + utillinux kernel sysklogd udev module_init_tools + nettools; shell = pkgs.bash + "/bin/sh"; + dhcp = pkgs.dhcpWrapper; # Additional stuff; add whatever you want here. path = [ @@ -83,8 +85,7 @@ rec { pkgs.less pkgs.nano pkgs.netcat - pkgs.nettools - pkgs.vim +# pkgs.vim pkgs.nix pkgs.strace pkgs.sysvinit -- GitLab From 67050453343e58664047fa0361d746baffd27d9f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 8 Nov 2006 02:34:14 +0000 Subject: [PATCH 0200/5331] * Start of the installer: copy the closure of Nix to the target device so we can then do nix-env operations in a chroot to do the actual installation. svn path=/nixu/trunk/; revision=6977 --- test/installer.nix | 15 +++++++++++++++ test/installer.sh | 41 +++++++++++++++++++++++++++++++++++++++++ test/rescue-system.nix | 7 +++++++ 3 files changed, 63 insertions(+) create mode 100644 test/installer.nix create mode 100644 test/installer.sh diff --git a/test/installer.nix b/test/installer.nix new file mode 100644 index 00000000000..1560e665489 --- /dev/null +++ b/test/installer.nix @@ -0,0 +1,15 @@ +{ stdenv, genericSubstituter, shell, nix +}: + +genericSubstituter { + src = ./installer.sh; + isExecutable = true; + inherit shell nix; + + nixClosure = stdenv.mkDerivation { + name = "closure"; + builder = builtins.toFile "builder.sh" + "source $stdenv/setup; /nix/bin/nix-store -qR $nix > $out"; + inherit nix; + }; +} diff --git a/test/installer.sh b/test/installer.sh new file mode 100644 index 00000000000..c2742e9018e --- /dev/null +++ b/test/installer.sh @@ -0,0 +1,41 @@ +#! @shell@ + +# Syntax: installer.sh +# (e.g., installer.sh /dev/hda1 ./my-machine.nix) + +# - mount target device +# - make Nix store etc. +# - copy closure of rescue env to target device +# - register validity +# - start the "target" installer in a chroot to the target device +# * do a nix-pull +# * nix-env -p system-profile -i +# * run hook scripts provided by packages in the configuration? +# - install/update grub + +targetDevice="$1" + +if test -z "$targetDevice"; then + echo "syntax: installer.sh " + exit 1 +fi + + +# Make sure that the target device isn't mounted. +umount "$targetDevice" 2> /dev/null + + +# Check it. +fsck "$targetDevice" || exit 1 + + +# Mount the target device. +mountPoint=/tmp/inst-mnt +mkdir -p $mountPoint +mount "$targetDevice" $mountPoint || exit 1 + + +# Copy Nix to the Nix store on the target device. +mkdir -p $mountPoint/nix/store/ +cp -prd $(cat @nixClosure@) $mountPoint/nix/store/ || exit 1 + diff --git a/test/rescue-system.nix b/test/rescue-system.nix index fd22e482f2e..e4147b153f5 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -98,6 +98,13 @@ rec { }; + # The installer. + nixosInstaller = import ./installer.nix { + inherit (pkgs) stdenv genericSubstituter nix; + shell = pkgs.bash + "/bin/sh"; + }; + + # Since the CD is read-only, the mount points must be on disk. cdMountPoints = pkgs.stdenv.mkDerivation { name = "mount-points"; -- GitLab From 4b333e0f67caa765feec052d79804f4520221bb7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 8 Nov 2006 09:31:45 +0000 Subject: [PATCH 0201/5331] * Add the installer and rsync to the path. svn path=/nixu/trunk/; revision=6979 --- test/installer.nix | 1 + test/installer.sh | 2 +- test/rescue-system.nix | 16 +++++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/test/installer.nix b/test/installer.nix index 1560e665489..d960bab1bb1 100644 --- a/test/installer.nix +++ b/test/installer.nix @@ -3,6 +3,7 @@ genericSubstituter { src = ./installer.sh; + dir = "bin"; isExecutable = true; inherit shell nix; diff --git a/test/installer.sh b/test/installer.sh index c2742e9018e..a823a2b76a4 100644 --- a/test/installer.sh +++ b/test/installer.sh @@ -37,5 +37,5 @@ mount "$targetDevice" $mountPoint || exit 1 # Copy Nix to the Nix store on the target device. mkdir -p $mountPoint/nix/store/ -cp -prd $(cat @nixClosure@) $mountPoint/nix/store/ || exit 1 +rsync -av $(cat @nixClosure@) $mountPoint/nix/store/ || exit 1 diff --git a/test/rescue-system.nix b/test/rescue-system.nix index e4147b153f5..4e22ecb4d89 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -60,6 +60,13 @@ rec { }; + # The installer. + nixosInstaller = import ./installer.nix { + inherit (pkgs) stdenv genericSubstituter nix; + shell = pkgs.bash + "/bin/sh"; + }; + + # The init script of boot stage 2, which is supposed to do # everything else to bring up the system. bootStage2 = import ./boot-stage-2.nix { @@ -92,19 +99,14 @@ rec { pkgs.procps pkgs.shadowutils pkgs.sysklogd + pkgs.rsync + nixosInstaller ]; mingetty = pkgs.mingettyWrapper; }; - # The installer. - nixosInstaller = import ./installer.nix { - inherit (pkgs) stdenv genericSubstituter nix; - shell = pkgs.bash + "/bin/sh"; - }; - - # Since the CD is read-only, the mount points must be on disk. cdMountPoints = pkgs.stdenv.mkDerivation { name = "mount-points"; -- GitLab From 67f3ee3b644ff9819a9f295d79a44e000fa8622c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 10 Nov 2006 14:38:15 +0000 Subject: [PATCH 0202/5331] * Probe for the NixOS installation CD. svn path=/nixu/trunk/; revision=6985 --- test/boot-stage-1-init.sh | 39 +++++++++++++++++++++++++++++++++++---- test/boot-stage-1.nix | 3 ++- test/boot-stage-2-init.sh | 3 +++ test/rescue-system.nix | 14 ++++++++++++-- 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index b9e2d1f4434..a2e958d91f6 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -1,5 +1,11 @@ #! @shell@ +fail() { + # If starting stage 2 failed, start an interactive shell. + echo "Stage 2 failed, starting emergency shell..." + exec @shell@ +} + # Print a greeting. echo echo "<<< NixOS Stage 1 >>>" @@ -31,10 +37,37 @@ modprobe ide-generic modprobe ide-disk modprobe ide-cd +# Try to find and mount the installation CD. + # Mount the installation CD. mkdir /mnt mkdir /mnt/cdrom -mount -o ro /dev/hdc /mnt/cdrom + +echo "probing for the NixOS installation CD..." + +for i in /sys/devices/*/*/media; do + if test "$(cat $i)" = "cdrom"; then + + # Hopefully `drivename' matches the device created in /dev. + devName=/dev/$(cat $(dirname $i)/drivename) + + echo " in $devName..." + + if mount -o ro -t iso9660 $devName /mnt/cdrom; then + if test -e "/mnt/cdrom/@cdromLabel@"; then + found=1 + break + fi + umount /mnt/cdrom + fi + + fi +done + +if test -z "$found"; then + echo "CD not found!" + fail +fi # Start stage 2. # !!! Note: we can't use pivot_root here (the kernel gods have @@ -46,6 +79,4 @@ umount /proc # cleanup umount /sys exec chroot . /init -# If starting stage 2 failed, start an interactive shell. -echo "Stage 2 failed, starting emergency shell..." -exec @shell@ +fail diff --git a/test/boot-stage-1.nix b/test/boot-stage-1.nix index 329ca513a95..0f714a6d599 100644 --- a/test/boot-stage-1.nix +++ b/test/boot-stage-1.nix @@ -6,12 +6,13 @@ { genericSubstituter, shell, staticTools , module_init_tools, extraUtils, modules +, cdromLabel ? "" }: genericSubstituter { src = ./boot-stage-1-init.sh; isExecutable = true; - inherit shell modules; + inherit shell modules cdromLabel; path = [ staticTools module_init_tools diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 8235715e09e..be54926aabc 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -106,6 +106,9 @@ export PATH=$PATH export MODULE_DIR=$MODULE_DIR EOF +# Set the host name. +hostname nixos + # Start an interactive shell. #exec @shell@ diff --git a/test/rescue-system.nix b/test/rescue-system.nix index 4e22ecb4d89..097ca084b29 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -20,6 +20,10 @@ rec { }; + # The label used to identify the installation CD. + cdromLabel = "NIXOS"; + + # Determine the set of modules that we need to mount the root FS. modulesClosure = import ./modules-closure.nix { inherit (pkgs) stdenv kernel module_init_tools; @@ -45,6 +49,7 @@ rec { inherit (pkgs) genericSubstituter; inherit (pkgsDiet) module_init_tools; inherit extraUtils; + inherit cdromLabel; modules = modulesClosure; shell = stdenvLinuxStuff.bootstrapTools.bash; staticTools = stdenvLinuxStuff.staticTools; @@ -110,8 +115,13 @@ 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; mkdir $out; cd $out; mkdir proc sys tmp etc dev var mnt nix nix/var"; + builder = builtins.toFile "builder.sh" " + source $stdenv/setup + mkdir $out + cd $out + mkdir proc sys tmp etc dev var mnt nix nix/var + touch $out/${cdromLabel} + "; }; -- GitLab From b60dd36c8fccc5d04497385b8ed6f336a396bb87 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 11 Nov 2006 17:59:08 +0000 Subject: [PATCH 0203/5331] * Set up the target file system, copy Nix, do a nix-pull in a chroot, and do a nix-env to install some packages. svn path=/nixu/trunk/; revision=6991 --- test/installer.sh | 68 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/test/installer.sh b/test/installer.sh index a823a2b76a4..1cf18c9f37a 100644 --- a/test/installer.sh +++ b/test/installer.sh @@ -34,8 +34,72 @@ mountPoint=/tmp/inst-mnt mkdir -p $mountPoint mount "$targetDevice" $mountPoint || exit 1 +mkdir -p $mountPoint/dev $mountPoint/proc $mountPoint/sys || exit 1 +mount --bind /dev $mountPoint/dev || exit 1 +mount --bind /proc $mountPoint/proc || exit 1 +mount --bind /sys $mountPoint/sys || exit 1 + +trap "umount $mountPoint/dev; umount $mountPoint/proc; umount $mountPoint/sys; umount $mountPoint" EXIT + +mkdir -p $mountPoint/tmp +mkdir -p $mountPoint/var + + +# Create the necessary Nix directories on the target device, if they +# don't already exist. +mkdir -p \ + $mountPoint/nix/store \ + $mountPoint/nix/var/nix/gcroots \ + $mountPoint/nix/var/nix/temproots \ + $mountPoint/nix/var/nix/manifests \ + $mountPoint/nix/var/nix/userpool \ + $mountPoint/nix/var/nix/profiles \ + $mountPoint/nix/var/nix/db \ + $mountPoint/nix/var/log/nix/drvs + # Copy Nix to the Nix store on the target device. -mkdir -p $mountPoint/nix/store/ -rsync -av $(cat @nixClosure@) $mountPoint/nix/store/ || exit 1 +echo "copying Nix to $targetDevice...." +for i in $(cat @nixClosure@); do + echo " $i" + rsync -a $i $mountPoint/nix/store/ || exit 1 +done + + +# Register the paths in the Nix closure as valid. This is necessary +# to prevent them from being deleted the first time we install +# something. (I.e., Nix will see that, e.g., the glibc path is not +# valid, delete it to get it out of the way, but as a result nothing +# will work anymore.) +for i in $(cat @nixClosure@); do + echo $i + echo # deriver + echo 0 # nr of references +done \ +| chroot $mountPoint @nix@/bin/nix-store --register-validity || exit 1 + + +# Create the required /bin/sh symlink; otherwise lots of things +# (notably the system() function) won't work. +mkdir -p $mountPoint/bin +ln -sf $(type -tp sh) $mountPoint/bin/sh + + +# Enable networking in the chroot. +mkdir -p $mountPoint/etc +cp /etc/resolv.conf $mountPoint/etc/ + + +# Do a nix-pull. +nixpkgsURL=http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre6984 +chroot $mountPoint @nix@/bin/nix-pull $nixpkgsURL/MANIFEST + + +# Install some packages. +rm -rf $mountPoint/scratch +mkdir $mountPoint/scratch +curl $nixpkgsURL/nixexprs.tar.bz2 | tar xj -C $mountPoint/scratch + +nixpkgsName=$(cd $mountPoint/scratch && ls) +chroot $mountPoint @nix@/bin/nix-env -f /scratch/$nixpkgsName -i aterm -- GitLab From b7e8c174a114656a959a7aa48245a5d1d29c6dba Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 11 Nov 2006 22:29:05 +0000 Subject: [PATCH 0204/5331] * Add Perl to the path (since it was already on the CD as a dependency). svn path=/nixu/trunk/; revision=6992 --- test/rescue-system.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/test/rescue-system.nix b/test/rescue-system.nix index 097ca084b29..b435d10f57f 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -105,6 +105,7 @@ rec { pkgs.shadowutils pkgs.sysklogd pkgs.rsync + pkgs.perl nixosInstaller ]; -- GitLab From afc05314c4cdbde8cf02853c336d31d91c2a07de Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 11 Nov 2006 22:31:26 +0000 Subject: [PATCH 0205/5331] * The installer now takes a user-specified Nix expression that will be built in the target Nix store and installed in the "system" user environment. Not quite sure what should go in there, but probably the kernel, initrd, the boot scripts and eventually the system services. Maybe grub as well. svn path=/nixu/trunk/; revision=6993 --- test/installer.sh | 56 +++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/test/installer.sh b/test/installer.sh index 1cf18c9f37a..359086a5238 100644 --- a/test/installer.sh +++ b/test/installer.sh @@ -13,33 +13,48 @@ # * run hook scripts provided by packages in the configuration? # - install/update grub +set -e + targetDevice="$1" +nixExpr="$2" -if test -z "$targetDevice"; then - echo "syntax: installer.sh " +if test -z "$targetDevice" -o -z "$nixExpr"; then + echo "syntax: installer.sh " exit 1 fi +nixExpr=$(readlink -f "$nixExpr") + # Make sure that the target device isn't mounted. -umount "$targetDevice" 2> /dev/null +umount "$targetDevice" 2> /dev/null || true # Check it. -fsck "$targetDevice" || exit 1 +fsck "$targetDevice" # Mount the target device. mountPoint=/tmp/inst-mnt mkdir -p $mountPoint -mount "$targetDevice" $mountPoint || exit 1 +mount "$targetDevice" $mountPoint + +mkdir -p $mountPoint/dev $mountPoint/proc $mountPoint/sys $mountPoint/mnt +mount --rbind / $mountPoint/mnt +mount --bind /dev $mountPoint/dev +mount --bind /proc $mountPoint/proc +mount --bind /sys $mountPoint/sys -mkdir -p $mountPoint/dev $mountPoint/proc $mountPoint/sys || exit 1 -mount --bind /dev $mountPoint/dev || exit 1 -mount --bind /proc $mountPoint/proc || exit 1 -mount --bind /sys $mountPoint/sys || exit 1 +cleanup() { + for i in $(grep -F "$mountPoint" /proc/mounts \ + | perl -e 'while (<>) { /^\S+\s+(\S+)\s+/; print "$1\n"; }' \ + | sort -r); + do + umount $i + done +} -trap "umount $mountPoint/dev; umount $mountPoint/proc; umount $mountPoint/sys; umount $mountPoint" EXIT +trap "cleanup" EXIT mkdir -p $mountPoint/tmp mkdir -p $mountPoint/var @@ -62,7 +77,7 @@ mkdir -p \ echo "copying Nix to $targetDevice...." for i in $(cat @nixClosure@); do echo " $i" - rsync -a $i $mountPoint/nix/store/ || exit 1 + rsync -a $i $mountPoint/nix/store/ done @@ -76,7 +91,7 @@ for i in $(cat @nixClosure@); do echo # deriver echo 0 # nr of references done \ -| chroot $mountPoint @nix@/bin/nix-store --register-validity || exit 1 +| chroot $mountPoint @nix@/bin/nix-store --register-validity # Create the required /bin/sh symlink; otherwise lots of things @@ -90,16 +105,19 @@ mkdir -p $mountPoint/etc cp /etc/resolv.conf $mountPoint/etc/ -# Do a nix-pull. +# Do a nix-pull to speed up building. nixpkgsURL=http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre6984 chroot $mountPoint @nix@/bin/nix-pull $nixpkgsURL/MANIFEST -# Install some packages. -rm -rf $mountPoint/scratch -mkdir $mountPoint/scratch -curl $nixpkgsURL/nixexprs.tar.bz2 | tar xj -C $mountPoint/scratch +# Build the specified Nix expression in the target store and install +# it into the system configuration profile. -nixpkgsName=$(cd $mountPoint/scratch && ls) +#rm -rf $mountPoint/scratch +#mkdir $mountPoint/scratch +#curl $nixpkgsURL/nixexprs.tar.bz2 | tar xj -C $mountPoint/scratch +#nixpkgsName=$(cd $mountPoint/scratch && ls) -chroot $mountPoint @nix@/bin/nix-env -f /scratch/$nixpkgsName -i aterm +chroot $mountPoint @nix@/bin/nix-env \ + -p /nix/var/nix/profiles/system \ + -f "/mnt/$nixExpr" -i '*' -- GitLab From 0785dfb9f8db82218c538d91052007583f1c6b20 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 12 Nov 2006 18:48:47 +0000 Subject: [PATCH 0206/5331] * Lots of refactoring; put the CD image generation in rescue-cd.nix. Support booting from something other than a CD. Add some parameters to specify the root device. svn path=/nixu/trunk/; revision=7000 --- test/boot-stage-1-init.sh | 57 +++++++++++++++++++++++------------ test/boot-stage-1.nix | 16 ++++++++-- test/rescue-cd.nix | 63 +++++++++++++++++++++++++++++++++++++++ test/rescue-system.nix | 57 ++++------------------------------- 4 files changed, 121 insertions(+), 72 deletions(-) create mode 100644 test/rescue-cd.nix diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index a2e958d91f6..1299599a94e 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -6,11 +6,13 @@ fail() { exec @shell@ } + # Print a greeting. echo echo "<<< NixOS Stage 1 >>>" echo + # Set the PATH. export PATH=/empty for i in @path@; do @@ -20,6 +22,7 @@ for i in @path@; do fi done + # Mount special file systems. mkdir /etc # to shut up mount touch /etc/fstab # idem @@ -28,52 +31,68 @@ mount -t proc none /proc mkdir /sys mount -t sysfs none /sys + # Create device nodes in /dev. source @makeDevices@ + # Load some kernel modules. export MODULE_DIR=@modules@/lib/modules/ modprobe ide-generic modprobe ide-disk modprobe ide-cd -# Try to find and mount the installation CD. -# Mount the installation CD. +# Try to find and mount the root device. mkdir /mnt -mkdir /mnt/cdrom +mkdir /mnt/root + +echo "mounting the root device..." + +if test -n "@autoDetectRootDevice@"; then -echo "probing for the NixOS installation CD..." + # Look for the root device by label. + echo "probing for the NixOS installation CD..." -for i in /sys/devices/*/*/media; do - if test "$(cat $i)" = "cdrom"; then + for i in /sys/devices/*/*/media; do + if test "$(cat $i)" = "cdrom"; then - # Hopefully `drivename' matches the device created in /dev. - devName=/dev/$(cat $(dirname $i)/drivename) + # Hopefully `drivename' matches the device created in /dev. + devName=/dev/$(cat $(dirname $i)/drivename) - echo " in $devName..." + echo " in $devName..." - if mount -o ro -t iso9660 $devName /mnt/cdrom; then - if test -e "/mnt/cdrom/@cdromLabel@"; then - found=1 - break + if mount -o ro -t iso9660 $devName /mnt/root; then + if test -e "/mnt/root/@rootLabel@"; then + found=1 + break + fi + umount /mnt/root fi - umount /mnt/cdrom - fi + fi + done + + if test -z "$found"; then + echo "CD not found!" + fail fi -done -if test -z "$found"; then - echo "CD not found!" +else + + # Hard-coded root device. + mount -o ro "@rootDevice@" /mnt/root + + # Testing. fail + fi # Start stage 2. # !!! Note: we can't use pivot_root here (the kernel gods have # decreed), but we could use run-init from klibc, which deletes all # files in the initramfs, remounts the target root on /, and chroots. -cd /mnt/cdrom +cd /mnt/root mount --move . / umount /proc # cleanup umount /sys diff --git a/test/boot-stage-1.nix b/test/boot-stage-1.nix index 0f714a6d599..bb52b3f8354 100644 --- a/test/boot-stage-1.nix +++ b/test/boot-stage-1.nix @@ -6,13 +6,25 @@ { genericSubstituter, shell, staticTools , module_init_tools, extraUtils, modules -, cdromLabel ? "" + +, # Whether to find root device automatically using its label. + autoDetectRootDevice + +, # If not scanning, the root must be specified explicitly. + rootDevice + + # If scanning, we need a disk label. +, rootLabel }: +assert !autoDetectRootDevice -> rootDevice != ""; +assert autoDetectRootDevice -> rootLabel != ""; + genericSubstituter { src = ./boot-stage-1-init.sh; isExecutable = true; - inherit shell modules cdromLabel; + inherit shell modules; + inherit autoDetectRootDevice rootDevice rootLabel; path = [ staticTools module_init_tools diff --git a/test/rescue-cd.nix b/test/rescue-cd.nix new file mode 100644 index 00000000000..defeeb48ece --- /dev/null +++ b/test/rescue-cd.nix @@ -0,0 +1,63 @@ +let + + # The label used to identify the installation CD. + cdromLabel = "NIXOS"; + +in + + # Build boot scripts for the CD that find the CD-ROM automatically. + with import ./rescue-system.nix { + autoDetectRootDevice = true; + rootLabel = cdromLabel; + }; + + +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 + mkdir $out + cd $out + mkdir proc sys tmp etc dev var mnt nix nix/var + touch $out/${cdromLabel} + "; + }; + + + # Create an ISO image containing the isolinux boot loader, the + # kernel, the initrd produced above, and the closure of the stage 2 + # init. + rescueCD = import ./make-iso9660-image.nix { + inherit (pkgs) stdenv cdrtools; + isoName = "nixos.iso"; + + contents = [ + { source = pkgs.syslinux + "/lib/syslinux/isolinux.bin"; + target = "isolinux/isolinux.bin"; + } + { source = ./isolinux.cfg; + target = "isolinux/isolinux.cfg"; + } + { source = pkgs.kernel + "/vmlinuz"; + target = "isolinux/vmlinuz"; + } + { source = initialRamdisk + "/initrd"; + target = "isolinux/initrd"; + } + { source = cdMountPoints; + target = "/"; + } + ]; + + init = bootStage2; + + bootable = true; + bootImage = "isolinux/isolinux.bin"; + }; + + +} diff --git a/test/rescue-system.nix b/test/rescue-system.nix index b435d10f57f..890e3cfdf82 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -1,4 +1,8 @@ -{system ? __currentSystem}: +{ system ? __currentSystem +, autoDetectRootDevice ? false +, rootDevice ? "" +, rootLabel ? "" +}: rec { @@ -20,10 +24,6 @@ rec { }; - # The label used to identify the installation CD. - cdromLabel = "NIXOS"; - - # Determine the set of modules that we need to mount the root FS. modulesClosure = import ./modules-closure.nix { inherit (pkgs) stdenv kernel module_init_tools; @@ -49,7 +49,7 @@ rec { inherit (pkgs) genericSubstituter; inherit (pkgsDiet) module_init_tools; inherit extraUtils; - inherit cdromLabel; + inherit autoDetectRootDevice rootDevice rootLabel; modules = modulesClosure; shell = stdenvLinuxStuff.bootstrapTools.bash; staticTools = stdenvLinuxStuff.staticTools; @@ -113,49 +113,4 @@ 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 - mkdir $out - cd $out - mkdir proc sys tmp etc dev var mnt nix nix/var - touch $out/${cdromLabel} - "; - }; - - - # Create an ISO image containing the isolinux boot loader, the - # kernel, the initrd produced above, and the closure of the stage 2 - # init. - rescueCD = import ./make-iso9660-image.nix { - inherit (pkgs) stdenv cdrtools; - isoName = "nixos.iso"; - - contents = [ - { source = pkgs.syslinux + "/lib/syslinux/isolinux.bin"; - target = "isolinux/isolinux.bin"; - } - { source = ./isolinux.cfg; - target = "isolinux/isolinux.cfg"; - } - { source = pkgs.kernel + "/vmlinuz"; - target = "isolinux/vmlinuz"; - } - { source = initialRamdisk + "/initrd"; - target = "isolinux/initrd"; - } - { source = cdMountPoints; - target = "/"; - } - ]; - - init = bootStage2; - - bootable = true; - bootImage = "isolinux/isolinux.bin"; - }; - - } -- GitLab From 0b26af2188736e73ec6e5f7d0eeacf34370812ba Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 12 Nov 2006 23:30:03 +0000 Subject: [PATCH 0207/5331] * The installer now installs a configuration on the target device that boots into stage 1 (kernel+initrd) succesfully. `system-configuration.nix' contains the definition of the configuration to be installed. The attribute systemConfiguration is installed into the profile /nix/var/nix/profiles/system. Then the program /nix/var/nix/profiles/system/bin/switch-to-configuration is called to finalise the installation. This program (generated by system-configuration.sh) installs Grub on the drive with a menu that contains the entry for the desired kernel and initrd. In principle this allows us to do rollbacks to previous system configurations by doing `nix-env --rollback' and then calling switch-to-configuration to update Grub. Ideally this should be done in a single command (and we should consider the obvious risk of garbage collecting the current kernel etc. to which the current Grub menu points...). Maybe the responsibility for generating the Grub menu should be placed somewhere else. For instance, we could generate a Grub menu automatically out of all the generations in the `system' profile. svn path=/nixu/trunk/; revision=7009 --- test/installer.sh | 17 ++++++++++++++--- test/make-initrd.nix | 4 ++-- test/make-initrd.sh | 2 +- test/rescue-cd.nix | 2 ++ test/rescue-system.nix | 2 +- test/system-configuration.nix | 32 ++++++++++++++++++++++++++++++++ test/system-configuration.sh | 29 +++++++++++++++++++++++++++++ 7 files changed, 81 insertions(+), 7 deletions(-) create mode 100644 test/system-configuration.nix create mode 100644 test/system-configuration.sh diff --git a/test/installer.sh b/test/installer.sh index 359086a5238..14b6e2a4aac 100644 --- a/test/installer.sh +++ b/test/installer.sh @@ -31,7 +31,7 @@ umount "$targetDevice" 2> /dev/null || true # Check it. -fsck "$targetDevice" +fsck -n "$targetDevice" # Mount the target device. @@ -107,7 +107,7 @@ cp /etc/resolv.conf $mountPoint/etc/ # Do a nix-pull to speed up building. nixpkgsURL=http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre6984 -chroot $mountPoint @nix@/bin/nix-pull $nixpkgsURL/MANIFEST +#chroot $mountPoint @nix@/bin/nix-pull $nixpkgsURL/MANIFEST # Build the specified Nix expression in the target store and install @@ -120,4 +120,15 @@ chroot $mountPoint @nix@/bin/nix-pull $nixpkgsURL/MANIFEST chroot $mountPoint @nix@/bin/nix-env \ -p /nix/var/nix/profiles/system \ - -f "/mnt/$nixExpr" -i '*' + -f "/mnt/$nixExpr" -i system-configuration + + +# Grub needs a mtab. +echo "$targetDevice / somefs rw 0 0" > $mountPoint/etc/mtab + + +# Switch to the new system configuration. This will install Grub with +# a menu default pointing at the kernel/initrd/etc of the new +# configuration. +echo "finalising the installation..." +chroot $mountPoint /nix/var/nix/profiles/system/bin/switch-to-configuration diff --git a/test/make-initrd.nix b/test/make-initrd.nix index f850e1cf657..91722b96602 100644 --- a/test/make-initrd.nix +++ b/test/make-initrd.nix @@ -10,11 +10,11 @@ # A symlink `/init' is made to the store path passed in the `init' # argument. -{stdenv, cpio, packages, init}: +{stdenv, cpio, packages, init, nix}: stdenv.mkDerivation { name = "initrd"; builder = ./make-initrd.sh; - buildInputs = [cpio]; + buildInputs = [cpio nix]; inherit packages init; } diff --git a/test/make-initrd.sh b/test/make-initrd.sh index 2620b90eec7..5da23533feb 100644 --- a/test/make-initrd.sh +++ b/test/make-initrd.sh @@ -6,7 +6,7 @@ set -o pipefail # way to get the closure is to call Nix, which is strictly speaking # forbidden. But we do it anyway. In time, we should add a feature # to Nix to let Nix pass closures to builders. -packagesClosure=$(/nix/bin/nix-store -qR $packages $init) +packagesClosure=$(nix-store -qR $packages $init) # Paths in cpio archives *must* be relative, otherwise the kernel # won't unpack 'em. diff --git a/test/rescue-cd.nix b/test/rescue-cd.nix index defeeb48ece..002288bea87 100644 --- a/test/rescue-cd.nix +++ b/test/rescue-cd.nix @@ -14,6 +14,8 @@ in rec { + inherit nixosInstaller; # !!! debug + # Since the CD is read-only, the mount points must be on disk. cdMountPoints = pkgs.stdenv.mkDerivation { diff --git a/test/rescue-system.nix b/test/rescue-system.nix index 890e3cfdf82..40ec535c6b1 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -59,7 +59,7 @@ rec { # The closure of the init script of boot stage 1 is what we put in # the initial RAM disk. initialRamdisk = import ./make-initrd.nix { - inherit (pkgs) stdenv cpio; + inherit (pkgs) stdenv cpio nix; packages = []; init = bootStage1; }; diff --git a/test/system-configuration.nix b/test/system-configuration.nix new file mode 100644 index 00000000000..ef04dc1badc --- /dev/null +++ b/test/system-configuration.nix @@ -0,0 +1,32 @@ +let + + # The root device. + rootDevice = "/dev/hda1"; + + # The device on which GRUB should be installed (leave empty if you + # don't want GRUB to be installed). + grubDevice = "/dev/hda"; + +in + + # Build boot scripts for the CD that find the CD-ROM automatically. + with import ./rescue-system.nix { + autoDetectRootDevice = false; + inherit rootDevice; + }; + + +rec { + + + systemConfiguration = pkgs.stdenv.mkDerivation { + name = "system-configuration"; + builder = ./system-configuration.sh; + inherit (pkgs) grub coreutils gnused gnugrep diffutils; + inherit grubDevice; + kernel = pkgs.kernel + "/vmlinuz"; + initrd = initialRamdisk + "/initrd"; + }; + + +} diff --git a/test/system-configuration.sh b/test/system-configuration.sh new file mode 100644 index 00000000000..17d58f4d0cb --- /dev/null +++ b/test/system-configuration.sh @@ -0,0 +1,29 @@ +source $stdenv/setup + +ensureDir $out + +ln -s $kernel $out/kernel +ln -s $grub $out/grub + +cat > $out/menu.lst << GRUBEND +# Automatically generated. DO NOT EDIT THIS FILE! +default=0 +timeout=5 +title NixOS + kernel $kernel selinux=0 apm=on acpi=on + initrd $initrd +GRUBEND + +ensureDir $out/bin + +cat > $out/bin/switch-to-configuration < Date: Mon, 13 Nov 2006 11:41:27 +0000 Subject: [PATCH 0208/5331] * Boot into a fully functional stage 2. * Stage 2 init: handle non-read-only roots. svn path=/nixu/trunk/; revision=7014 --- test/boot-stage-1-init.sh | 6 ++-- test/boot-stage-1.nix | 9 +++++ test/boot-stage-2-init.sh | 67 ++++++++++++++++++++++++++--------- test/boot-stage-2.nix | 7 ++-- test/installer.nix | 3 +- test/make-iso9660-image.nix | 4 +-- test/make-iso9660-image.sh | 2 +- test/rescue-cd.nix | 6 ++-- test/rescue-system.nix | 5 +++ test/system-configuration.nix | 12 ++++--- test/system-configuration.sh | 1 + 11 files changed, 90 insertions(+), 32 deletions(-) diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index 1299599a94e..3e93571ebda 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -83,9 +83,6 @@ else # Hard-coded root device. mount -o ro "@rootDevice@" /mnt/root - # Testing. - fail - fi # Start stage 2. @@ -96,6 +93,7 @@ cd /mnt/root mount --move . / umount /proc # cleanup umount /sys -exec chroot . /init + +exec chroot . @stage2Init@ fail diff --git a/test/boot-stage-1.nix b/test/boot-stage-1.nix index bb52b3f8354..ef1ebfc7225 100644 --- a/test/boot-stage-1.nix +++ b/test/boot-stage-1.nix @@ -15,6 +15,10 @@ # If scanning, we need a disk label. , rootLabel + +, # The path of the stage 2 init to call once we've mounted the root + # device. + stage2Init ? "/init" }: assert !autoDetectRootDevice -> rootDevice != ""; @@ -31,4 +35,9 @@ genericSubstituter { extraUtils ]; makeDevices = ./make-devices.sh; + + # We only want the path of the stage 2 init, we don't want it as a + # dependency (since then it the stage 2 init would end up in the + # initrd). + stage2Init = toString stage2Init; # !!! doesn't work } diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index be54926aabc..edf3e9c0dbf 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -2,11 +2,13 @@ # !!! copied from stage 1; remove duplication + # Print a greeting. echo echo "<<< NixOS Stage 2 >>>" echo + # Set the PATH. export PATH=/empty for i in @path@; do @@ -16,49 +18,70 @@ for i in @path@; do fi done -# Mount special file systems. -mount -t tmpfs none /etc -n # to shut up mount -touch /etc/fstab # idem + +# Mount special file systems, initialise required directories. + +if test -z "@readOnlyRoot@"; then + #rootDev=$(grep "/dev/.* / " /proc/mounts | sed 's/^\([^ ]*\) .*/\1/') + mount -o remount,rw /dontcare / # !!! check for failure +fi + +needWritableDir() { + if test -n "@readOnlyRoot@"; then + mount -t tmpfs none $1 $3 + chmod $2 $1 + else + mkdir -m $2 -p $1 + fi +} + +needWritableDir /etc 0755 -n # to shut up mount + +test -e /etc/fstab || touch /etc/fstab # idem + mount -t proc none /proc mount -t sysfs none /sys -mount -t tmpfs none /dev -mount -t tmpfs none /tmp -mount -t tmpfs none /var -mount -t tmpfs none /nix/var +needWritableDir /dev 0755 +needWritableDir /tmp 01777 +needWritableDir /var 0755 +needWritableDir /nix/var 0755 + +mkdir -m 0755 -p /nix/var/nix/db +mkdir -m 0755 -p /nix/var/nix/gcroots +mkdir -m 0755 -p /nix/var/nix/temproots -mkdir -p /nix/var/nix/db -mkdir -p /nix/var/nix/gcroots -mkdir -p /nix/var/nix/temproots # Ensure that the module tools can find the kernel modules. export MODULE_DIR=@kernel@/lib/modules/ -# Create device nodes in /dev. -#source @makeDevices@ # Start udev. udevd --daemon + # Let udev create device nodes for all modules that have already been # loaded into the kernel (or for which support is built into the # kernel). udevtrigger udevsettle # wait for udev to finish + # Start syslogd. -mkdir -p /var/run +mkdir -m 0755 -p /var/run #mkdir -p /var/log #touch /var/log/messages echo "*.* /dev/tty10" > /etc/syslog.conf echo "syslog 514/udp" > /etc/services # required, even if we don't use it @sysklogd@/sbin/syslogd & + # Try to load modules for all PCI devices. for i in /sys/bus/pci/devices/*/modalias; do echo "Trying to load a module for $(basename $(dirname $i))..." modprobe $(cat $i) done + # Bring up the network devices. modprobe af_packet for i in $(cd /sys/class/net && ls -d *); do @@ -71,18 +94,26 @@ for i in $(cd /sys/class/net && ls -d *); do fi done + # login/su absolutely need this. -touch /etc/login.defs +test -e /etc/login.defs || touch /etc/login.defs + # Enable a password-less root login. -echo "root::0:0:root:/:@shell@" > /etc/passwd -echo "root:*:0" > /etc/group +if ! test -e /etc/passwd; then + echo "root::0:0:root:/:@shell@" > /etc/passwd +fi +if ! test -e /etc/group; then + echo "root:*:0" > /etc/group +fi + # Set up inittab. for i in $(seq 1 6); do echo "$i:2345:respawn:@mingetty@/sbin/mingetty --noclear tty$i" >> /etc/inittab done + # Show a nice greeting on each terminal. cat > /etc/issue < $out"; + "source $stdenv/setup; nix-store -qR $nix > $out"; + buildInputs = [nix]; inherit nix; }; } diff --git a/test/make-iso9660-image.nix b/test/make-iso9660-image.nix index f08aac3abc5..861b229b8a4 100644 --- a/test/make-iso9660-image.nix +++ b/test/make-iso9660-image.nix @@ -1,4 +1,4 @@ -{ stdenv, cdrtools +{ stdenv, cdrtools, nix # The file name of the resulting ISO image. , isoName ? "cd.iso" @@ -31,7 +31,7 @@ assert bootable -> bootImage != ""; stdenv.mkDerivation { name = "iso9660-image"; builder = ./make-iso9660-image.sh; - buildInputs = [cdrtools]; + buildInputs = [cdrtools nix]; inherit isoName packages init bootable bootImage; sources = map ({source, target}: source) contents; targets = map ({source, target}: target) contents; diff --git a/test/make-iso9660-image.sh b/test/make-iso9660-image.sh index 17f44e78ff0..774fbb8a90e 100644 --- a/test/make-iso9660-image.sh +++ b/test/make-iso9660-image.sh @@ -13,7 +13,7 @@ done # !!! Just as with make-initrd.nix, the call to Nix here needs to be # fixed. -packagesClosure=$(/nix/bin/nix-store -qR $packages $init) +packagesClosure=$(nix-store -qR $packages $init) for i in $packagesClosure; do graftList="$graftList ${i:1}=$i" diff --git a/test/rescue-cd.nix b/test/rescue-cd.nix index 002288bea87..ddb6a7cb677 100644 --- a/test/rescue-cd.nix +++ b/test/rescue-cd.nix @@ -9,12 +9,14 @@ in with import ./rescue-system.nix { autoDetectRootDevice = true; rootLabel = cdromLabel; + stage2Init = "/init"; + readOnlyRoot = true; }; rec { - inherit nixosInstaller; # !!! debug + inherit nixosInstaller bootStage1; # !!! debug # Since the CD is read-only, the mount points must be on disk. @@ -34,7 +36,7 @@ rec { # kernel, the initrd produced above, and the closure of the stage 2 # init. rescueCD = import ./make-iso9660-image.nix { - inherit (pkgs) stdenv cdrtools; + inherit (pkgs) stdenv cdrtools nix; isoName = "nixos.iso"; contents = [ diff --git a/test/rescue-system.nix b/test/rescue-system.nix index 40ec535c6b1..b2050fb14ae 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -2,6 +2,8 @@ , autoDetectRootDevice ? false , rootDevice ? "" , rootLabel ? "" +, stage2Init +, readOnlyRoot }: rec { @@ -50,6 +52,7 @@ rec { inherit (pkgsDiet) module_init_tools; inherit extraUtils; inherit autoDetectRootDevice rootDevice rootLabel; + inherit stage2Init; modules = modulesClosure; shell = stdenvLinuxStuff.bootstrapTools.bash; staticTools = stdenvLinuxStuff.staticTools; @@ -110,6 +113,8 @@ rec { ]; mingetty = pkgs.mingettyWrapper; + + inherit readOnlyRoot; }; diff --git a/test/system-configuration.nix b/test/system-configuration.nix index ef04dc1badc..531dc0d5cb8 100644 --- a/test/system-configuration.nix +++ b/test/system-configuration.nix @@ -7,14 +7,17 @@ let # don't want GRUB to be installed). grubDevice = "/dev/hda"; -in - - # Build boot scripts for the CD that find the CD-ROM automatically. - with import ./rescue-system.nix { + # Build boot scripts. + bootEnv = import ./rescue-system.nix { autoDetectRootDevice = false; inherit rootDevice; + stage2Init = "/init"; # !!! should be bootEnv.bootStage2; + readOnlyRoot = false; }; +in + +with bootEnv; rec { @@ -24,6 +27,7 @@ rec { builder = ./system-configuration.sh; inherit (pkgs) grub coreutils gnused gnugrep diffutils; inherit grubDevice; + inherit bootStage2; kernel = pkgs.kernel + "/vmlinuz"; initrd = initialRamdisk + "/initrd"; }; diff --git a/test/system-configuration.sh b/test/system-configuration.sh index 17d58f4d0cb..d35811a84da 100644 --- a/test/system-configuration.sh +++ b/test/system-configuration.sh @@ -23,6 +23,7 @@ export PATH=$coreutils/bin:$gnused/bin:$gnugrep/bin:$diffutils/bin if test -n "$grubDevice"; then $grub/sbin/grub-install "$grubDevice" --no-floppy --recheck cp -f $out/menu.lst /boot/grub/menu.lst + ln -sf $bootStage2 /init # !!! fix? fi EOF -- GitLab From f9d0c57385a86c909e1b139eaec35beb935eb547 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 13 Nov 2006 11:42:23 +0000 Subject: [PATCH 0209/5331] * Set permissions explicitly. svn path=/nixu/trunk/; revision=7015 --- test/installer.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/installer.sh b/test/installer.sh index 14b6e2a4aac..c5dcecf2064 100644 --- a/test/installer.sh +++ b/test/installer.sh @@ -39,7 +39,7 @@ mountPoint=/tmp/inst-mnt mkdir -p $mountPoint mount "$targetDevice" $mountPoint -mkdir -p $mountPoint/dev $mountPoint/proc $mountPoint/sys $mountPoint/mnt +mkdir -m 0755 -p $mountPoint/dev $mountPoint/proc $mountPoint/sys $mountPoint/mnt mount --rbind / $mountPoint/mnt mount --bind /dev $mountPoint/dev mount --bind /proc $mountPoint/proc @@ -56,13 +56,13 @@ cleanup() { trap "cleanup" EXIT -mkdir -p $mountPoint/tmp -mkdir -p $mountPoint/var +mkdir -m 01777 -p $mountPoint/tmp +mkdir -m 0755 -p $mountPoint/var # Create the necessary Nix directories on the target device, if they # don't already exist. -mkdir -p \ +mkdir -m 0755 -p \ $mountPoint/nix/store \ $mountPoint/nix/var/nix/gcroots \ $mountPoint/nix/var/nix/temproots \ @@ -96,18 +96,18 @@ done \ # Create the required /bin/sh symlink; otherwise lots of things # (notably the system() function) won't work. -mkdir -p $mountPoint/bin +mkdir -m 0755 -p $mountPoint/bin ln -sf $(type -tp sh) $mountPoint/bin/sh # Enable networking in the chroot. -mkdir -p $mountPoint/etc +mkdir -m 0755 -p $mountPoint/etc cp /etc/resolv.conf $mountPoint/etc/ # Do a nix-pull to speed up building. nixpkgsURL=http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre6984 -#chroot $mountPoint @nix@/bin/nix-pull $nixpkgsURL/MANIFEST +chroot $mountPoint @nix@/bin/nix-pull $nixpkgsURL/MANIFEST # Build the specified Nix expression in the target store and install -- GitLab From 91a66e72dc2f215928691c46cb1e810dc19dd61f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 13 Nov 2006 16:19:57 +0000 Subject: [PATCH 0210/5331] * rescue-system -> boot-environment. svn path=/nixu/trunk/; revision=7017 --- test/{rescue-system.nix => boot-environment.nix} | 0 test/rescue-cd.nix | 2 +- test/system-configuration.nix | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename test/{rescue-system.nix => boot-environment.nix} (100%) diff --git a/test/rescue-system.nix b/test/boot-environment.nix similarity index 100% rename from test/rescue-system.nix rename to test/boot-environment.nix diff --git a/test/rescue-cd.nix b/test/rescue-cd.nix index ddb6a7cb677..70c44ca2382 100644 --- a/test/rescue-cd.nix +++ b/test/rescue-cd.nix @@ -6,7 +6,7 @@ let in # Build boot scripts for the CD that find the CD-ROM automatically. - with import ./rescue-system.nix { + with import ./boot-environment.nix { autoDetectRootDevice = true; rootLabel = cdromLabel; stage2Init = "/init"; diff --git a/test/system-configuration.nix b/test/system-configuration.nix index 531dc0d5cb8..a1c90813e6b 100644 --- a/test/system-configuration.nix +++ b/test/system-configuration.nix @@ -8,7 +8,7 @@ let grubDevice = "/dev/hda"; # Build boot scripts. - bootEnv = import ./rescue-system.nix { + bootEnv = import ./boot-environment.nix { autoDetectRootDevice = false; inherit rootDevice; stage2Init = "/init"; # !!! should be bootEnv.bootStage2; -- GitLab From 82ce465751df40ce7f68d41dc9c196dfcade620d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 13 Nov 2006 19:01:39 +0000 Subject: [PATCH 0211/5331] * Use `exportReferencesGraph' to register the references of the initial Nix installation correctly. svn path=/nixu/trunk/; revision=7021 --- test/installer.nix | 15 ++++++++++----- test/installer.sh | 21 ++++++++++++++------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/test/installer.nix b/test/installer.nix index 4b3ec85939c..2f8963a443b 100644 --- a/test/installer.nix +++ b/test/installer.nix @@ -6,12 +6,17 @@ genericSubstituter { dir = "bin"; isExecutable = true; inherit shell nix; - + nixClosure = stdenv.mkDerivation { name = "closure"; - builder = builtins.toFile "builder.sh" - "source $stdenv/setup; nix-store -qR $nix > $out"; - buildInputs = [nix]; - inherit nix; + exportReferencesGraph = ["refs" nix]; + builder = builtins.toFile "builder.sh" " + source $stdenv/setup + if ! test -e refs; then + echo 'Your Nix installation is too old!' + exit 1 + fi + cp refs $out + "; }; } diff --git a/test/installer.sh b/test/installer.sh index c5dcecf2064..4abad8e3840 100644 --- a/test/installer.sh +++ b/test/installer.sh @@ -73,9 +73,21 @@ mkdir -m 0755 -p \ $mountPoint/nix/var/log/nix/drvs +# Get the store paths to copy from the references graph. +storePaths="" +while read storePath; do + storePaths="$storePaths $storePath" + read deriver + read count + for ((i = 0; i < $count; i++)); do + read ref + done +done < @nixClosure@ + + # Copy Nix to the Nix store on the target device. echo "copying Nix to $targetDevice...." -for i in $(cat @nixClosure@); do +for i in $storePaths; do echo " $i" rsync -a $i $mountPoint/nix/store/ done @@ -86,12 +98,7 @@ done # something. (I.e., Nix will see that, e.g., the glibc path is not # valid, delete it to get it out of the way, but as a result nothing # will work anymore.) -for i in $(cat @nixClosure@); do - echo $i - echo # deriver - echo 0 # nr of references -done \ -| chroot $mountPoint @nix@/bin/nix-store --register-validity +chroot $mountPoint @nix@/bin/nix-store --register-validity < @nixClosure@ # Create the required /bin/sh symlink; otherwise lots of things -- GitLab From 78b2ed263ea9739f2813f62fa2e0a8fd93f91803 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 17 Nov 2006 14:13:21 +0000 Subject: [PATCH 0212/5331] * Use exportReferencesGraph everywhere. svn path=/nixu/trunk/; revision=7063 --- test/boot-environment.nix | 6 +++--- test/installer.nix | 11 +++-------- test/installer.sh | 11 +---------- test/make-initrd.nix | 23 ++++++++++++++--------- test/make-initrd.sh | 13 +++++++------ test/make-iso9660-image.nix | 12 +++++++++--- test/make-iso9660-image.sh | 6 ++---- test/paths-from-graph.sh | 10 ++++++++++ test/rescue-cd.nix | 2 +- 9 files changed, 50 insertions(+), 44 deletions(-) create mode 100644 test/paths-from-graph.sh diff --git a/test/boot-environment.nix b/test/boot-environment.nix index b2050fb14ae..2dc1445e9f9 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -62,15 +62,15 @@ rec { # The closure of the init script of boot stage 1 is what we put in # the initial RAM disk. initialRamdisk = import ./make-initrd.nix { - inherit (pkgs) stdenv cpio nix; - packages = []; + inherit (pkgs) stdenv cpio; init = bootStage1; }; # The installer. nixosInstaller = import ./installer.nix { - inherit (pkgs) stdenv genericSubstituter nix; + inherit (pkgs) stdenv genericSubstituter; + nix = pkgs.nixUnstable; # needs the exportReferencesGraph feature shell = pkgs.bash + "/bin/sh"; }; diff --git a/test/installer.nix b/test/installer.nix index 2f8963a443b..44080b86a85 100644 --- a/test/installer.nix +++ b/test/installer.nix @@ -7,16 +7,11 @@ genericSubstituter { isExecutable = true; inherit shell nix; + pathsFromGraph = ./paths-from-graph.sh; + nixClosure = stdenv.mkDerivation { name = "closure"; exportReferencesGraph = ["refs" nix]; - builder = builtins.toFile "builder.sh" " - source $stdenv/setup - if ! test -e refs; then - echo 'Your Nix installation is too old!' - exit 1 - fi - cp refs $out - "; + builder = builtins.toFile "builder.sh" "source $stdenv/setup; cp refs $out"; }; } diff --git a/test/installer.sh b/test/installer.sh index 4abad8e3840..be20b3095b8 100644 --- a/test/installer.sh +++ b/test/installer.sh @@ -74,16 +74,7 @@ mkdir -m 0755 -p \ # Get the store paths to copy from the references graph. -storePaths="" -while read storePath; do - storePaths="$storePaths $storePath" - read deriver - read count - for ((i = 0; i < $count; i++)); do - read ref - done -done < @nixClosure@ - +storePaths=$(@shell@ @pathsFromGraph@ @nixClosure@) # Copy Nix to the Nix store on the target device. echo "copying Nix to $targetDevice...." diff --git a/test/make-initrd.nix b/test/make-initrd.nix index 91722b96602..2fb52f121fb 100644 --- a/test/make-initrd.nix +++ b/test/make-initrd.nix @@ -1,20 +1,25 @@ -# Create an initial ramdisk containing the specified set of packages. -# An initial ramdisk is used during the initial stages of booting a -# Linux system. It is loaded by the boot loader along with the kernel -# image. It's supposed to contain everything (such as kernel modules) -# necessary to allow us to mount the root file system. Once the root -# file system is mounted, the `real' boot script can be called. +# Create an initial ramdisk containing the closure of the specified +# `init' package. An initial ramdisk is used during the initial +# stages of booting a Linux system. It is loaded by the boot loader +# along with the kernel image. It's supposed to contain everything +# (such as kernel modules) necessary to allow us to mount the root +# file system. Once the root file system is mounted, the `real' boot +# script can be called. # # An initrd is really just a gzipped cpio archive. # # A symlink `/init' is made to the store path passed in the `init' # argument. -{stdenv, cpio, packages, init, nix}: +{stdenv, cpio, init}: stdenv.mkDerivation { name = "initrd"; builder = ./make-initrd.sh; - buildInputs = [cpio nix]; - inherit packages init; + buildInputs = [cpio]; + inherit init; + + # For obtaining the closure of `init'. + exportReferencesGraph = ["init-closure" init]; + pathsFromGraph = ./paths-from-graph.sh; } diff --git a/test/make-initrd.sh b/test/make-initrd.sh index 5da23533feb..ea2ca5819a6 100644 --- a/test/make-initrd.sh +++ b/test/make-initrd.sh @@ -2,17 +2,18 @@ source $stdenv/setup set -o pipefail -# Get the paths in the closure of `packages'. Unfortunately, the only -# way to get the closure is to call Nix, which is strictly speaking -# forbidden. But we do it anyway. In time, we should add a feature -# to Nix to let Nix pass closures to builders. -packagesClosure=$(nix-store -qR $packages $init) +# Get the paths in the closure of `init'. +if ! test -e ./init-closure; then + echo 'Your Nix installation is too old! Upgrade to nix-0.11pre7038 or newer.' + exit 1 +fi +storePaths=$($SHELL $pathsFromGraph ./init-closure) # Paths in cpio archives *must* be relative, otherwise the kernel # won't unpack 'em. mkdir root cd root -cp -prd --parents $packagesClosure . +cp -prd --parents $storePaths . # Put the closure in a gzipped cpio archive. ensureDir $out diff --git a/test/make-iso9660-image.nix b/test/make-iso9660-image.nix index 861b229b8a4..e98de8ffcb4 100644 --- a/test/make-iso9660-image.nix +++ b/test/make-iso9660-image.nix @@ -1,4 +1,4 @@ -{ stdenv, cdrtools, nix +{ stdenv, cdrtools # The file name of the resulting ISO image. , isoName ? "cd.iso" @@ -9,9 +9,11 @@ # grafted in the file system at path `target'. contents +/* , # In addition to `contents', the closure of the store paths listed # in `packages' are also placed in the file system. packages ? [] +*/ , # `init' should be a store path, the closure of which is added to # the image, just like `packages'. However, in addition, a symlink @@ -31,8 +33,12 @@ assert bootable -> bootImage != ""; stdenv.mkDerivation { name = "iso9660-image"; builder = ./make-iso9660-image.sh; - buildInputs = [cdrtools nix]; - inherit isoName packages init bootable bootImage; + buildInputs = [cdrtools]; + inherit isoName init bootable bootImage; sources = map ({source, target}: source) contents; targets = map ({source, target}: target) contents; + + # For obtaining the closure of `init'. + exportReferencesGraph = ["init-closure" init]; + pathsFromGraph = ./paths-from-graph.sh; } diff --git a/test/make-iso9660-image.sh b/test/make-iso9660-image.sh index 774fbb8a90e..9a8bef7416d 100644 --- a/test/make-iso9660-image.sh +++ b/test/make-iso9660-image.sh @@ -11,11 +11,9 @@ for ((i = 0; i < ${#targets_[@]}; i++)); do graftList="$graftList ${targets_[$i]}=$(readlink -f ${sources_[$i]})" done -# !!! Just as with make-initrd.nix, the call to Nix here needs to be -# fixed. -packagesClosure=$(nix-store -qR $packages $init) +storePaths=$($SHELL $pathsFromGraph ./init-closure) -for i in $packagesClosure; do +for i in $storePaths; do graftList="$graftList ${i:1}=$i" done diff --git a/test/paths-from-graph.sh b/test/paths-from-graph.sh new file mode 100644 index 00000000000..4a134cb3165 --- /dev/null +++ b/test/paths-from-graph.sh @@ -0,0 +1,10 @@ +graph="$1" + +while read storePath; do + echo $storePath + read deriver + read count + for ((i = 0; i < $count; i++)); do + read ref + done +done < $graph diff --git a/test/rescue-cd.nix b/test/rescue-cd.nix index 70c44ca2382..da9e4cd3f3b 100644 --- a/test/rescue-cd.nix +++ b/test/rescue-cd.nix @@ -36,7 +36,7 @@ rec { # kernel, the initrd produced above, and the closure of the stage 2 # init. rescueCD = import ./make-iso9660-image.nix { - inherit (pkgs) stdenv cdrtools nix; + inherit (pkgs) stdenv cdrtools; isoName = "nixos.iso"; contents = [ -- GitLab From 6ae45d46eda3d45d8118666fd57eac01ad48aad8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 17 Nov 2006 15:27:31 +0000 Subject: [PATCH 0213/5331] * Put Nixpkgs and the NixOS expressions on the installation CD (the installer needs them). svn path=/nixu/trunk/; revision=7065 --- test/boot-environment.nix | 10 +++++----- test/boot-stage-2-init.sh | 1 + test/rescue-cd.nix | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/test/boot-environment.nix b/test/boot-environment.nix index 2dc1445e9f9..59fe96634e6 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -100,15 +100,15 @@ rec { pkgs.less pkgs.nano pkgs.netcat -# pkgs.vim pkgs.nix - pkgs.strace - pkgs.sysvinit + pkgs.perl pkgs.procps + pkgs.rsync pkgs.shadowutils + pkgs.strace pkgs.sysklogd - pkgs.rsync - pkgs.perl + pkgs.sysvinit +# pkgs.vim nixosInstaller ]; diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index edf3e9c0dbf..164c19dcf2b 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -79,6 +79,7 @@ echo "syslog 514/udp" > /etc/services # required, even if we don't use it for i in /sys/bus/pci/devices/*/modalias; do echo "Trying to load a module for $(basename $(dirname $i))..." modprobe $(cat $i) + echo "" done diff --git a/test/rescue-cd.nix b/test/rescue-cd.nix index da9e4cd3f3b..d045a903ff9 100644 --- a/test/rescue-cd.nix +++ b/test/rescue-cd.nix @@ -24,7 +24,7 @@ rec { name = "mount-points"; builder = builtins.toFile "builder.sh" " source $stdenv/setup - mkdir $out + ensureDir $out cd $out mkdir proc sys tmp etc dev var mnt nix nix/var touch $out/${cdromLabel} @@ -32,6 +32,34 @@ rec { }; + # 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') + "; + }; + + + # Put the current directory in the tarball. !!! This gives us a lot + # of crap (like .svn if this is a working copy). An "svn export" + # would be better, but that's impure. + nixosTarball = makeTarball "nixos.tar.bz2" ./.; + + + nixpkgsTarball = pkgs.fetchurl { + url = http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre7060/nixpkgs-0.11pre7060.tar.bz2; + md5 = "67163e7a71f7b8cb01461e1d0467a6e1"; + }; + + # Create an ISO image containing the isolinux boot loader, the # kernel, the initrd produced above, and the closure of the stage 2 # init. @@ -55,6 +83,12 @@ rec { { source = cdMountPoints; target = "/"; } + { source = nixosTarball + "/" + nixosTarball.tarName; + target = "/" + nixosTarball.tarName; + } + { source = nixpkgsTarball; + target = "/nixpkgs.tar.bz2"; + } ]; init = bootStage2; -- GitLab From e1e386cba607f5b9a88b6eee45206e63bb5bb2a1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 17 Nov 2006 16:29:31 +0000 Subject: [PATCH 0214/5331] * Clear the inittab. svn path=/nixu/trunk/; revision=7066 --- test/boot-stage-2-init.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 164c19dcf2b..6bfff35f224 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -110,6 +110,7 @@ fi # Set up inittab. +echo -n > /etc/inittab for i in $(seq 1 6); do echo "$i:2345:respawn:@mingetty@/sbin/mingetty --noclear tty$i" >> /etc/inittab done -- GitLab From 4798d7a4d22843b060f197eb8fadc54bc327d618 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 17 Nov 2006 16:38:24 +0000 Subject: [PATCH 0215/5331] * Use the same Nix consistently. svn path=/nixu/trunk/; revision=7067 --- test/boot-environment.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/boot-environment.nix b/test/boot-environment.nix index 59fe96634e6..04434f69894 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -25,6 +25,8 @@ rec { allPackages = import ./pkgs/top-level/all-packages.nix; }; + nix = pkgs.nixUnstable; # we need the exportReferencesGraph feature + # Determine the set of modules that we need to mount the root FS. modulesClosure = import ./modules-closure.nix { @@ -70,7 +72,8 @@ rec { # The installer. nixosInstaller = import ./installer.nix { inherit (pkgs) stdenv genericSubstituter; - nix = pkgs.nixUnstable; # needs the exportReferencesGraph feature + inherit nix; + nix = pkgs.nixUnstable; shell = pkgs.bash + "/bin/sh"; }; @@ -100,7 +103,6 @@ rec { pkgs.less pkgs.nano pkgs.netcat - pkgs.nix pkgs.perl pkgs.procps pkgs.rsync @@ -109,6 +111,7 @@ rec { pkgs.sysklogd pkgs.sysvinit # pkgs.vim + nix nixosInstaller ]; -- GitLab From 29d9b88aa9a5d8b56e05893dd6bbcb78b6387d8e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 17 Nov 2006 16:41:02 +0000 Subject: [PATCH 0216/5331] * Doh. svn path=/nixu/trunk/; revision=7068 --- test/boot-environment.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/test/boot-environment.nix b/test/boot-environment.nix index 04434f69894..6b250b33585 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -73,7 +73,6 @@ rec { nixosInstaller = import ./installer.nix { inherit (pkgs) stdenv genericSubstituter; inherit nix; - nix = pkgs.nixUnstable; shell = pkgs.bash + "/bin/sh"; }; -- GitLab From d191615e96a342f3ca9871cd3a2418b46f306553 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 19 Nov 2006 18:16:29 +0000 Subject: [PATCH 0217/5331] * Use Upstart instead of sysvinit. svn path=/nixu/trunk/; revision=7074 --- test/boot-environment.nix | 4 ++-- test/boot-stage-2-init.sh | 22 ++++++++++++++++------ test/boot-stage-2.nix | 5 +++-- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/test/boot-environment.nix b/test/boot-environment.nix index 6b250b33585..4d4d98a0ed5 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -82,7 +82,7 @@ rec { bootStage2 = import ./boot-stage-2.nix { inherit (pkgs) genericSubstituter coreutils findutils utillinux kernel sysklogd udev module_init_tools - nettools; + nettools upstart; shell = pkgs.bash + "/bin/sh"; dhcp = pkgs.dhcpWrapper; @@ -108,7 +108,7 @@ rec { pkgs.shadowutils pkgs.strace pkgs.sysklogd - pkgs.sysvinit +# pkgs.sysvinit # pkgs.vim nix nixosInstaller diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 6bfff35f224..a80ee2aaa59 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -50,6 +50,8 @@ mkdir -m 0755 -p /nix/var/nix/db mkdir -m 0755 -p /nix/var/nix/gcroots mkdir -m 0755 -p /nix/var/nix/temproots +mkdir -m 0755 -p /var/log + # Ensure that the module tools can find the kernel modules. export MODULE_DIR=@kernel@/lib/modules/ @@ -109,10 +111,18 @@ if ! test -e /etc/group; then fi -# Set up inittab. -echo -n > /etc/inittab +# Set up the Upstart jobs. +export UPSTART_CFG_DIR=/etc/event.d +mkdir -p $UPSTART_CFG_DIR + +cp -f @upstart@/etc/event.d/logd $UPSTART_CFG_DIR/logd + for i in $(seq 1 6); do - echo "$i:2345:respawn:@mingetty@/sbin/mingetty --noclear tty$i" >> /etc/inittab + cat > $UPSTART_CFG_DIR/tty$i < Date: Sun, 19 Nov 2006 20:07:45 +0000 Subject: [PATCH 0218/5331] * Nixify the Upstart jobs. svn path=/nixu/trunk/; revision=7075 --- test/boot-environment.nix | 31 ++++++++++++++++++++++++++++--- test/boot-stage-2-init.sh | 18 +++--------------- test/boot-stage-2.nix | 7 +++++-- test/rescue-cd.nix | 2 +- test/upstart-jobs/gather.nix | 19 +++++++++++++++++++ test/upstart-jobs/mingetty.nix | 8 ++++++++ test/upstart-jobs/mingetty.sh | 3 +++ test/upstart-jobs/syslogd.nix | 8 ++++++++ test/upstart-jobs/syslogd.sh | 3 +++ 9 files changed, 78 insertions(+), 21 deletions(-) create mode 100644 test/upstart-jobs/gather.nix create mode 100644 test/upstart-jobs/mingetty.nix create mode 100644 test/upstart-jobs/mingetty.sh create mode 100644 test/upstart-jobs/syslogd.nix create mode 100644 test/upstart-jobs/syslogd.sh diff --git a/test/boot-environment.nix b/test/boot-environment.nix index 4d4d98a0ed5..281a6318af0 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -77,12 +77,39 @@ rec { }; + # The services (Upstart) configuration for the system. + upstartJobs = import ./upstart-jobs/gather.nix { + inherit (pkgs) stdenv; + + jobs = [ + # For the builtin logd job. + pkgs.upstart + + # The terminals on ttyX. + (map + (ttyNumber: import ./upstart-jobs/mingetty.nix { + inherit (pkgs) genericSubstituter; + mingetty = pkgs.mingettyWrapper; + inherit ttyNumber; + }) + [1 2 3 4 5 6] + ) + + # Syslogd. + (import ./upstart-jobs/syslogd.nix { + inherit (pkgs) genericSubstituter sysklogd; + }) + ]; + }; + + # The init script of boot stage 2, which is supposed to do # everything else to bring up the system. bootStage2 = import ./boot-stage-2.nix { inherit (pkgs) genericSubstituter coreutils findutils - utillinux kernel sysklogd udev module_init_tools + utillinux kernel udev module_init_tools nettools upstart; + inherit upstartJobs; shell = pkgs.bash + "/bin/sh"; dhcp = pkgs.dhcpWrapper; @@ -114,8 +141,6 @@ rec { nixosInstaller ]; - mingetty = pkgs.mingettyWrapper; - inherit readOnlyRoot; }; diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index a80ee2aaa59..5f68fea82cd 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -68,13 +68,10 @@ udevtrigger udevsettle # wait for udev to finish -# Start syslogd. +# Necessary configuration for syslogd. mkdir -m 0755 -p /var/run -#mkdir -p /var/log -#touch /var/log/messages echo "*.* /dev/tty10" > /etc/syslog.conf echo "syslog 514/udp" > /etc/services # required, even if we don't use it -@sysklogd@/sbin/syslogd & # Try to load modules for all PCI devices. @@ -113,17 +110,8 @@ fi # Set up the Upstart jobs. export UPSTART_CFG_DIR=/etc/event.d -mkdir -p $UPSTART_CFG_DIR -cp -f @upstart@/etc/event.d/logd $UPSTART_CFG_DIR/logd - -for i in $(seq 1 6); do - cat > $UPSTART_CFG_DIR/tty$i < Date: Sun, 19 Nov 2006 21:03:22 +0000 Subject: [PATCH 0219/5331] * Simplification. svn path=/nixu/trunk/; revision=7076 --- test/boot-environment.nix | 36 +++++++++++++++++++--------------- test/upstart-jobs/make-job.nix | 7 +++++++ test/upstart-jobs/mingetty.nix | 12 +++++++----- test/upstart-jobs/mingetty.sh | 3 --- test/upstart-jobs/syslogd.nix | 12 +++++++----- test/upstart-jobs/syslogd.sh | 3 --- 6 files changed, 41 insertions(+), 32 deletions(-) create mode 100644 test/upstart-jobs/make-job.nix delete mode 100644 test/upstart-jobs/mingetty.sh delete mode 100644 test/upstart-jobs/syslogd.sh diff --git a/test/boot-environment.nix b/test/boot-environment.nix index 281a6318af0..dcf29322139 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -81,25 +81,29 @@ rec { upstartJobs = import ./upstart-jobs/gather.nix { inherit (pkgs) stdenv; - jobs = [ - # For the builtin logd job. - pkgs.upstart - - # The terminals on ttyX. - (map - (ttyNumber: import ./upstart-jobs/mingetty.nix { - inherit (pkgs) genericSubstituter; - mingetty = pkgs.mingettyWrapper; - inherit ttyNumber; - }) - [1 2 3 4 5 6] - ) - + jobs = map makeJob [ # Syslogd. (import ./upstart-jobs/syslogd.nix { - inherit (pkgs) genericSubstituter sysklogd; + inherit (pkgs) sysklogd; }) - ]; + ] + + # The terminals on ttyX. + ++ (map + (ttyNumber: makeJob (import ./upstart-jobs/mingetty.nix { + mingetty = pkgs.mingettyWrapper; + inherit ttyNumber; + })) + [1 2 3 4 5 6] + ) + + # For the builtin logd job. + ++ [pkgs.upstart]; + }; + + + makeJob = import ./upstart-jobs/make-job.nix { + inherit (pkgs) stdenv; }; diff --git a/test/upstart-jobs/make-job.nix b/test/upstart-jobs/make-job.nix new file mode 100644 index 00000000000..3995a8f21aa --- /dev/null +++ b/test/upstart-jobs/make-job.nix @@ -0,0 +1,7 @@ +{stdenv}: 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"; +} diff --git a/test/upstart-jobs/mingetty.nix b/test/upstart-jobs/mingetty.nix index 0a38bc66e6a..cdce937535c 100644 --- a/test/upstart-jobs/mingetty.nix +++ b/test/upstart-jobs/mingetty.nix @@ -1,8 +1,10 @@ -{genericSubstituter, mingetty, ttyNumber}: +{mingetty, ttyNumber}: -genericSubstituter { - src = ./mingetty.sh; - dir = "etc/event.d"; +{ name = "tty" + toString ttyNumber; - inherit mingetty ttyNumber; + job = " + start on startup + stop on shutdown + respawn ${mingetty}/sbin/mingetty --noclear tty${toString ttyNumber} + "; } diff --git a/test/upstart-jobs/mingetty.sh b/test/upstart-jobs/mingetty.sh deleted file mode 100644 index f1eab56510c..00000000000 --- a/test/upstart-jobs/mingetty.sh +++ /dev/null @@ -1,3 +0,0 @@ -start on startup -stop on shutdown -respawn @mingetty@/sbin/mingetty --noclear tty@ttyNumber@ diff --git a/test/upstart-jobs/syslogd.nix b/test/upstart-jobs/syslogd.nix index fddcea6692f..8f326b0d6cf 100644 --- a/test/upstart-jobs/syslogd.nix +++ b/test/upstart-jobs/syslogd.nix @@ -1,8 +1,10 @@ -{genericSubstituter, sysklogd}: +{sysklogd}: -genericSubstituter { - src = ./syslogd.sh; - dir = "etc/event.d"; +{ name = "syslogd"; - inherit sysklogd; + job = " + start on startup + stop on shutdown + respawn ${sysklogd}/sbin/syslogd -n + "; } diff --git a/test/upstart-jobs/syslogd.sh b/test/upstart-jobs/syslogd.sh deleted file mode 100644 index d87d5b30557..00000000000 --- a/test/upstart-jobs/syslogd.sh +++ /dev/null @@ -1,3 +0,0 @@ -start on startup -stop on shutdown -respawn @sysklogd@/sbin/syslogd -n -- GitLab From 369b48eadf00c84db2cb8b6524cd49190744a06f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 19 Nov 2006 22:05:49 +0000 Subject: [PATCH 0220/5331] * Start dhclient as an Upstart job. svn path=/nixu/trunk/; revision=7078 --- test/boot-environment.nix | 6 +++++- test/boot-stage-2-init.sh | 7 +------ test/boot-stage-2.nix | 3 +-- test/upstart-jobs/dhclient.nix | 29 +++++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 test/upstart-jobs/dhclient.nix diff --git a/test/boot-environment.nix b/test/boot-environment.nix index dcf29322139..a32ebd48c72 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -86,6 +86,11 @@ rec { (import ./upstart-jobs/syslogd.nix { inherit (pkgs) sysklogd; }) + + # DHCP client. + (import ./upstart-jobs/dhclient.nix { + dhcp = pkgs.dhcpWrapper; + }) ] # The terminals on ttyX. @@ -115,7 +120,6 @@ rec { nettools upstart; inherit upstartJobs; shell = pkgs.bash + "/bin/sh"; - dhcp = pkgs.dhcpWrapper; # Additional stuff; add whatever you want here. path = [ diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 5f68fea82cd..96d92b1ba77 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -86,12 +86,7 @@ done modprobe af_packet for i in $(cd /sys/class/net && ls -d *); do echo "Bringing up network device $i..." - if ifconfig $i up; then - if test "$i" != "lo"; then - mkdir -p /var/state/dhcp - dhclient $i - fi - fi + ifconfig $i up done diff --git a/test/boot-stage-2.nix b/test/boot-stage-2.nix index 9b37d4cd6f3..a7d22c3fb79 100644 --- a/test/boot-stage-2.nix +++ b/test/boot-stage-2.nix @@ -1,6 +1,6 @@ { genericSubstituter, shell, coreutils, findutils , utillinux, kernel, udev -, module_init_tools, nettools, dhcp, upstart +, module_init_tools, nettools, upstart , path ? [] , # Whether the root device is root only. If so, we'll mount a @@ -22,7 +22,6 @@ genericSubstituter { udev module_init_tools nettools - dhcp upstart ]; extraPath = path; diff --git a/test/upstart-jobs/dhclient.nix b/test/upstart-jobs/dhclient.nix new file mode 100644 index 00000000000..8a5c4fe9a5f --- /dev/null +++ b/test/upstart-jobs/dhclient.nix @@ -0,0 +1,29 @@ +{dhcp}: + +{ + name = "dhclient"; + + job = " +description \"DHCP client\" + +start on startup +stop on shutdown + +script + interfaces= + for i in $(cd /sys/class/net && ls -d *); do + if test \"$i\" != \"lo\" -a \"$(cat /sys/class/net/$i/operstate)\" != 'down'; then + interfaces=\"$interfaces $i\" + fi + done + + if test -z \"$interfaces\"; then + echo 'No interfaces on which to start dhclient!' + exit 1 + fi + + exec ${dhcp}/sbin/dhclient -d $interfaces +end script + "; + +} -- GitLab From 962b1df3aa805fa02a9b0932e6d14778d04bb034 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 20 Nov 2006 17:06:44 +0000 Subject: [PATCH 0221/5331] * Some more upstartification. svn path=/nixu/trunk/; revision=7081 --- test/boot-environment.nix | 8 +++++- test/boot-stage-2-init.sh | 8 ------ test/boot-stage-2.nix | 3 +- test/upstart-jobs/dhclient.nix | 4 +-- test/upstart-jobs/network-interfaces.nix | 35 ++++++++++++++++++++++++ 5 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 test/upstart-jobs/network-interfaces.nix diff --git a/test/boot-environment.nix b/test/boot-environment.nix index a32ebd48c72..e0acb16252e 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -87,6 +87,11 @@ rec { inherit (pkgs) sysklogd; }) + # Network interfaces. + (import ./upstart-jobs/network-interfaces.nix { + inherit (pkgs) nettools kernel; + }) + # DHCP client. (import ./upstart-jobs/dhclient.nix { dhcp = pkgs.dhcpWrapper; @@ -117,7 +122,7 @@ rec { bootStage2 = import ./boot-stage-2.nix { inherit (pkgs) genericSubstituter coreutils findutils utillinux kernel udev module_init_tools - nettools upstart; + upstart; inherit upstartJobs; shell = pkgs.bash + "/bin/sh"; @@ -137,6 +142,7 @@ rec { pkgs.less pkgs.nano pkgs.netcat + pkgs.nettools pkgs.perl pkgs.procps pkgs.rsync diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 96d92b1ba77..e624fdbacc1 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -82,14 +82,6 @@ for i in /sys/bus/pci/devices/*/modalias; do done -# Bring up the network devices. -modprobe af_packet -for i in $(cd /sys/class/net && ls -d *); do - echo "Bringing up network device $i..." - ifconfig $i up -done - - # login/su absolutely need this. test -e /etc/login.defs || touch /etc/login.defs diff --git a/test/boot-stage-2.nix b/test/boot-stage-2.nix index a7d22c3fb79..dc8cfbf891f 100644 --- a/test/boot-stage-2.nix +++ b/test/boot-stage-2.nix @@ -1,6 +1,6 @@ { genericSubstituter, shell, coreutils, findutils , utillinux, kernel, udev -, module_init_tools, nettools, upstart +, module_init_tools, upstart , path ? [] , # Whether the root device is root only. If so, we'll mount a @@ -21,7 +21,6 @@ genericSubstituter { utillinux udev module_init_tools - nettools upstart ]; extraPath = path; diff --git a/test/upstart-jobs/dhclient.nix b/test/upstart-jobs/dhclient.nix index 8a5c4fe9a5f..a9c9f375bbb 100644 --- a/test/upstart-jobs/dhclient.nix +++ b/test/upstart-jobs/dhclient.nix @@ -6,8 +6,8 @@ job = " description \"DHCP client\" -start on startup -stop on shutdown +start on network-interfaces +stop on network-interfaces/stop script interfaces= diff --git a/test/upstart-jobs/network-interfaces.nix b/test/upstart-jobs/network-interfaces.nix new file mode 100644 index 00000000000..3539a29afeb --- /dev/null +++ b/test/upstart-jobs/network-interfaces.nix @@ -0,0 +1,35 @@ +# !!! Don't like it that I have to pass the kernel here. +{nettools, kernel}: + +{ + name = "network-interfaces"; + + job = " +start on startup +stop on shutdown + +start script + export MODULE_DIR=${kernel}/lib/modules/ + + modprobe af_packet + + for i in $(cd /sys/class/net && ls -d *); do + echo \"Bringing up network device $i...\" + ${nettools}/sbin/ifconfig $i up || true + done +end script + +# Hack: Upstart doesn't yet support what we want: a service that +# doesn't have a running process associated with it. +respawn sleep 10000 + +stop script + for i in $(cd /sys/class/net && ls -d *); do + echo \"Bringing up network device $i...\" + ${nettools}/sbin/ifconfig $i down || true + done +end script + + "; + +} -- GitLab From 7bba427e939839d286d87a8c5f5fef3383e6dbc5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 20 Nov 2006 17:28:08 +0000 Subject: [PATCH 0222/5331] * Put the PCI module probing in an Upstart task. We now have more-or-less "asynchronous" booting: the login prompt appears almost immediately, before the hardware and the network are started. svn path=/nixu/trunk/; revision=7082 --- test/boot-environment.nix | 10 ++++++++-- test/boot-stage-2-init.sh | 8 -------- test/boot-stage-2.nix | 4 +--- test/upstart-jobs/dhclient.nix | 2 +- test/upstart-jobs/hardware-scan.nix | 23 +++++++++++++++++++++++ test/upstart-jobs/network-interfaces.nix | 6 +++--- 6 files changed, 36 insertions(+), 17 deletions(-) create mode 100644 test/upstart-jobs/hardware-scan.nix diff --git a/test/boot-environment.nix b/test/boot-environment.nix index e0acb16252e..b70906b13f6 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -87,9 +87,14 @@ rec { inherit (pkgs) sysklogd; }) + # Hardware scan; loads modules for PCI devices. + (import ./upstart-jobs/hardware-scan.nix { + inherit (pkgs) kernel module_init_tools; + }) + # Network interfaces. (import ./upstart-jobs/network-interfaces.nix { - inherit (pkgs) nettools kernel; + inherit (pkgs) nettools kernel module_init_tools; }) # DHCP client. @@ -121,7 +126,7 @@ rec { # everything else to bring up the system. bootStage2 = import ./boot-stage-2.nix { inherit (pkgs) genericSubstituter coreutils findutils - utillinux kernel udev module_init_tools + utillinux kernel udev upstart; inherit upstartJobs; shell = pkgs.bash + "/bin/sh"; @@ -140,6 +145,7 @@ rec { pkgs.gzip pkgs.iputils pkgs.less + pkgs.module_init_tools pkgs.nano pkgs.netcat pkgs.nettools diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index e624fdbacc1..d8bcf620d48 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -74,14 +74,6 @@ echo "*.* /dev/tty10" > /etc/syslog.conf echo "syslog 514/udp" > /etc/services # required, even if we don't use it -# Try to load modules for all PCI devices. -for i in /sys/bus/pci/devices/*/modalias; do - echo "Trying to load a module for $(basename $(dirname $i))..." - modprobe $(cat $i) - echo "" -done - - # login/su absolutely need this. test -e /etc/login.defs || touch /etc/login.defs diff --git a/test/boot-stage-2.nix b/test/boot-stage-2.nix index dc8cfbf891f..1bf8856f480 100644 --- a/test/boot-stage-2.nix +++ b/test/boot-stage-2.nix @@ -1,6 +1,5 @@ { genericSubstituter, shell, coreutils, findutils -, utillinux, kernel, udev -, module_init_tools, upstart +, utillinux, kernel, udev, upstart , path ? [] , # Whether the root device is root only. If so, we'll mount a @@ -20,7 +19,6 @@ genericSubstituter { findutils utillinux udev - module_init_tools upstart ]; extraPath = path; diff --git a/test/upstart-jobs/dhclient.nix b/test/upstart-jobs/dhclient.nix index a9c9f375bbb..3eb71f1745a 100644 --- a/test/upstart-jobs/dhclient.nix +++ b/test/upstart-jobs/dhclient.nix @@ -6,7 +6,7 @@ job = " description \"DHCP client\" -start on network-interfaces +start on network-interfaces/started stop on network-interfaces/stop script diff --git a/test/upstart-jobs/hardware-scan.nix b/test/upstart-jobs/hardware-scan.nix new file mode 100644 index 00000000000..3ffd8f9223f --- /dev/null +++ b/test/upstart-jobs/hardware-scan.nix @@ -0,0 +1,23 @@ +# !!! Don't like it that I have to pass the kernel here. +{kernel, module_init_tools}: + +{ + name = "hardware-scan"; + + job = " +start on startup + +script + export MODULE_DIR=${kernel}/lib/modules/ + + # Try to load modules for all PCI devices. + for i in /sys/bus/pci/devices/*/modalias; do + echo \"Trying to load a module for $(basename $(dirname $i))...\" + ${module_init_tools}/sbin/modprobe $(cat $i) || true + echo \"\" + done +end script + + "; + +} diff --git a/test/upstart-jobs/network-interfaces.nix b/test/upstart-jobs/network-interfaces.nix index 3539a29afeb..844ccd3f507 100644 --- a/test/upstart-jobs/network-interfaces.nix +++ b/test/upstart-jobs/network-interfaces.nix @@ -1,17 +1,17 @@ # !!! Don't like it that I have to pass the kernel here. -{nettools, kernel}: +{nettools, kernel, module_init_tools}: { name = "network-interfaces"; job = " -start on startup +start on hardware-scan stop on shutdown start script export MODULE_DIR=${kernel}/lib/modules/ - modprobe af_packet + ${module_init_tools}/sbin/modprobe af_packet for i in $(cd /sys/class/net && ls -d *); do echo \"Bringing up network device $i...\" -- GitLab From 49b2a218b54f4eefb7ac4ef50acc14d4ae2908ca Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 20 Nov 2006 20:50:52 +0000 Subject: [PATCH 0223/5331] * Support entering maintenance mode ("shutdown now") and powering off the system ("halt"). svn path=/nixu/trunk/; revision=7083 --- test/boot-environment.nix | 10 ++++++++++ test/upstart-jobs/halt.nix | 23 +++++++++++++++++++++++ test/upstart-jobs/maintenance-shell.nix | 19 +++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 test/upstart-jobs/halt.nix create mode 100644 test/upstart-jobs/maintenance-shell.nix diff --git a/test/boot-environment.nix b/test/boot-environment.nix index b70906b13f6..887e8feb978 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -101,6 +101,16 @@ rec { (import ./upstart-jobs/dhclient.nix { dhcp = pkgs.dhcpWrapper; }) + + # Handles the maintenance/stalled event (single-user shell). + (import ./upstart-jobs/maintenance-shell.nix { + inherit (pkgs) bash; + }) + + # Handles the reboot/halt events. + (import ./upstart-jobs/halt.nix { + inherit (pkgs) bash; + }) ] # The terminals on ttyX. diff --git a/test/upstart-jobs/halt.nix b/test/upstart-jobs/halt.nix new file mode 100644 index 00000000000..f259ea77cc9 --- /dev/null +++ b/test/upstart-jobs/halt.nix @@ -0,0 +1,23 @@ +{bash}: + +{ + name = "sys-halt"; + + job = " +start on reboot +start on halt +start on system-halt +start on power-off + +script + exec < /dev/tty1 > /dev/tty1 2>&1 + echo \"\" + echo \"<<< SYSTEM SHUTDOWN >>>\" + echo \"\" + + # Right now all events above power off the system. + exec halt -f -p +end script + "; + +} diff --git a/test/upstart-jobs/maintenance-shell.nix b/test/upstart-jobs/maintenance-shell.nix new file mode 100644 index 00000000000..9e2acdaa0f5 --- /dev/null +++ b/test/upstart-jobs/maintenance-shell.nix @@ -0,0 +1,19 @@ +{bash}: + +{ + name = "maintenance-shell"; + + job = " +start on maintenance +start on stalled + +script + exec < /dev/tty1 > /dev/tty1 2>&1 + echo \"\" + echo \"<<< MAINTENANCE SHELL >>>\" + echo \"\" + exec ${bash}/bin/sh +end script + "; + +} -- GitLab From 54f6e4fc713ff2fbddf66ae0df578a5eeb01300c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 20 Nov 2006 21:19:34 +0000 Subject: [PATCH 0224/5331] * Unmount file systems. svn path=/nixu/trunk/; revision=7084 --- test/upstart-jobs/halt.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/upstart-jobs/halt.nix b/test/upstart-jobs/halt.nix index f259ea77cc9..71e9ae1b536 100644 --- a/test/upstart-jobs/halt.nix +++ b/test/upstart-jobs/halt.nix @@ -15,8 +15,20 @@ script echo \"<<< SYSTEM SHUTDOWN >>>\" echo \"\" + # Do an initial sync just in case. + sync || true + + # Unmount file systems. + umount -n -a || true + + # Remount / read-only + mount -n -o remount,ro /dontcare / || true + + # Final sync. + sync || true + # Right now all events above power off the system. - exec halt -f -p + exec halt -f end script "; -- GitLab From 7e97935e178fa0c4cf71468e083bd1aa0b393cbd Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 20 Nov 2006 21:20:04 +0000 Subject: [PATCH 0225/5331] * Doh. svn path=/nixu/trunk/; revision=7085 --- test/upstart-jobs/halt.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/upstart-jobs/halt.nix b/test/upstart-jobs/halt.nix index 71e9ae1b536..23b863e803d 100644 --- a/test/upstart-jobs/halt.nix +++ b/test/upstart-jobs/halt.nix @@ -28,7 +28,7 @@ script sync || true # Right now all events above power off the system. - exec halt -f + exec halt -f -p end script "; -- GitLab From 16d28b3552c55dfe21c1d24ffa57da2140cb967a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Nov 2006 15:25:29 +0000 Subject: [PATCH 0226/5331] * New Nixpkgs. svn path=/nixu/trunk/; revision=7091 --- test/rescue-cd.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/rescue-cd.nix b/test/rescue-cd.nix index e66de36e424..172ceeaf68d 100644 --- a/test/rescue-cd.nix +++ b/test/rescue-cd.nix @@ -55,8 +55,8 @@ rec { nixpkgsTarball = pkgs.fetchurl { - url = http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre7060/nixpkgs-0.11pre7060.tar.bz2; - md5 = "67163e7a71f7b8cb01461e1d0467a6e1"; + url = http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre7087/nixpkgs-0.11pre7087.tar.bz2; + md5 = "c5840fcd049d75e00ad856ecbbef6857)"; }; -- GitLab From e6d2d5077950d4be06fcb255eeb5cc99b979d9fa Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Nov 2006 16:00:23 +0000 Subject: [PATCH 0227/5331] * Bring in /etc/profile.local. svn path=/nixu/trunk/; revision=7092 --- test/boot-stage-2-init.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index d8bcf620d48..aa6f81e5f9b 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -115,6 +115,9 @@ done cat > /etc/profile < Date: Thu, 23 Nov 2006 16:46:23 +0000 Subject: [PATCH 0228/5331] * Create a symlink to /nix/var/nix/profiles from /nix/var/nix/gcroots/, otherwise garbage collection will end tragically. svn path=/nixu/trunk/; revision=7093 --- test/boot-stage-2-init.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index aa6f81e5f9b..0c7a105c3a1 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -52,6 +52,8 @@ mkdir -m 0755 -p /nix/var/nix/temproots mkdir -m 0755 -p /var/log +ln -sf /nix/var/nix/profiles /nix/var/nix/gcroots/ + # Ensure that the module tools can find the kernel modules. export MODULE_DIR=@kernel@/lib/modules/ -- GitLab From c8c62dba0b9b1465bb06b2c3355246a1066bb65c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Nov 2006 17:27:43 +0000 Subject: [PATCH 0229/5331] * Remove /etc/mtab. svn path=/nixu/trunk/; revision=7094 --- test/boot-stage-2-init.sh | 2 ++ test/installer.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 0c7a105c3a1..bda2bfdb64d 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -21,6 +21,8 @@ done # Mount special file systems, initialise required directories. +rm -f /etc/mtab + if test -z "@readOnlyRoot@"; then #rootDev=$(grep "/dev/.* / " /proc/mounts | sed 's/^\([^ ]*\) .*/\1/') mount -o remount,rw /dontcare / # !!! check for failure diff --git a/test/installer.sh b/test/installer.sh index be20b3095b8..8e438f5388c 100644 --- a/test/installer.sh +++ b/test/installer.sh @@ -118,7 +118,7 @@ chroot $mountPoint @nix@/bin/nix-pull $nixpkgsURL/MANIFEST chroot $mountPoint @nix@/bin/nix-env \ -p /nix/var/nix/profiles/system \ - -f "/mnt/$nixExpr" -i system-configuration + -f "/mnt/$nixExpr" -i -A systemConfiguration # Grub needs a mtab. -- GitLab From a0821fbd497f761da8dd321e6dad440d41b783a3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Nov 2006 17:32:09 +0000 Subject: [PATCH 0230/5331] * /dev should always be a ramdisk. svn path=/nixu/trunk/; revision=7095 --- test/boot-stage-2-init.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index bda2bfdb64d..a93d22d2470 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -30,8 +30,7 @@ fi needWritableDir() { if test -n "@readOnlyRoot@"; then - mount -t tmpfs none $1 $3 - chmod $2 $1 + mount -t tmpfs -o "mode=$2" none $1 $3 else mkdir -m $2 -p $1 fi @@ -43,7 +42,7 @@ test -e /etc/fstab || touch /etc/fstab # idem mount -t proc none /proc mount -t sysfs none /sys -needWritableDir /dev 0755 +mount -t tmpfs -o "mode=0755" none /dev needWritableDir /tmp 01777 needWritableDir /var 0755 needWritableDir /nix/var 0755 -- GitLab From e6ebe2e2aadef7a1ff4284fb6419e6e7fd196b8e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Nov 2006 17:43:28 +0000 Subject: [PATCH 0231/5331] * Add an Upstart job for sshd. The start script automatically creates an sshd user, a host key, etc. svn path=/nixu/trunk/; revision=7096 --- test/boot-environment.nix | 5 +++++ test/boot-stage-2-init.sh | 1 + test/upstart-jobs/sshd.nix | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 test/upstart-jobs/sshd.nix diff --git a/test/boot-environment.nix b/test/boot-environment.nix index 887e8feb978..aecb23fd4b3 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -102,6 +102,11 @@ rec { dhcp = pkgs.dhcpWrapper; }) + # SSH daemon. + (import ./upstart-jobs/sshd.nix { + inherit (pkgs) openssh; + }) + # Handles the maintenance/stalled event (single-user shell). (import ./upstart-jobs/maintenance-shell.nix { inherit (pkgs) bash; diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index a93d22d2470..75ff879883e 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -93,6 +93,7 @@ fi # Set up the Upstart jobs. export UPSTART_CFG_DIR=/etc/event.d +rm -f /etc/event.d ln -sf @upstartJobs@/etc/event.d /etc/event.d diff --git a/test/upstart-jobs/sshd.nix b/test/upstart-jobs/sshd.nix new file mode 100644 index 00000000000..919a96dda5a --- /dev/null +++ b/test/upstart-jobs/sshd.nix @@ -0,0 +1,32 @@ +{openssh}: + +{ + name = "sshd"; + + job = " +description \"SSH server\" + +start on network-interfaces/started +stop on network-interfaces/stop + +start script + mkdir -m 0555 -p /var/empty + + mkdir -m 0755 -p /etc/ssh + + echo 'X11Forwarding yes' > /etc/ssh/sshd_config + + if ! test -f /etc/ssh/ssh_host_dsa_key; then + ${openssh}/bin/ssh-keygen -t dsa -b 1024 -f /etc/ssh/ssh_host_dsa_key -N '' + fi + + if ! grep -q '^sshd:' /etc/passwd; then + echo 'sshd:x:74:74:SSH privilege separation user:/var/empty:/noshell' >> /etc/passwd + fi + +end script + +respawn ${openssh}/sbin/sshd -h /etc/ssh/ssh_host_dsa_key -f /etc/ssh/sshd_config + "; + +} -- GitLab From 5e8d54eef7048304170e86a8c58d006ce63f9a5d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Nov 2006 17:46:55 +0000 Subject: [PATCH 0232/5331] * Remove /etc/mtab on boot. * Start an emergency shell if we can't remount / read-writable. svn path=/nixu/trunk/; revision=7097 --- test/boot-stage-2-init.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 75ff879883e..9edb255f3d5 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -21,11 +21,12 @@ done # Mount special file systems, initialise required directories. -rm -f /etc/mtab - if test -z "@readOnlyRoot@"; then #rootDev=$(grep "/dev/.* / " /proc/mounts | sed 's/^\([^ ]*\) .*/\1/') - mount -o remount,rw /dontcare / # !!! check for failure + if mount -t dontcare -o remount,rw /dontcare /; then + echo "Couldn't remount / read-writable, starting emergency shell!" + exec @shell@ + fi fi needWritableDir() { @@ -40,7 +41,8 @@ needWritableDir /etc 0755 -n # to shut up mount test -e /etc/fstab || touch /etc/fstab # idem -mount -t proc none /proc +mount -n -t proc none /proc +cp /proc/mounts /etc/mtab mount -t sysfs none /sys mount -t tmpfs -o "mode=0755" none /dev needWritableDir /tmp 01777 -- GitLab From 0db7e06e7f73054fb1b5d195ecc226fea2024347 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Nov 2006 17:51:03 +0000 Subject: [PATCH 0233/5331] * Oops. svn path=/nixu/trunk/; revision=7098 --- test/boot-stage-2-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 9edb255f3d5..a6295dfc92a 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -23,7 +23,7 @@ done if test -z "@readOnlyRoot@"; then #rootDev=$(grep "/dev/.* / " /proc/mounts | sed 's/^\([^ ]*\) .*/\1/') - if mount -t dontcare -o remount,rw /dontcare /; then + if ! mount -t dontcare -o remount,rw /dontcare /; then echo "Couldn't remount / read-writable, starting emergency shell!" exec @shell@ fi -- GitLab From 3bf7001325858f71f54cea0468d5a2d7f04cd6b3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Nov 2006 21:59:25 +0000 Subject: [PATCH 0234/5331] * Oops. svn path=/nixu/trunk/; revision=7099 --- test/rescue-cd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/rescue-cd.nix b/test/rescue-cd.nix index 172ceeaf68d..48040f6495c 100644 --- a/test/rescue-cd.nix +++ b/test/rescue-cd.nix @@ -56,7 +56,7 @@ rec { nixpkgsTarball = pkgs.fetchurl { url = http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre7087/nixpkgs-0.11pre7087.tar.bz2; - md5 = "c5840fcd049d75e00ad856ecbbef6857)"; + md5 = "c5840fcd049d75e00ad856ecbbef6857"; }; -- GitLab From bd62a8273efc016271be65d1365e2297a901cb93 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Nov 2006 22:16:59 +0000 Subject: [PATCH 0235/5331] * Quick hack to allow localhost to be looked up (NIXOS-41). svn path=/nixu/trunk/; revision=7100 --- test/boot-stage-2-init.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index a6295dfc92a..5fd302a6835 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -92,6 +92,11 @@ if ! test -e /etc/group; then fi +# We need "localhost" (!!! destructive hack for NIXOS-41). +echo "127.0.0.1 localhost" > /etc/localhost +echo "hosts: files dns" > /etc/nsswitch.conf + + # Set up the Upstart jobs. export UPSTART_CFG_DIR=/etc/event.d -- GitLab From 498bb32c828075c03df1a602acd9f66bee38d27e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Nov 2006 22:52:15 +0000 Subject: [PATCH 0236/5331] * Doh. svn path=/nixu/trunk/; revision=7101 --- test/boot-stage-2-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 5fd302a6835..12d6baf84a5 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -93,7 +93,7 @@ fi # We need "localhost" (!!! destructive hack for NIXOS-41). -echo "127.0.0.1 localhost" > /etc/localhost +echo "127.0.0.1 localhost" > /etc/hosts echo "hosts: files dns" > /etc/nsswitch.conf -- GitLab From 843aa8505ccd610ae801c1a34bca343586fb324d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Nov 2006 22:53:16 +0000 Subject: [PATCH 0237/5331] * Handle reboot properly. svn path=/nixu/trunk/; revision=7102 --- test/boot-environment.nix | 13 +++++++++---- test/upstart-jobs/halt.nix | 20 +++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/test/boot-environment.nix b/test/boot-environment.nix index aecb23fd4b3..16ac9484820 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -112,12 +112,17 @@ rec { inherit (pkgs) bash; }) - # Handles the reboot/halt events. - (import ./upstart-jobs/halt.nix { - inherit (pkgs) bash; - }) ] + # Handles the reboot/halt events. + ++ (map + (event: makeJob (import ./upstart-jobs/halt.nix { + inherit (pkgs) bash; + inherit event; + })) + ["reboot" "halt" "system-halt" "power-off"] + ) + # The terminals on ttyX. ++ (map (ttyNumber: makeJob (import ./upstart-jobs/mingetty.nix { diff --git a/test/upstart-jobs/halt.nix b/test/upstart-jobs/halt.nix index 23b863e803d..58be12db69c 100644 --- a/test/upstart-jobs/halt.nix +++ b/test/upstart-jobs/halt.nix @@ -1,13 +1,15 @@ -{bash}: +{bash, event}: + +assert event == "reboot" + || event == "halt" + || event == "system-halt" + || event == "power-off"; { - name = "sys-halt"; + name = "sys-" + event; job = " -start on reboot -start on halt -start on system-halt -start on power-off +start on ${event} script exec < /dev/tty1 > /dev/tty1 2>&1 @@ -28,7 +30,11 @@ script sync || true # Right now all events above power off the system. - exec halt -f -p + if test ${event} = reboot; then + exec reboot -f + else + exec halt -f -p + fi end script "; -- GitLab From f1a46db43ba45abe4626e656b54c0c933525be83 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Nov 2006 22:53:25 +0000 Subject: [PATCH 0238/5331] * Notes. svn path=/nixu/trunk/; revision=7103 --- test/README | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/README diff --git a/test/README b/test/README new file mode 100644 index 00000000000..701faaf22fa --- /dev/null +++ b/test/README @@ -0,0 +1,14 @@ +Switching to maintenance mode: + +$ shutdown now + +To get out of maintenance mode: + +$ initctl emit startup + + +Updating the current system configuration: + +$ nix-env -p /nix/var/nix/profiles/system -f system-configuration.nix -i -A systemConfiguration +$ /nix/var/nix/profiles/system/bin/switch-to-configuration + -- GitLab From 84b1cafe4bad452693e66dcdaeb0aa557ea32211 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Nov 2006 22:58:25 +0000 Subject: [PATCH 0239/5331] * Fill in /etc/mtab with something sensible. svn path=/nixu/trunk/; revision=7104 --- test/boot-stage-2-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 12d6baf84a5..23ca93937c9 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -42,7 +42,7 @@ needWritableDir /etc 0755 -n # to shut up mount test -e /etc/fstab || touch /etc/fstab # idem mount -n -t proc none /proc -cp /proc/mounts /etc/mtab +cat /proc/mounts > /etc/mtab mount -t sysfs none /sys mount -t tmpfs -o "mode=0755" none /dev needWritableDir /tmp 01777 -- GitLab From 34acdf1f22bf9239b93253bdf3a2406a9413a03a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Nov 2006 23:22:43 +0000 Subject: [PATCH 0240/5331] * Generate a Grub boot menu that contains all generations of the system profile. svn path=/nixu/trunk/; revision=7105 --- test/grub-menu-builder.sh | 50 +++++++++++++++++++++++++++++++++++ test/installer.sh | 2 +- test/system-configuration.nix | 8 ++++++ test/system-configuration.sh | 5 +--- 4 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 test/grub-menu-builder.sh diff --git a/test/grub-menu-builder.sh b/test/grub-menu-builder.sh new file mode 100644 index 00000000000..83760d975cf --- /dev/null +++ b/test/grub-menu-builder.sh @@ -0,0 +1,50 @@ +#! @bash@/bin/sh -e + +default=$1 +if test -z "$1"; then + echo "Syntax: grub-menu-builder.sh " + exit 1 +fi + + +target=/boot/grub/menu.lst +tmp=$target.tmp + +cat > $tmp << GRUBEND +# Automatically generated. DO NOT EDIT THIS FILE! +default=0 +timeout=5 +GRUBEND + +addEntry() { + name="$1" + path="$2" + + cat >> $tmp << GRUBEND +title $name +GRUBEND + + #cat $path/menu.lst >> $tmp + + grep -v "title \|default=\|timeout=" < $path/menu.lst >> $tmp +} + + +if test -n "$tmp"; then + addEntry "NixOS - Default" $default +fi + + +# Add all generations of the system profile to the menu, in reverse +# (most recent to least recent) order. +for generation in $( + (cd /nix/var/nix/profiles && ls -d system-*-link) \ + | sed 's/system-\([0-9]\+\)-link/\1/' \ + | sort -n -r); do + echo $generation + addEntry "NixOS - Configuration $generation" \ + /nix/var/nix/profiles/system-$generation-link +done + + +cp $tmp $target diff --git a/test/installer.sh b/test/installer.sh index 8e438f5388c..d3f747c8310 100644 --- a/test/installer.sh +++ b/test/installer.sh @@ -19,7 +19,7 @@ targetDevice="$1" nixExpr="$2" if test -z "$targetDevice" -o -z "$nixExpr"; then - echo "syntax: installer.sh " + echo "Syntax: installer.sh " exit 1 fi diff --git a/test/system-configuration.nix b/test/system-configuration.nix index a1c90813e6b..8675cf5d71b 100644 --- a/test/system-configuration.nix +++ b/test/system-configuration.nix @@ -28,9 +28,17 @@ rec { inherit (pkgs) grub coreutils gnused gnugrep diffutils; inherit grubDevice; inherit bootStage2; + inherit grubMenuBuilder; kernel = pkgs.kernel + "/vmlinuz"; initrd = initialRamdisk + "/initrd"; }; + grubMenuBuilder = pkgs.genericSubstituter { + src = ./grub-menu-builder.sh; + isExecutable = true; + inherit (pkgs) bash; + }; + + } diff --git a/test/system-configuration.sh b/test/system-configuration.sh index d35811a84da..653774cc5cc 100644 --- a/test/system-configuration.sh +++ b/test/system-configuration.sh @@ -6,9 +6,6 @@ ln -s $kernel $out/kernel ln -s $grub $out/grub cat > $out/menu.lst << GRUBEND -# Automatically generated. DO NOT EDIT THIS FILE! -default=0 -timeout=5 title NixOS kernel $kernel selinux=0 apm=on acpi=on initrd $initrd @@ -21,8 +18,8 @@ cat > $out/bin/switch-to-configuration < Date: Fri, 24 Nov 2006 00:00:32 +0000 Subject: [PATCH 0241/5331] * Put the date of each configuration in the Grub menu. svn path=/nixu/trunk/; revision=7106 --- test/grub-menu-builder.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/grub-menu-builder.sh b/test/grub-menu-builder.sh index 83760d975cf..36fc0b05e12 100644 --- a/test/grub-menu-builder.sh +++ b/test/grub-menu-builder.sh @@ -42,8 +42,10 @@ for generation in $( | sed 's/system-\([0-9]\+\)-link/\1/' \ | sort -n -r); do echo $generation - addEntry "NixOS - Configuration $generation" \ - /nix/var/nix/profiles/system-$generation-link + link=/nix/var/nix/profiles/system-$generation-link + date=$(stat --printf="%y\n" $link | sed 's/\..*//') + addEntry "NixOS - Configuration $generation ($date)" $link + done -- GitLab From 2cccff268df477df673880415a250eae5c816b26 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Nov 2006 00:04:29 +0000 Subject: [PATCH 0242/5331] * Pass the path of the stage 2 init script to stage 1 init through the kernel command line, instead of having a /init symlink. This allows us to switch between configurations. * Some debug support: adding `debug' to the kernel command line gives a stage 1 shell. svn path=/nixu/trunk/; revision=7107 --- test/README | 5 +++++ test/boot-stage-1-init.sh | 26 +++++++++++++++++++++++++- test/system-configuration.nix | 2 +- test/system-configuration.sh | 6 ++---- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/test/README b/test/README index 701faaf22fa..e2f76b08301 100644 --- a/test/README +++ b/test/README @@ -1,3 +1,8 @@ +To get a Stage 1 shell: + +Add "debug1" to the kernel command line. + + Switching to maintenance mode: $ shutdown now diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index 3e93571ebda..3d115760e06 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -32,6 +32,25 @@ mkdir /sys mount -t sysfs none /sys +# Process the kernel command line. +stage2Init=@stage2Init@ +for o in $(cat /proc/cmdline); do + case $o in + init=*) + set -- $(IFS==; echo $o) + stage2Init=$2 + ;; + debugtrace) + # Show each command. + set -x + ;; + debug1) + fail + ;; + esac +done + + # Create device nodes in /dev. source @makeDevices@ @@ -85,6 +104,7 @@ else fi + # Start stage 2. # !!! Note: we can't use pivot_root here (the kernel gods have # decreed), but we could use run-init from klibc, which deletes all @@ -94,6 +114,10 @@ mount --move . / umount /proc # cleanup umount /sys -exec chroot . @stage2Init@ +echo "INIT = $stage2Init" + +if test -z "$stage2Init"; then fail; fi + +exec chroot . $stage2Init fail diff --git a/test/system-configuration.nix b/test/system-configuration.nix index 8675cf5d71b..b357683f446 100644 --- a/test/system-configuration.nix +++ b/test/system-configuration.nix @@ -11,7 +11,7 @@ let bootEnv = import ./boot-environment.nix { autoDetectRootDevice = false; inherit rootDevice; - stage2Init = "/init"; # !!! should be bootEnv.bootStage2; + stage2Init = ""; # Passed on the command line via Grub. readOnlyRoot = false; }; diff --git a/test/system-configuration.sh b/test/system-configuration.sh index 653774cc5cc..4a803d81e4b 100644 --- a/test/system-configuration.sh +++ b/test/system-configuration.sh @@ -6,9 +6,8 @@ ln -s $kernel $out/kernel ln -s $grub $out/grub cat > $out/menu.lst << GRUBEND -title NixOS - kernel $kernel selinux=0 apm=on acpi=on - initrd $initrd +kernel $kernel selinux=0 apm=on acpi=on init=$bootStage2 +initrd $initrd GRUBEND ensureDir $out/bin @@ -20,7 +19,6 @@ export PATH=$coreutils/bin:$gnused/bin:$gnugrep/bin:$diffutils/bin if test -n "$grubDevice"; then $grubMenuBuilder $out $grub/sbin/grub-install "$grubDevice" --no-floppy --recheck - ln -sf $bootStage2 /init # !!! fix? fi EOF -- GitLab From 23d2f02841ecc9d5ee2fa9ffc33643118013671a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Nov 2006 00:18:14 +0000 Subject: [PATCH 0243/5331] * Debug support / quasi-single user mode. svn path=/nixu/trunk/; revision=7108 --- test/boot-stage-2-init.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 23ca93937c9..83232b77e90 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -19,7 +19,7 @@ for i in @path@; do done -# Mount special file systems, initialise required directories. +# Mount special file systems. if test -z "@readOnlyRoot@"; then #rootDev=$(grep "/dev/.* / " /proc/mounts | sed 's/^\([^ ]*\) .*/\1/') @@ -43,6 +43,28 @@ test -e /etc/fstab || touch /etc/fstab # idem mount -n -t proc none /proc cat /proc/mounts > /etc/mtab + + +# Process the kernel command line. +for o in $(cat /proc/cmdline); do + case $o in + debugtrace) + # Show each command. + set -x + ;; + debug2) + echo "Debug shell called from $out" + exec @shell@ + ;; + S|s|single) + # !!! argh, can't pass a startup event to Upstart yet. + exec @shell@ + ;; + esac +done + + +# More special file systems, initialise required directories. mount -t sysfs none /sys mount -t tmpfs -o "mode=0755" none /dev needWritableDir /tmp 01777 -- GitLab From 02f31e7e85accac62d9cf3be04780e8e8dced965 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Nov 2006 00:24:08 +0000 Subject: [PATCH 0244/5331] * Doh. svn path=/nixu/trunk/; revision=7109 --- test/boot-stage-2-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 83232b77e90..ceea877cbeb 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -53,7 +53,7 @@ for o in $(cat /proc/cmdline); do set -x ;; debug2) - echo "Debug shell called from $out" + echo "Debug shell called from @out@" exec @shell@ ;; S|s|single) -- GitLab From 9d171e03274d58df481dffc6dfc26f5b9095f878 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Nov 2006 00:25:44 +0000 Subject: [PATCH 0245/5331] * Unnecessary message. svn path=/nixu/trunk/; revision=7110 --- test/boot-stage-2-init.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index ceea877cbeb..3f480e87519 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -131,8 +131,6 @@ cat > /etc/issue <>> -You can log in as \`root'. - EOF -- GitLab From 5f212a6913a9d0553f83afea16dbe5862bc1a765 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Nov 2006 00:34:50 +0000 Subject: [PATCH 0246/5331] * Handle ctrl-alt-delete. svn path=/nixu/trunk/; revision=7111 --- test/boot-environment.nix | 3 +++ test/upstart-jobs/ctrl-alt-delete.nix | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 test/upstart-jobs/ctrl-alt-delete.nix diff --git a/test/boot-environment.nix b/test/boot-environment.nix index 16ac9484820..6f124b88fef 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -112,6 +112,9 @@ rec { inherit (pkgs) bash; }) + # Ctrl-alt-delete action. + (import ./upstart-jobs/ctrl-alt-delete.nix) + ] # Handles the reboot/halt events. diff --git a/test/upstart-jobs/ctrl-alt-delete.nix b/test/upstart-jobs/ctrl-alt-delete.nix new file mode 100644 index 00000000000..126154bae73 --- /dev/null +++ b/test/upstart-jobs/ctrl-alt-delete.nix @@ -0,0 +1,12 @@ +{ + name = "ctrl-alt-delete"; + + job = " +on ctrlaltdel + +script + shutdown -r now 'Ctrl-Alt-Delete pressed' +end script + "; + +} -- GitLab From f0695e9fcd1b113614d77e8e3243692ee0e59672 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Nov 2006 10:50:49 +0000 Subject: [PATCH 0247/5331] * Clear utmp. svn path=/nixu/trunk/; revision=7115 --- test/boot-stage-2-init.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 3f480e87519..d2dc42045a1 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -84,6 +84,13 @@ ln -sf /nix/var/nix/profiles /nix/var/nix/gcroots/ export MODULE_DIR=@kernel@/lib/modules/ +# Miscellaneous cleanup. +rm -f /var/run/* + +echo -n > /var/run/utmp # must exist +chmod 664 /var/run/utmp + + # Start udev. udevd --daemon -- GitLab From bb0a2b0d78e40ae835e6516bf70a1fb2df4298db Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Nov 2006 12:13:11 +0000 Subject: [PATCH 0248/5331] * In stage 1, fsck the root device before mounting it. If automatic repair fails, drop the user into an emergency shell. svn path=/nixu/trunk/; revision=7117 --- test/boot-environment.nix | 10 ++++++++-- test/boot-stage-1-init.sh | 28 ++++++++++++++++++++++++++-- test/boot-stage-2-init.sh | 8 -------- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/test/boot-environment.nix b/test/boot-environment.nix index 6f124b88fef..af7b9678518 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -40,10 +40,16 @@ rec { # need. extraUtils = pkgs.stdenv.mkDerivation { name = "extra-utils"; - builder = builtins.toFile "builder.sh" - "source $stdenv/setup; ensureDir $out/bin; cp $utillinux/bin/mount $utillinux/bin/umount $utillinux/sbin/pivot_root $out/bin; nuke-refs $out/bin/*"; + builder = builtins.toFile "builder.sh" " + source $stdenv/setup + 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 + nuke-refs $out/bin/* + "; buildInputs = [pkgs.nukeReferences]; inherit (pkgsStatic) utillinux; + e2fsprogs = pkgs.e2fsprogsDiet; }; diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index 3d115760e06..b25ce05368e 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -81,7 +81,7 @@ if test -n "@autoDetectRootDevice@"; then echo " in $devName..." - if mount -o ro -t iso9660 $devName /mnt/root; then + if mount -n -o ro -t iso9660 $devName /mnt/root; then if test -e "/mnt/root/@rootLabel@"; then found=1 break @@ -100,7 +100,31 @@ if test -n "@autoDetectRootDevice@"; then else # Hard-coded root device. - mount -o ro "@rootDevice@" /mnt/root + rootDevice="@rootDevice@" + + # Check the root device. + fsck -C -a "$rootDevice" + fsckResult=$? + + if test $(($fsckResult | 2)) = $fsckResult; then + echo "fsck finished, rebooting..." + sleep 3 + # reboot -f -d !!! don't have reboot yet + fail + fi + + if test $(($fsckResult | 4)) = $fsckResult; then + echo "$rootDevice has unrepaired errors, please fix them manually." + fail + fi + + if test $fsckResult -ge 8; then + echo "fsck on $rootDevice failed." + fail + fi + + # Mount read-writable. + mount -n -o rw "$rootDevice" /mnt/root || fail fi diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index d2dc42045a1..57f9e4e444f 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -21,14 +21,6 @@ done # Mount special file systems. -if test -z "@readOnlyRoot@"; then - #rootDev=$(grep "/dev/.* / " /proc/mounts | sed 's/^\([^ ]*\) .*/\1/') - if ! mount -t dontcare -o remount,rw /dontcare /; then - echo "Couldn't remount / read-writable, starting emergency shell!" - exec @shell@ - fi -fi - needWritableDir() { if test -n "@readOnlyRoot@"; then mount -t tmpfs -o "mode=$2" none $1 $3 -- GitLab From f4dc05da97b995d577017c4a075ca7e763adaf23 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Nov 2006 15:31:20 +0000 Subject: [PATCH 0249/5331] * /var/run: create earlier. svn path=/nixu/trunk/; revision=7118 --- test/boot-stage-2-init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 57f9e4e444f..f1ce3371967 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -77,7 +77,8 @@ export MODULE_DIR=@kernel@/lib/modules/ # Miscellaneous cleanup. -rm -f /var/run/* +rm -rf /var/run +mkdir -m 0755 -p /var/run echo -n > /var/run/utmp # must exist chmod 664 /var/run/utmp @@ -95,7 +96,6 @@ udevsettle # wait for udev to finish # Necessary configuration for syslogd. -mkdir -m 0755 -p /var/run echo "*.* /dev/tty10" > /etc/syslog.conf echo "syslog 514/udp" > /etc/services # required, even if we don't use it -- GitLab From 9d1be4d54fd2d180854bda41dda7887bba16f5b3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Nov 2006 15:31:28 +0000 Subject: [PATCH 0250/5331] * Create /boot/grub. svn path=/nixu/trunk/; revision=7119 --- test/system-configuration.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/system-configuration.sh b/test/system-configuration.sh index 4a803d81e4b..06472ae8d83 100644 --- a/test/system-configuration.sh +++ b/test/system-configuration.sh @@ -17,6 +17,7 @@ cat > $out/bin/switch-to-configuration < Date: Fri, 24 Nov 2006 15:56:11 +0000 Subject: [PATCH 0251/5331] * Don't daemonise sshd. svn path=/nixu/trunk/; revision=7120 --- test/upstart-jobs/sshd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/upstart-jobs/sshd.nix b/test/upstart-jobs/sshd.nix index 919a96dda5a..466c7616f55 100644 --- a/test/upstart-jobs/sshd.nix +++ b/test/upstart-jobs/sshd.nix @@ -26,7 +26,7 @@ start script end script -respawn ${openssh}/sbin/sshd -h /etc/ssh/ssh_host_dsa_key -f /etc/ssh/sshd_config +respawn ${openssh}/sbin/sshd -D -h /etc/ssh/ssh_host_dsa_key -f /etc/ssh/sshd_config "; } -- GitLab From 3055ff0ae65bad1e4f281ad71297cd8f8c784801 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Nov 2006 16:31:01 +0000 Subject: [PATCH 0252/5331] * Don't use /sys/class/net/*/operstate to find out the active interface, since there seems to be a delay after the interface is brought up before operstate reflects that. svn path=/nixu/trunk/; revision=7121 --- test/upstart-jobs/dhclient.nix | 16 ++++++++++++++-- test/upstart-jobs/network-interfaces.nix | 5 +++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/test/upstart-jobs/dhclient.nix b/test/upstart-jobs/dhclient.nix index 3eb71f1745a..dae773ab717 100644 --- a/test/upstart-jobs/dhclient.nix +++ b/test/upstart-jobs/dhclient.nix @@ -10,9 +10,21 @@ start on network-interfaces/started stop on network-interfaces/stop script + # Determine the interface on which to start dhclient. interfaces= - for i in $(cd /sys/class/net && ls -d *); do - if test \"$i\" != \"lo\" -a \"$(cat /sys/class/net/$i/operstate)\" != 'down'; then + + # !!! apparent race; operstate seems to have a slight delay, so + # if dhclient is started right after network-interfaces, we don't + # always see all the interfaces. + + #for i in $(cd /sys/class/net && ls -d *); do + # if test \"$i\" != \"lo\" -a \"$(cat /sys/class/net/$i/operstate)\" != 'down'; then + # interfaces=\"$interfaces $i\" + # fi + #done + + for i in $(ifconfig | grep '^[^ ]' | sed 's/ .*//'); do + if test \"$i\" != \"lo\"; then interfaces=\"$interfaces $i\" fi done diff --git a/test/upstart-jobs/network-interfaces.nix b/test/upstart-jobs/network-interfaces.nix index 844ccd3f507..d85c7e02001 100644 --- a/test/upstart-jobs/network-interfaces.nix +++ b/test/upstart-jobs/network-interfaces.nix @@ -12,11 +12,12 @@ start script export MODULE_DIR=${kernel}/lib/modules/ ${module_init_tools}/sbin/modprobe af_packet - + for i in $(cd /sys/class/net && ls -d *); do echo \"Bringing up network device $i...\" ${nettools}/sbin/ifconfig $i up || true done + end script # Hack: Upstart doesn't yet support what we want: a service that @@ -25,7 +26,7 @@ respawn sleep 10000 stop script for i in $(cd /sys/class/net && ls -d *); do - echo \"Bringing up network device $i...\" + echo \"Taking down network device $i...\" ${nettools}/sbin/ifconfig $i down || true done end script -- GitLab From 6f91f8768f723cd69407ff19b5170438f9094e53 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Nov 2006 16:38:22 +0000 Subject: [PATCH 0253/5331] * Need /var/state/dhcp. svn path=/nixu/trunk/; revision=7122 --- test/upstart-jobs/dhclient.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/upstart-jobs/dhclient.nix b/test/upstart-jobs/dhclient.nix index dae773ab717..7ccc87615ad 100644 --- a/test/upstart-jobs/dhclient.nix +++ b/test/upstart-jobs/dhclient.nix @@ -34,6 +34,8 @@ script exit 1 fi + mkdir -m 755 -p /var/state/dhcp + exec ${dhcp}/sbin/dhclient -d $interfaces end script "; -- GitLab From 66574e789c23aab4bcc14ae0e33a9a4381b23f4e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 25 Nov 2006 00:39:43 +0000 Subject: [PATCH 0254/5331] * Include etc/profile.d/nix.sh. svn path=/nixu/trunk/; revision=7127 --- test/boot-stage-2-init.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index f1ce3371967..58277751680 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -145,6 +145,11 @@ done cat > /etc/profile < Date: Sun, 26 Nov 2006 22:57:35 +0000 Subject: [PATCH 0255/5331] * Run the virtual consoles in 1024x768x16. svn path=/nixu/trunk/; revision=7136 --- test/system-configuration.nix | 4 ++++ test/system-configuration.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/system-configuration.nix b/test/system-configuration.nix index b357683f446..dee0461c2e4 100644 --- a/test/system-configuration.nix +++ b/test/system-configuration.nix @@ -15,6 +15,9 @@ let readOnlyRoot = false; }; + # Extra kernel command line arguments. + extraKernelParams = "vga=0x317 console=tty1 splash=verbose"; + in with bootEnv; @@ -31,6 +34,7 @@ rec { inherit grubMenuBuilder; kernel = pkgs.kernel + "/vmlinuz"; initrd = initialRamdisk + "/initrd"; + inherit extraKernelParams; }; diff --git a/test/system-configuration.sh b/test/system-configuration.sh index 06472ae8d83..11254a24d0a 100644 --- a/test/system-configuration.sh +++ b/test/system-configuration.sh @@ -6,7 +6,7 @@ ln -s $kernel $out/kernel ln -s $grub $out/grub cat > $out/menu.lst << GRUBEND -kernel $kernel selinux=0 apm=on acpi=on init=$bootStage2 +kernel $kernel selinux=0 apm=on acpi=on init=$bootStage2 $extraKernelParams initrd $initrd GRUBEND -- GitLab From 0b1caba9d8d0e93d0c57be6e6e45b92f2d89ddbc Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 26 Nov 2006 23:00:30 +0000 Subject: [PATCH 0256/5331] * Use fbsplash / splashutils to give virtual consoles a nice background. Each console can have a different theme. The mapping from consoles to themes is specified in splash-themes.nix. svn path=/nixu/trunk/; revision=7137 --- test/boot-environment.nix | 8 ++++ test/splash-themes.nix | 45 ++++++++++++++++++++ test/upstart-jobs/tty-backgrounds-combine.sh | 37 ++++++++++++++++ test/upstart-jobs/tty-backgrounds.nix | 44 +++++++++++++++++++ test/upstart-jobs/unpack-theme.sh | 16 +++++++ 5 files changed, 150 insertions(+) create mode 100644 test/splash-themes.nix create mode 100644 test/upstart-jobs/tty-backgrounds-combine.sh create mode 100644 test/upstart-jobs/tty-backgrounds.nix create mode 100644 test/upstart-jobs/unpack-theme.sh diff --git a/test/boot-environment.nix b/test/boot-environment.nix index af7b9678518..05099ee97bb 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -113,6 +113,14 @@ rec { inherit (pkgs) openssh; }) + # Transparent TTY backgrounds. + (import ./upstart-jobs/tty-backgrounds.nix { + inherit (pkgs) stdenv splashutils; + backgrounds = (import ./splash-themes.nix { + inherit (pkgs) fetchurl; + }).ttyBackgrounds; + }) + # Handles the maintenance/stalled event (single-user shell). (import ./upstart-jobs/maintenance-shell.nix { inherit (pkgs) bash; diff --git a/test/splash-themes.nix b/test/splash-themes.nix new file mode 100644 index 00000000000..cbc725dda1c --- /dev/null +++ b/test/splash-themes.nix @@ -0,0 +1,45 @@ +{fetchurl}: + +rec { + + # Some themes. + + themeBabyTux = fetchurl { + url = http://www.bootsplash.de/files/themes/Theme-BabyTux.tar.bz2; + md5 = "a6d89d1c1cff3b6a08e2f526f2eab4e0"; + }; + + themeFrozenBubble = fetchurl { + url = http://www.bootsplash.de/files/themes/Theme-FrozenBubble.tar.bz2; + md5 = "da49f04988ab04b7e0de117b0d25061a"; + }; + + themePativo = fetchurl { + url = http://www.bootsplash.de/files/themes/Theme-Pativo.tar.bz2; + md5 = "9e13beaaadf88d43a5293e7ab757d569"; + }; + + + # The themes to use for each tty. For each tty except the first + # entry in the list, you can omit `theme' to get the same theme as + # the first one. If a tty does not appear, it doesn't get a + # theme (i.e., it will keep a black background). + + ttyBackgrounds = [ + { tty = 1; + theme = themeBabyTux; + } + { tty = 2; + } + { tty = 3; + theme = themeFrozenBubble; + } + { tty = 4; + theme = themePativo; + } + { tty = 6; + theme = themeFrozenBubble; + } + ]; + +} diff --git a/test/upstart-jobs/tty-backgrounds-combine.sh b/test/upstart-jobs/tty-backgrounds-combine.sh new file mode 100644 index 00000000000..50bab1fcd8c --- /dev/null +++ b/test/upstart-jobs/tty-backgrounds-combine.sh @@ -0,0 +1,37 @@ +source $stdenv/setup + +ttys=($ttys) +themes=($themes) + +ensureDir $out + +default= + +for ((n = 0; n < ${#ttys[*]}; n++)); do + tty=${ttys[$n]} + theme=${themes[$n]} + + if test "$theme" = "default"; then + if test -z "$default"; then + echo "No default theme!" + exit 1 + fi + theme=$default + fi + + if test -z "$default"; then default=$theme; fi + + echo "TTY $tty -> $theme" + + themeName=$(cd $theme && ls) + + ln -sf $theme/$themeName $out/$themeName + + if test -e $out/$tty; then + echo "Multiple themes defined for the same TTY!" + exit 1 + fi + + ln -sf $themeName $out/$tty + +done diff --git a/test/upstart-jobs/tty-backgrounds.nix b/test/upstart-jobs/tty-backgrounds.nix new file mode 100644 index 00000000000..fd8eabea6a6 --- /dev/null +++ b/test/upstart-jobs/tty-backgrounds.nix @@ -0,0 +1,44 @@ +{stdenv, splashutils, backgrounds}: + +rec { + name = "tty-backgrounds"; + + unpackTheme = theme: stdenv.mkDerivation { + name = "theme"; + builder = ./unpack-theme.sh; + inherit theme; + }; + + themesUnpacked = stdenv.mkDerivation { + name = "splash-themes"; + builder = ./tty-backgrounds-combine.sh; + # !!! Should use XML here. + ttys = map (x: x.tty) backgrounds; + themes = map (x: if x ? theme then (unpackTheme x.theme) else "default") backgrounds; + }; + + job = " +start on hardware-scan + +script + + rm -f /etc/splash + ln -s ${themesUnpacked} /etc/splash + + # Critical: tell the kernel where to find splash_helper. It calls + # this program every time we switch between consoles. + echo ${splashutils}/bin/splash_helper > /proc/sys/kernel/fbsplash + + # Set the theme for each console, as determined by + # tty-backgrounds-combine.sh above. + for tty in ${toString (map (x: x.tty) backgrounds)}; do + theme=$(readlink ${themesUnpacked}/$tty) + ${splashutils}/bin/splash_util --tty $tty -c setcfg -t $theme || true + ${splashutils}/bin/splash_util --tty $tty -c setpic -t $theme || true + ${splashutils}/bin/splash_util --tty $tty -c on || true + done + +end script + "; + +} diff --git a/test/upstart-jobs/unpack-theme.sh b/test/upstart-jobs/unpack-theme.sh new file mode 100644 index 00000000000..c3a860692e5 --- /dev/null +++ b/test/upstart-jobs/unpack-theme.sh @@ -0,0 +1,16 @@ +source $stdenv/setup + +ensureDir $out + +tar xvfj $theme -C $out + +themeName=$(cd $out && ls) + +for i in $out/$themeName/config/*.cfg; do + echo "converting $i" + # Rewrite /etc paths. Also, the file names + # config/bootsplash-.cfg should be .cfg. + sed "s^/etc/bootsplash/themes^$out^g" < $i > $out/$themeName/$(basename $i | sed 's^.*-^^') +done + +rm $out/$themeName/config/*.cfg -- GitLab From 19659d26c2bec431b4e538dfeed2dc4282405417 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 26 Nov 2006 23:26:37 +0000 Subject: [PATCH 0257/5331] * Allow the tty-backgrounds service to be stopped, and remove the themes from all consoles when we do so. svn path=/nixu/trunk/; revision=7140 --- test/splash-themes.nix | 15 ++++++++++----- test/upstart-jobs/tty-backgrounds.nix | 12 +++++++++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/test/splash-themes.nix b/test/splash-themes.nix index cbc725dda1c..72ab07bcae5 100644 --- a/test/splash-themes.nix +++ b/test/splash-themes.nix @@ -14,11 +14,16 @@ rec { md5 = "da49f04988ab04b7e0de117b0d25061a"; }; - themePativo = fetchurl { + themePativo = fetchurl { # Yeah! url = http://www.bootsplash.de/files/themes/Theme-Pativo.tar.bz2; md5 = "9e13beaaadf88d43a5293e7ab757d569"; }; + themeGNU = fetchurl { + url = http://www.bootsplash.de/files/themes/Theme-GNU.tar.bz2; + md5 = "61969309d23c631e57b0a311102ef034"; + }; + # The themes to use for each tty. For each tty except the first # entry in the list, you can omit `theme' to get the same theme as @@ -32,13 +37,13 @@ rec { { tty = 2; } { tty = 3; - theme = themeFrozenBubble; + theme = themeGNU; } { tty = 4; - theme = themePativo; + theme = themeGNU; } - { tty = 6; - theme = themeFrozenBubble; + { tty = 5; + theme = themePativo; } ]; diff --git a/test/upstart-jobs/tty-backgrounds.nix b/test/upstart-jobs/tty-backgrounds.nix index fd8eabea6a6..3282a879279 100644 --- a/test/upstart-jobs/tty-backgrounds.nix +++ b/test/upstart-jobs/tty-backgrounds.nix @@ -20,7 +20,7 @@ rec { job = " start on hardware-scan -script +start script rm -f /etc/splash ln -s ${themesUnpacked} /etc/splash @@ -39,6 +39,16 @@ script done end script + +respawn sleep 10000 # !!! Hack + +stop script + # Disable the theme on each console. + for tty in ${toString (map (x: x.tty) backgrounds)}; do + ${splashutils}/bin/splash_util --tty $tty -c off || true + done +end script + "; } -- GitLab From 05acdb8610309cc4624818b494bf27f990feef1a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 26 Nov 2006 23:32:15 +0000 Subject: [PATCH 0258/5331] * Put something on the logging console. svn path=/nixu/trunk/; revision=7141 --- test/splash-themes.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/splash-themes.nix b/test/splash-themes.nix index 72ab07bcae5..cc3a7b756fa 100644 --- a/test/splash-themes.nix +++ b/test/splash-themes.nix @@ -45,6 +45,9 @@ rec { { tty = 5; theme = themePativo; } + { tty = 10; # logging console + theme = themeGNU; + } ]; } -- GitLab From 0905c1525a98f967f339fd0c7b88618c9fc10d9b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 26 Nov 2006 23:54:49 +0000 Subject: [PATCH 0259/5331] * Refactoring. svn path=/nixu/trunk/; revision=7142 --- test/helpers/unpack-theme.nix | 7 +++++++ test/{upstart-jobs => helpers}/unpack-theme.sh | 2 ++ test/upstart-jobs/tty-backgrounds-combine.sh | 2 +- test/upstart-jobs/tty-backgrounds.nix | 6 ++---- 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 test/helpers/unpack-theme.nix rename test/{upstart-jobs => helpers}/unpack-theme.sh (92%) diff --git a/test/helpers/unpack-theme.nix b/test/helpers/unpack-theme.nix new file mode 100644 index 00000000000..69d2eebe530 --- /dev/null +++ b/test/helpers/unpack-theme.nix @@ -0,0 +1,7 @@ +{stdenv, theme}: + +stdenv.mkDerivation { + name = "theme"; + builder = ./unpack-theme.sh; + inherit theme; +} diff --git a/test/upstart-jobs/unpack-theme.sh b/test/helpers/unpack-theme.sh similarity index 92% rename from test/upstart-jobs/unpack-theme.sh rename to test/helpers/unpack-theme.sh index c3a860692e5..6eda7bcfbd4 100644 --- a/test/upstart-jobs/unpack-theme.sh +++ b/test/helpers/unpack-theme.sh @@ -14,3 +14,5 @@ for i in $out/$themeName/config/*.cfg; do done rm $out/$themeName/config/*.cfg + +ln -s $themeName $out/default diff --git a/test/upstart-jobs/tty-backgrounds-combine.sh b/test/upstart-jobs/tty-backgrounds-combine.sh index 50bab1fcd8c..894952d6940 100644 --- a/test/upstart-jobs/tty-backgrounds-combine.sh +++ b/test/upstart-jobs/tty-backgrounds-combine.sh @@ -23,7 +23,7 @@ for ((n = 0; n < ${#ttys[*]}; n++)); do echo "TTY $tty -> $theme" - themeName=$(cd $theme && ls) + themeName=$(cd $theme && ls | grep -v default) ln -sf $theme/$themeName $out/$themeName diff --git a/test/upstart-jobs/tty-backgrounds.nix b/test/upstart-jobs/tty-backgrounds.nix index 3282a879279..abe6f52305a 100644 --- a/test/upstart-jobs/tty-backgrounds.nix +++ b/test/upstart-jobs/tty-backgrounds.nix @@ -3,10 +3,8 @@ rec { name = "tty-backgrounds"; - unpackTheme = theme: stdenv.mkDerivation { - name = "theme"; - builder = ./unpack-theme.sh; - inherit theme; + unpackTheme = theme: import ../helpers/unpack-theme.nix { + inherit stdenv theme; }; themesUnpacked = stdenv.mkDerivation { -- GitLab From 3a70748bb5df6f726a9dff816bcd329a789cfb2c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 27 Nov 2006 01:35:34 +0000 Subject: [PATCH 0260/5331] * Show a splash screen during booting. The splash screen is displayed by the program /sbin/splash_helper in the initrd and is called even before /init. * make-initrd.nix: allow a list of FSOs to be placed in the initrd, with a symlink to each top-level FSO (e.g., /init, /sbin/splash_helper, /etc/splash). * make-initrd.nix: pre-create /proc, /dev and /sys, because splash_helper needs them. svn path=/nixu/trunk/; revision=7144 --- test/boot-environment.nix | 28 +++++++++++++++++++---- test/boot-stage-1-init.sh | 6 ++--- test/make-initrd.nix | 18 ++++++++++----- test/make-initrd.sh | 47 ++++++++++++++++++++++++++++----------- test/splash-themes.nix | 5 +++++ 5 files changed, 78 insertions(+), 26 deletions(-) diff --git a/test/boot-environment.nix b/test/boot-environment.nix index 05099ee97bb..61638c2980c 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -28,6 +28,12 @@ rec { nix = pkgs.nixUnstable; # we need the exportReferencesGraph feature + # Splash configuration. + splashThemes = import ./splash-themes.nix { + inherit (pkgs) fetchurl; + }; + + # Determine the set of modules that we need to mount the root FS. modulesClosure = import ./modules-closure.nix { inherit (pkgs) stdenv kernel module_init_tools; @@ -45,10 +51,12 @@ rec { 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; }; @@ -71,7 +79,21 @@ rec { # the initial RAM disk. initialRamdisk = import ./make-initrd.nix { inherit (pkgs) stdenv cpio; - init = bootStage1; + contents = [ + { object = bootStage1; + symlink = "/init"; + } + { object = extraUtils; + suffix = "/bin/splash_helper"; + symlink = "/sbin/splash_helper"; + } + { object = import ./helpers/unpack-theme.nix { + inherit (pkgs) stdenv; + theme = splashThemes.splashScreen; + }; + symlink = "/etc/splash"; + } + ]; }; @@ -116,9 +138,7 @@ rec { # Transparent TTY backgrounds. (import ./upstart-jobs/tty-backgrounds.nix { inherit (pkgs) stdenv splashutils; - backgrounds = (import ./splash-themes.nix { - inherit (pkgs) fetchurl; - }).ttyBackgrounds; + backgrounds = splashThemes.ttyBackgrounds; }) # Handles the maintenance/stalled event (single-user shell). diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index b25ce05368e..d62bd157975 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -24,11 +24,11 @@ done # Mount special file systems. -mkdir /etc # to shut up mount +mkdir -p /etc # to shut up mount touch /etc/fstab # idem -mkdir /proc +mkdir -p /proc mount -t proc none /proc -mkdir /sys +mkdir -p /sys mount -t sysfs none /sys diff --git a/test/make-initrd.nix b/test/make-initrd.nix index 2fb52f121fb..a28c312564e 100644 --- a/test/make-initrd.nix +++ b/test/make-initrd.nix @@ -1,5 +1,5 @@ # Create an initial ramdisk containing the closure of the specified -# `init' package. An initial ramdisk is used during the initial +# file system objects. An initial ramdisk is used during the initial # stages of booting a Linux system. It is loaded by the boot loader # along with the kernel image. It's supposed to contain everything # (such as kernel modules) necessary to allow us to mount the root @@ -8,18 +8,24 @@ # # An initrd is really just a gzipped cpio archive. # -# A symlink `/init' is made to the store path passed in the `init' +# Symlinks are created for each top-level file system object. E.g., +# `contents = {object = ...; symlink = /init;}' is a typical # argument. -{stdenv, cpio, init}: +{stdenv, cpio, contents}: stdenv.mkDerivation { name = "initrd"; builder = ./make-initrd.sh; buildInputs = [cpio]; - inherit init; + + # !!! should use XML. + objects = map (x: x.object) contents; + symlinks = map (x: x.symlink) contents; + suffices = map (x: if x ? suffix then x.suffix else "none") contents; - # For obtaining the closure of `init'. - exportReferencesGraph = ["init-closure" init]; + # For obtaining the closure of `contents'. + exportReferencesGraph = + map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents; pathsFromGraph = ./paths-from-graph.sh; } diff --git a/test/make-initrd.sh b/test/make-initrd.sh index ea2ca5819a6..8d07300466b 100644 --- a/test/make-initrd.sh +++ b/test/make-initrd.sh @@ -2,20 +2,41 @@ source $stdenv/setup set -o pipefail -# Get the paths in the closure of `init'. -if ! test -e ./init-closure; then - echo 'Your Nix installation is too old! Upgrade to nix-0.11pre7038 or newer.' - exit 1 -fi -storePaths=$($SHELL $pathsFromGraph ./init-closure) - -# Paths in cpio archives *must* be relative, otherwise the kernel -# won't unpack 'em. +objects=($objects) +symlinks=($symlinks) +suffices=($suffices) + mkdir root -cd root -cp -prd --parents $storePaths . + +# Needed for splash_helper, which gets run before init. +mkdir root/dev +mkdir root/sys +mkdir root/proc + + +for ((n = 0; n < ${#objects[*]}; n++)); do + object=${objects[$n]} + symlink=${symlinks[$n]} + suffix=${suffices[$n]} + if test "$suffix" = none; then suffix=; fi + + # Get the paths in the closure of `object'. + closure=closure-$(basename $symlink) + if ! test -e $closure; then + echo 'Your Nix installation is too old! Upgrade to nix-0.11pre7038 or newer.' + exit 1 + fi + storePaths=$($SHELL $pathsFromGraph $closure) + + # Paths in cpio archives *must* be relative, otherwise the kernel + # won't unpack 'em. + (cd root && cp -prd --parents $storePaths .) + + mkdir -p $(dirname root/$symlink) + ln -s $object$suffix root/$symlink +done + # Put the closure in a gzipped cpio archive. ensureDir $out -ln -s $init init -find * -print0 | cpio -ov -H newc --null | gzip -9 > $out/initrd +(cd root && find * -print0 | cpio -ov -H newc --null | gzip -9 > $out/initrd) diff --git a/test/splash-themes.nix b/test/splash-themes.nix index cc3a7b756fa..25be6168b37 100644 --- a/test/splash-themes.nix +++ b/test/splash-themes.nix @@ -25,6 +25,11 @@ rec { }; + # The splash screen. + + splashScreen = themeBabyTux; + + # The themes to use for each tty. For each tty except the first # entry in the list, you can omit `theme' to get the same theme as # the first one. If a tty does not appear, it doesn't get a -- GitLab From 8c0b223c3cbf6fc62dc8b488252d66233fc74e95 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 27 Nov 2006 13:51:08 +0000 Subject: [PATCH 0261/5331] * Only run grub-install in switch-to-configuration when NIXOS_INSTALL_GRUB is set (which we do in the installer). svn path=/nixu/trunk/; revision=7146 --- test/installer.sh | 2 +- test/system-configuration.sh | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/installer.sh b/test/installer.sh index d3f747c8310..04c3c80c212 100644 --- a/test/installer.sh +++ b/test/installer.sh @@ -129,4 +129,4 @@ echo "$targetDevice / somefs rw 0 0" > $mountPoint/etc/mtab # a menu default pointing at the kernel/initrd/etc of the new # configuration. echo "finalising the installation..." -chroot $mountPoint /nix/var/nix/profiles/system/bin/switch-to-configuration +NIXOS_INSTALL_GRUB=1 chroot $mountPoint /nix/var/nix/profiles/system/bin/switch-to-configuration diff --git a/test/system-configuration.sh b/test/system-configuration.sh index 11254a24d0a..a9351f97ade 100644 --- a/test/system-configuration.sh +++ b/test/system-configuration.sh @@ -19,7 +19,9 @@ export PATH=$coreutils/bin:$gnused/bin:$gnugrep/bin:$diffutils/bin if test -n "$grubDevice"; then mkdir -m 0700 -p /boot/grub $grubMenuBuilder $out - $grub/sbin/grub-install "$grubDevice" --no-floppy --recheck + if test "\$NIXOS_INSTALL_GRUB" = 1; then + $grub/sbin/grub-install "$grubDevice" --no-floppy --recheck + fi fi EOF -- GitLab From 5bc78ac1510e57ee7fe74c6e0a9af3de4fded72b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 27 Nov 2006 13:59:50 +0000 Subject: [PATCH 0262/5331] * Don't hardcode selinux=0 etc. * Store the paths of init and initrd. svn path=/nixu/trunk/; revision=7147 --- test/boot-environment.nix | 1 - test/system-configuration.nix | 9 ++++++++- test/system-configuration.sh | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/test/boot-environment.nix b/test/boot-environment.nix index 61638c2980c..a9d85eb773c 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -212,7 +212,6 @@ rec { pkgs.shadowutils pkgs.strace pkgs.sysklogd -# pkgs.sysvinit # pkgs.vim nix nixosInstaller diff --git a/test/system-configuration.nix b/test/system-configuration.nix index dee0461c2e4..640f17f907e 100644 --- a/test/system-configuration.nix +++ b/test/system-configuration.nix @@ -16,7 +16,14 @@ let }; # Extra kernel command line arguments. - extraKernelParams = "vga=0x317 console=tty1 splash=verbose"; + extraKernelParams = [ + "selinux=0" + "apm=on" + "acpi=on" + "vga=0x317" + "console=tty1" + "splash=verbose" + ]; in diff --git a/test/system-configuration.sh b/test/system-configuration.sh index a9351f97ade..fa2e7def257 100644 --- a/test/system-configuration.sh +++ b/test/system-configuration.sh @@ -4,9 +4,12 @@ ensureDir $out ln -s $kernel $out/kernel ln -s $grub $out/grub +ln -s $bootStage2 $out/init +ln -s $initrd $out/initrd +echo "$extraKernelParams" > $out/kernel-params cat > $out/menu.lst << GRUBEND -kernel $kernel selinux=0 apm=on acpi=on init=$bootStage2 $extraKernelParams +kernel $kernel init=$bootStage2 $extraKernelParams initrd $initrd GRUBEND -- GitLab From e68fc42aa3db5546a63a2fc3597f7235f12d4dd1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 27 Nov 2006 15:07:46 +0000 Subject: [PATCH 0263/5331] * Prototyping a bit: first class options. We want the configuration of NixOS to be specified externally from the main Nix expressions (since an installation would be hard to maintain if users started editing the NixOS expressions directory). But to make that user-friendly we need: - Hierarchical options (just like the Nixpkgs configuration). - Option descriptions from which documentation can be generated. - Validation (e.g., does each option exist? does it have a valid value?). - The option declarations should be inside the Nix expressions to which they are relevant (rather than, say, one big file with option declarations). svn path=/nixu/trunk/; revision=7148 --- test/options.nix | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 test/options.nix diff --git a/test/options.nix b/test/options.nix new file mode 100644 index 00000000000..2b58044c5ed --- /dev/null +++ b/test/options.nix @@ -0,0 +1,97 @@ +[ + + (option { + name = ["networking" "hostname"]; + default = "nixos"; + description = "The name of the machine." + }) + + (option { + name = ["networking" "useDHCP"]; + default = true; + description = " + Whether to use DHCP to obtain an IP adress and other + configuration for all network interfaces that are not manually + configured. + " + }) + + (option { + name = ["networking" "interfaces"]; + default = []; + example = [ + { interface = "eth0"; + ipAddress = "131.211.84.78"; + netmask = "255.255.255.128"; + gateway = "131.211.84.1"; + } + ]; + description = " + The configuration for each network interface. If + is true, then each interface + not listed here will be configured using DHCP. + " + }) + + (option { + name = ["filesystems" "mountPoints"]; + example = [ + { device = "/dev/hda2"; + mountPoint = "/"; + } + ]; + description = " + The file systems to be mounted by NixOS. It must include an + entry for the root directory (mountPoint = + \"/\"). This is the file system on which NixOS is (to + be) installed.. + "; + }) + + (option { + name = ["services" "syslogd" "tty"]; + default = 10; + description = " + The tty device on which syslogd will print important log + messages. + "; + }) + + (option { + name = ["services" "mingetty" "ttys"]; + default = [1 2 3 4 5 6]; + description = " + The list of tty (virtual console) devices on which to start a + login prompt. + "; + }) + + (option { + name = ["services" "mingetty" "waitOnMounts"]; + default = false; + description = " + Whether the login prompts on the virtual consoles will be + started before or after all file systems have been mounted. By + default we don't wait, but if for example your /home is on a + separate partition, you may want to turn this on. + "; + }) + + (option { + name = ["services" "sshd" "enable"]; + default = false; + description = " + Whether to enable the Secure Shell daemon, which allows secure + remote logins. + "; + }) + + (option { + name = ["services" "sshd" "forwardX11"]; + default = false; + description = " + Whether to enable sshd to forward X11 connections. + "; + }) + +] -- GitLab From 67bada088620a42b65762f231099fb8de27a2af0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 27 Nov 2006 15:32:11 +0000 Subject: [PATCH 0264/5331] * Utility: rebuild the NixOS configuration and switch to it. svn path=/nixu/trunk/; revision=7149 --- test/upgrade.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 test/upgrade.sh diff --git a/test/upgrade.sh b/test/upgrade.sh new file mode 100755 index 00000000000..97dc4fa4826 --- /dev/null +++ b/test/upgrade.sh @@ -0,0 +1,4 @@ +#! /bin/sh +set -e +nix-env -p /nix/var/nix/profiles/system -f system-configuration.nix -i -A systemConfiguration +/nix/var/nix/profiles/system/bin/switch-to-configuration -- GitLab From 1a0fcfdf1a890881aea0ff86ee97f7845bb4beaa Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 27 Nov 2006 16:26:51 +0000 Subject: [PATCH 0265/5331] * User configuration: use the `networking.hostname' option to configure the host name. svn path=/nixu/trunk/; revision=7150 --- test/boot-environment.nix | 39 ++++++++++++++++++++++++++++++++-- test/boot-stage-2-init.sh | 2 +- test/boot-stage-2.nix | 4 +++- test/options.nix | 44 +++++++++++++++++++-------------------- 4 files changed, 63 insertions(+), 26 deletions(-) diff --git a/test/boot-environment.nix b/test/boot-environment.nix index a9d85eb773c..78086e99cfc 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -183,8 +183,7 @@ rec { # everything else to bring up the system. bootStage2 = import ./boot-stage-2.nix { inherit (pkgs) genericSubstituter coreutils findutils - utillinux kernel udev - upstart; + utillinux kernel udev upstart; inherit upstartJobs; shell = pkgs.bash + "/bin/sh"; @@ -218,6 +217,42 @@ rec { ]; inherit readOnlyRoot; + + hostName = config.get ["networking" "hostname"]; + }; + + + lib = import ./pkgs/lib; + + + config = rec { + + # The user configuration. + config = { + networking = { + hostname = "vindaloo"; + }; + }; + + # The option declarations, i.e., option names with defaults and + # documentation. + declarations = import ./options.nix; + + # Get the option named `name' from the user configuration, using + # its default value if it's not defined. + get = name: + let + sameName = lib.filter (opt: lib.eqLists opt.name name) declarations; + default = + if sameName == [] + then abort ("Undeclared option `" + printName name + "'.") + else if !builtins.head sameName ? default + then abort ("Option `" + printName name + "' has no default.") + else (builtins.head sameName).default; + in lib.getAttr name default config; + + printName = name: lib.concatStrings (lib.intersperse "." name); + }; diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh index 58277751680..57a6a20a71f 100644 --- a/test/boot-stage-2-init.sh +++ b/test/boot-stage-2-init.sh @@ -157,7 +157,7 @@ EOF # Set the host name. -hostname nixos +hostname @hostName@ # Start an interactive shell. diff --git a/test/boot-stage-2.nix b/test/boot-stage-2.nix index 1bf8856f480..7d73e37cb4f 100644 --- a/test/boot-stage-2.nix +++ b/test/boot-stage-2.nix @@ -8,12 +8,14 @@ , # The Upstart job configuration. upstartJobs + +, hostName }: genericSubstituter { src = ./boot-stage-2-init.sh; isExecutable = true; - inherit shell kernel upstart readOnlyRoot upstartJobs; + inherit shell kernel upstart readOnlyRoot upstartJobs hostName; path = [ coreutils findutils diff --git a/test/options.nix b/test/options.nix index 2b58044c5ed..4cd2f3a7343 100644 --- a/test/options.nix +++ b/test/options.nix @@ -1,22 +1,22 @@ -[ +[ - (option { + { name = ["networking" "hostname"]; default = "nixos"; - description = "The name of the machine." - }) + description = "The name of the machine."; + } - (option { + { name = ["networking" "useDHCP"]; default = true; description = " Whether to use DHCP to obtain an IP adress and other configuration for all network interfaces that are not manually configured. - " - }) + "; + } - (option { + { name = ["networking" "interfaces"]; default = []; example = [ @@ -30,10 +30,10 @@ The configuration for each network interface. If is true, then each interface not listed here will be configured using DHCP. - " - }) + "; + } - (option { + { name = ["filesystems" "mountPoints"]; example = [ { device = "/dev/hda2"; @@ -46,27 +46,27 @@ \"/\"). This is the file system on which NixOS is (to be) installed.. "; - }) + } - (option { + { name = ["services" "syslogd" "tty"]; default = 10; description = " The tty device on which syslogd will print important log messages. "; - }) + } - (option { + { name = ["services" "mingetty" "ttys"]; default = [1 2 3 4 5 6]; description = " The list of tty (virtual console) devices on which to start a login prompt. "; - }) + } - (option { + { name = ["services" "mingetty" "waitOnMounts"]; default = false; description = " @@ -75,23 +75,23 @@ default we don't wait, but if for example your /home is on a separate partition, you may want to turn this on. "; - }) + } - (option { + { name = ["services" "sshd" "enable"]; default = false; description = " Whether to enable the Secure Shell daemon, which allows secure remote logins. "; - }) + } - (option { + { name = ["services" "sshd" "forwardX11"]; default = false; description = " Whether to enable sshd to forward X11 connections. "; - }) + } ] -- GitLab From 0817c307dcd33a6868781c61a48b359e6a6f70da Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 27 Nov 2006 19:49:05 +0000 Subject: [PATCH 0266/5331] * Moving stuff around. svn path=/nixos/trunk/; revision=7155 --- test/README => README | 0 STABLE | 1 - VERSION | 1 - ...ot-environment.nix => boot-environment.nix | 0 ...ot-stage-1-init.sh => boot-stage-1-init.sh | 0 test/boot-stage-1.nix => boot-stage-1.nix | 0 ...ot-stage-2-init.sh => boot-stage-2-init.sh | 0 test/boot-stage-2.nix => boot-stage-2.nix | 0 boot/boot.sh | 43 -- boot/builder.sh | 46 --- boot/default.nix | 20 - boot/env.sh | 1 - boot/halt.sh | 12 - boot/login.sh | 15 - doc/X-howto | 16 - doc/configuration.txt | 25 -- doc/howto | 117 ------ fill-disk.sh | 374 ------------------ ...ub-menu-builder.sh => grub-menu-builder.sh | 0 {test/helpers => helpers}/unpack-theme.nix | 0 {test/helpers => helpers}/unpack-theme.sh | 0 init.sh | 79 ---- init/builder.sh | 42 -- init/default.nix | 11 - init/install-disk.sh | 176 --------- init/prepare-disk.sh | 70 ---- install.sh | 3 - test/installer.nix => installer.nix | 0 test/installer.sh => installer.sh | 0 isolinux.cfg | 2 +- login.sh | 27 -- test/make-devices.sh => make-devices.sh | 0 make-disk.sh | 329 --------------- test/make-initrd.nix => make-initrd.nix | 0 test/make-initrd.sh => make-initrd.sh | 0 ...so9660-image.nix => make-iso9660-image.nix | 0 ...-iso9660-image.sh => make-iso9660-image.sh | 0 ...modules-closure.nix => modules-closure.nix | 0 test/modules-closure.sh => modules-closure.sh | 0 test/options.nix => options.nix | 0 ...paths-from-graph.sh => paths-from-graph.sh | 0 pkgs.nix | 44 --- pure/devices.nix | 20 - pure/disks.nix | 84 ---- pure/networking.nix | 58 --- pure/top-level.nix | 26 -- ramdisk-login.sh | 15 - test/rescue-cd.nix => rescue-cd.nix | 0 run.sh | 7 - test/splash-themes.nix => splash-themes.nix | 0 storepaths_format | 13 - ...figuration.nix => system-configuration.nix | 0 ...onfiguration.sh => system-configuration.sh | 0 test/isolinux.cfg | 6 - test/upgrade.sh => upgrade.sh | 0 .../ctrl-alt-delete.nix | 0 .../dhclient.nix | 0 .../upstart-jobs => upstart-jobs}/gather.nix | 0 {test/upstart-jobs => upstart-jobs}/halt.nix | 0 .../hardware-scan.nix | 0 .../maintenance-shell.nix | 0 .../make-job.nix | 0 .../mingetty.nix | 0 .../network-interfaces.nix | 0 {test/upstart-jobs => upstart-jobs}/sshd.nix | 0 .../upstart-jobs => upstart-jobs}/syslogd.nix | 0 .../tty-backgrounds-combine.sh | 0 .../tty-backgrounds.nix | 0 68 files changed, 1 insertion(+), 1682 deletions(-) rename test/README => README (100%) delete mode 100644 STABLE delete mode 100644 VERSION rename test/boot-environment.nix => boot-environment.nix (100%) rename test/boot-stage-1-init.sh => boot-stage-1-init.sh (100%) rename test/boot-stage-1.nix => boot-stage-1.nix (100%) rename test/boot-stage-2-init.sh => boot-stage-2-init.sh (100%) rename test/boot-stage-2.nix => boot-stage-2.nix (100%) delete mode 100644 boot/boot.sh delete mode 100755 boot/builder.sh delete mode 100644 boot/default.nix delete mode 100644 boot/env.sh delete mode 100644 boot/halt.sh delete mode 100644 boot/login.sh delete mode 100644 doc/X-howto delete mode 100644 doc/configuration.txt delete mode 100644 doc/howto delete mode 100755 fill-disk.sh rename test/grub-menu-builder.sh => grub-menu-builder.sh (100%) rename {test/helpers => helpers}/unpack-theme.nix (100%) rename {test/helpers => helpers}/unpack-theme.sh (100%) delete mode 100644 init.sh delete mode 100755 init/builder.sh delete mode 100644 init/default.nix delete mode 100755 init/install-disk.sh delete mode 100755 init/prepare-disk.sh delete mode 100644 install.sh rename test/installer.nix => installer.nix (100%) rename test/installer.sh => installer.sh (100%) mode change 100755 => 100644 isolinux.cfg delete mode 100644 login.sh rename test/make-devices.sh => make-devices.sh (100%) delete mode 100755 make-disk.sh rename test/make-initrd.nix => make-initrd.nix (100%) rename test/make-initrd.sh => make-initrd.sh (100%) rename test/make-iso9660-image.nix => make-iso9660-image.nix (100%) rename test/make-iso9660-image.sh => make-iso9660-image.sh (100%) rename test/modules-closure.nix => modules-closure.nix (100%) rename test/modules-closure.sh => modules-closure.sh (100%) rename test/options.nix => options.nix (100%) rename test/paths-from-graph.sh => paths-from-graph.sh (100%) delete mode 100644 pkgs.nix delete mode 100644 pure/devices.nix delete mode 100644 pure/disks.nix delete mode 100644 pure/networking.nix delete mode 100644 pure/top-level.nix delete mode 100644 ramdisk-login.sh rename test/rescue-cd.nix => rescue-cd.nix (100%) delete mode 100755 run.sh rename test/splash-themes.nix => splash-themes.nix (100%) delete mode 100644 storepaths_format rename test/system-configuration.nix => system-configuration.nix (100%) rename test/system-configuration.sh => system-configuration.sh (100%) delete mode 100644 test/isolinux.cfg rename test/upgrade.sh => upgrade.sh (100%) rename {test/upstart-jobs => upstart-jobs}/ctrl-alt-delete.nix (100%) rename {test/upstart-jobs => upstart-jobs}/dhclient.nix (100%) rename {test/upstart-jobs => upstart-jobs}/gather.nix (100%) rename {test/upstart-jobs => upstart-jobs}/halt.nix (100%) rename {test/upstart-jobs => upstart-jobs}/hardware-scan.nix (100%) rename {test/upstart-jobs => upstart-jobs}/maintenance-shell.nix (100%) rename {test/upstart-jobs => upstart-jobs}/make-job.nix (100%) rename {test/upstart-jobs => upstart-jobs}/mingetty.nix (100%) rename {test/upstart-jobs => upstart-jobs}/network-interfaces.nix (100%) rename {test/upstart-jobs => upstart-jobs}/sshd.nix (100%) rename {test/upstart-jobs => upstart-jobs}/syslogd.nix (100%) rename {test/upstart-jobs => upstart-jobs}/tty-backgrounds-combine.sh (100%) rename {test/upstart-jobs => upstart-jobs}/tty-backgrounds.nix (100%) diff --git a/test/README b/README similarity index 100% rename from test/README rename to README diff --git a/STABLE b/STABLE deleted file mode 100644 index c227083464f..00000000000 --- a/STABLE +++ /dev/null @@ -1 +0,0 @@ -0 \ No newline at end of file diff --git a/VERSION b/VERSION deleted file mode 100644 index ceab6e11ece..00000000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1 \ No newline at end of file diff --git a/test/boot-environment.nix b/boot-environment.nix similarity index 100% rename from test/boot-environment.nix rename to boot-environment.nix diff --git a/test/boot-stage-1-init.sh b/boot-stage-1-init.sh similarity index 100% rename from test/boot-stage-1-init.sh rename to boot-stage-1-init.sh diff --git a/test/boot-stage-1.nix b/boot-stage-1.nix similarity index 100% rename from test/boot-stage-1.nix rename to boot-stage-1.nix diff --git a/test/boot-stage-2-init.sh b/boot-stage-2-init.sh similarity index 100% rename from test/boot-stage-2-init.sh rename to boot-stage-2-init.sh diff --git a/test/boot-stage-2.nix b/boot-stage-2.nix similarity index 100% rename from test/boot-stage-2.nix rename to boot-stage-2.nix diff --git a/boot/boot.sh b/boot/boot.sh deleted file mode 100644 index a0cf0d74c90..00000000000 --- a/boot/boot.sh +++ /dev/null @@ -1,43 +0,0 @@ -#! @bash@/bin/sh -e - -set -e - -. @out@/bin/env.sh - -echo "--- Nix ---" - -echo "mounting /proc..." -mount -n -t proc none /proc - -echo "mounting /sys..." -mount -n -t sysfs none /sys - -echo "mounting /dev/pts..." -mount -n -t devpts none /dev/pts - -#echo "checking /dev/root..." -#e2fsck -y /dev/root || test "$?" -le 1 - -echo "remounting / writable..." -mount -n -o remount,rw /dev/root / - -echo "setting up hostname..." -hostname nixos - -echo "cleaning utmp and wtmp..." -echo "" > /var/run/utmp -echo "" > /var/log/wtmp - -echo "loading USB controller modules..." -@module_init_tools@/sbin/modprobe uhci-hcd - -echo "enabling loopback interface..." -ifconfig lo 127.0.0.1 - -echo "enabling ethernet interface..." -ifconfig eth0 $(cat /etc/networking/local-ip) up || true - -echo "setting up routing table..." -route add default gw $(cat /etc/networking/gateway-ip) || true - -echo "boot done." diff --git a/boot/builder.sh b/boot/builder.sh deleted file mode 100755 index 3c33a3669a8..00000000000 --- a/boot/builder.sh +++ /dev/null @@ -1,46 +0,0 @@ -#! /bin/sh -e - -. $stdenv/setup - -mkdir $out -mkdir $out/bin - -for i in $boot $halt $login $env; do - dst=$out/bin/$(basename $i | cut -c34-) - sed \ - -e "s^@bash\@^$bash^g" \ - -e "s^@coreutils\@^$coreutils^g" \ - -e "s^@findutilsWrapper\@^$findutilsWrapper^g" \ - -e "s^@utillinux\@^$utillinux^g" \ - -e "s^@sysvinit\@^$sysvinit^g" \ - -e "s^@e2fsprogs\@^$e2fsprogs^g" \ - -e "s^@nettools\@^$nettools^g" \ - -e "s^@nix\@^$nix^g" \ - -e "s^@wget\@^$wget^g" \ - -e "s^@which\@^$which^g" \ - -e "s^@subversion\@^$subversion^g" \ - -e "s^@vim\@^$vim^g" \ - -e "s^@screen\@^$screen^g" \ - -e "s^@less\@^$less^g" \ - -e "s^@openssh\@^$openssh^g" \ - -e "s^@binutils\@^$binutils^g" \ - -e "s^@strace\@^$strace^g" \ - -e "s^@shadowutils\@^$shadowutils^g" \ - -e "s^@iputils\@^$iputils^g" \ - -e "s^@gnumake\@^$gnumake^g" \ - -e "s^@curl\@^$curl^g" \ - -e "s^@gnused\@^$gnused^g" \ - -e "s^@gnutar\@^$gnutar^g" \ - -e "s^@gnugrep\@^$gnugrep^g" \ - -e "s^@gzip\@^$gzip^g" \ - -e "s^@gcc\@^$gcc^g" \ - -e "s^@mingettyWrapper\@^$mingettyWrapper^g" \ - -e "s^@module_init_tools\@^$module_init_tools^g" \ - -e "s^@grub\@^$grubWrapper^g" \ - -e "s^@dhcpWrapper\@^$dhcpWrapper^g" \ - -e "s^@man\@^$man^g" \ - -e "s^@nano\@^$nano^g" \ - -e "s^@out\@^$out^g" \ - < $i > $dst - chmod +x $dst -done diff --git a/boot/default.nix b/boot/default.nix deleted file mode 100644 index f215104bfe5..00000000000 --- a/boot/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ stdenv, bash, coreutils, findutilsWrapper, utillinux, sysvinit, e2fsprogs -, nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh -, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep , gnutar, gzip -, mingettyWrapper, grubWrapper, parted, module_init_tools, dhcpWrapper -, man, nano}: - -derivation { - name = "boot"; - system = stdenv.system; - builder = ./builder.sh; - boot = ./boot.sh; - halt = ./halt.sh; - login = ./login.sh; - env = ./env.sh; - inherit stdenv bash coreutils findutilsWrapper utillinux sysvinit - e2fsprogs nettools nix subversion gcc wget which vim less screen - openssh strace shadowutils iputils gnumake curl gnused - gnutar gnugrep gzip mingettyWrapper grubWrapper parted - module_init_tools dhcpWrapper man nano; -} diff --git a/boot/env.sh b/boot/env.sh deleted file mode 100644 index e5e6051c0ac..00000000000 --- a/boot/env.sh +++ /dev/null @@ -1 +0,0 @@ -export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutilsWrapper@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingettyWrapper@/sbin:@grub@/bin:@grub@/sbin:@module_init_tools@/bin:@module_init_tools@/sbin:@dhcpWrapper@/sbin:@man@/bin:@nano@/bin diff --git a/boot/halt.sh b/boot/halt.sh deleted file mode 100644 index c6e000b92b6..00000000000 --- a/boot/halt.sh +++ /dev/null @@ -1,12 +0,0 @@ -#! @bash@/bin/sh -e - -. @out@/bin/env.sh - -echo "unmount file systems..." -umount -avt noproc,nonfs,nosmbfs,nodevfs || echo "(failed)" # ignore errors - -echo "syncing..." -sync || echo "(failed)" # ignore errors - -echo "shutting down..." -halt -d -f diff --git a/boot/login.sh b/boot/login.sh deleted file mode 100644 index 14bb418bd9a..00000000000 --- a/boot/login.sh +++ /dev/null @@ -1,15 +0,0 @@ -#! @bash@/bin/sh -e - -. @out@/bin/env.sh - -tty=$1 - -exec < $tty > $tty 2>&1 - -echo -echo "=== Welcome to Nix! ===" - -export HOME=/root -cd $HOME - -exec @bash@/bin/sh diff --git a/doc/X-howto b/doc/X-howto deleted file mode 100644 index 6cf4bd36763..00000000000 --- a/doc/X-howto +++ /dev/null @@ -1,16 +0,0 @@ -Making X work in NixOS (fixing guide) - - Mouse - -* for mouse support /dev/input/mice needs to be there. This device can be -created either automatically with udev, or manually with mknod. - - Fonts - -Right now fonts have to be copied from another machine and put into -/usr/X11R6/lib/X11/fonts - - Config - -in services/trunk/configurations/tyros.cs.uu.nl-xorg/ there is a Nix expression -which builds a working X configuration for use in VMware. diff --git a/doc/configuration.txt b/doc/configuration.txt deleted file mode 100644 index 2275c6e4281..00000000000 --- a/doc/configuration.txt +++ /dev/null @@ -1,25 +0,0 @@ -Configuration in NixOS - -Configuration in NixOS is not very straightforward. On other Linux -distribution site-specific information (password files, host files, and -so on) are stored with information that is rather generic for a lot of -operating systems. To be able to handle these in a gentle way I have decided -to seperate these two a bit more in NixOS. - -In particular, in the /etc directory there is a Nix profile called "configs". -In this profile the generic configuration is kept. In time this can grow -to keep configuration which is site specific, but which can easily be kept -in the store, such as "profile" (default system wide Bourne shell profile) - -Right now two packages should be in this profile: - -* etcServices : installs a file called "services" (/etc/services should -point to this) -* etcProtocols : installs a file called "protocols" (/etc/protocols should -point to this) - -During install time these packages should be installed and the right symlinks -should be made. - -When NIX-40 is closed, we might consider making /etc itself a profile and -keep even more configuration information inside the Nix store. diff --git a/doc/howto b/doc/howto deleted file mode 100644 index 58e3344d6ea..00000000000 --- a/doc/howto +++ /dev/null @@ -1,117 +0,0 @@ -NixOS installation HOWTO -- August 28, 2006 - -This is small HOWTO of how to build and install the current version of -NixOS. - - - Building - -Install Nix. Checkout nixpkgs from Subversion, as well as nixu. Adapt the -scripts in nixu to reflect the location of nixpkgs (default /nixpkgs). -Make sure mktemp is installed. Run ./make-disk.sh. Wait. - - Burning - -Use your favourite tool to burn the ISO image to a CD. - - Installing - -Currently NixOS can only be installed with machines that have a specific -hardware set up: - -An ATA harddisk on the first ATA controller (hda) with: -- data partition -- swap partition - -All data on these two partitions will be wiped and the bootloader in the -Master Boot Record (MBR) will be overwritten with GRUB. - -The NixOS installer will drop you into a shell, from which you can run -fdisk. Then it expects to find a file called "disklayout" with three -variables: - -SWAP :: partition to use as swap -INSTALLDEVICE :: partition that will be /root -TARGETDRIVE :: drive on which grub will be installed - -This file will be read by the install script automatically when you launch -the script: - -# sh fill-disk.sh - -The configuration data that grub writes to disk might not be correct (should -be). When something goes wrong you probably won't have to reinstall. The -manual for grub is quite helpful in these cases. - - Configuring - -To get NixOS in a working state, do the following: - -- load the networkdriver. This is machine dependent. On the labmachines (Dell -Optiplex GX-260) this is the e1000 driver: - -# modprobe e1000 - -In vmware the driver is "pcnet32". - -- bring the interface up: - -# ifconfig eth0 up - -If the interface is different (say, eth1) replace eth0 with the right -interface. - -- if DHCP is used, run a DHCP client to obtain an IP address, routing -and resolving information: - -# dhclient eth0 - -Otherwise, do this yourself: - -# ifconfig eth0 netmask -# route add default gw -# vim /etc/resolv.conf - - Making syslog work. - -- copy /etc/services from a working Linux machine to /etc/services on the -NixOS machine (needed for sysklogd) -- copy /etc/syslog.conf from a working Linux machine to /etc/syslog.conf on the -NixOS machine (needed for sysklogd) -- launch sysklogd - - Making logins on virtual consoles work. - -Logins on virtual consoles are disabled by default. To make them work: - -- edit /etc/inittab and outcomment the lines with "mingetty" in them -- copy /etc/login.defs from a working Linux machine to /etc/login.defs on the -NixOS machine (needed for mingetty). Alternatively, do: - -# touch /etc/login.defs - -- relaunch init - - - Making hotplugging work -- BROKEN RIGHT NOW - -Many devices (USB, Firewire) are controlled by so called "hot plugging". The -kernel executes a program -- usually /sbin/hotplug, but this is configurable -at boottime by setting the right path in /proc/sys/kernel/hotplug -- when a -new device is added to the machine. This program makes sure the right kernel -modules are loaded and optionally, if enabled, sends a message to udev to -create the right device node in /dev (NOTE: this is not enabled in NixOS right -now). - -- mount usbfs (for USB): - # mount -t usbfs usbfs /proc/bus/usb -- install hotplug package - - make symlinks /etc/hotplug, /etc/hotplug.d, /sbin/hotplug (TODO: make - this pure) - - make sure the kernel and additional modules are prepared well (currently - this is hackish, but workable: see kernelscripts/make-kernel.sh for an - example) - - (optionally:) install udev - - make a symlink to /etc/udev/udev.conf - - launch udev - - plug in a device diff --git a/fill-disk.sh b/fill-disk.sh deleted file mode 100755 index 43edcb4dfab..00000000000 --- a/fill-disk.sh +++ /dev/null @@ -1,374 +0,0 @@ -#! @bash@/bin/sh - -set -e - -export PATH=/bin:/sbin:@bash@/bin:@findutils@/bin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@eject@/bin:@dhcp@/sbin:@modutils@/sbin:@busybox@/bin:@busybox@/sbin - -kernel=@kernel@ -xawtv=@xawtv@ - -narStorePaths=/cdrom/narstorepaths - -sysvinitPath=@sysvinitPath@ -bootPath=@bootPath@ -modutils=@modutils@ -mingetty=@mingetty@ - -nixpkgs=/nixpkgs - -echo formatting target device - -if test -e disklayout; then - source disklayout -else - echo no disk layout configuration present...exiting - exit 1 -fi - -# $targetdrive is also used by GRUB! -#targetdrive=/dev/hda -targetdrive=${TARGETDRIVE} -#device=${targetdrive}1 -device=${INSTALLDEVICE} -mkfs.ext2 ${device} -#swapdevice=${targetdrive}2 -swapdevice=${SWAP} -mkswap $swapdevice - -echo enabling swap - -swapon $swapdevice - -#if ! test -n "$1" -#then -# echo "need harddisk device for installing!" -# exit -#else -# device=$1 -#fi - -## -## Two convenience shell functions -## - -make_dir() { - mode=$1 - name=$2 - echo creating $name... - if ! test -d $root/$name; then mkdir $root/$name; fi - chmod $mode $root/$name -} - -touch_file() { - name=$1 - echo touching $name... - if ! test -d $root/$name; then touch $root/$name; fi -} -root=/tmp/mnt - -mkdir -p $root - -echo mounting the target drive - -mount -t ext2 $device $root - -## -## Create a directory tree on the installation disk. -## - -echo creating file system hierarchy on target drive - -make_dir 00755 /bin -make_dir 00755 /boot -make_dir 00755 /cdrom -make_dir 00755 /dev -make_dir 00755 /dev/pts -make_dir 00755 /etc # global non-constant configuration -make_dir 00755 /etc/ssh -make_dir 00755 /etc/sysconfig -make_dir 00755 /home -make_dir 00755 /lib -make_dir 00755 /lib/modules -make_dir 00755 /mnt -make_dir 00755 /mnt/host -make_dir 00755 /nix -make_dir 00755 /nix/store -make_dir 00755 /nix/var -make_dir 00755 /nix/var/nix -make_dir 00755 /nix/var/nix/db -make_dir 00755 /nix/var/nix/gcroots -make_dir 00755 /nix/var/nix/manifests -make_dir 00755 /nix/var/nix/profiles -make_dir 00755 /nix/var/nix/temproots -make_dir 00755 /nix/var/log -make_dir 00755 /nix/var/log/nix -make_dir 00755 /proc -make_dir 00750 /root -make_dir 00755 /sbin -make_dir 00755 /sys -make_dir 01777 /tmp -make_dir 00755 /usr -make_dir 00755 /var -make_dir 00755 /var/empty -make_dir 00111 /var/empty/sshd -make_dir 00755 /var/lock -make_dir 00755 /var/lock/subsys -make_dir 00755 /var/log -make_dir 00755 /var/run -make_dir 00755 /var/run/usb -make_dir 00755 /var/spool -make_dir 00755 /var/state -make_dir 00755 /var/state/dhcp -make_dir 00755 /var/tmp - -## -## Add a few devices to /dev on the install disk. This is by far complete. -## - -echo making device nodes on target drive - -mknod -m 0666 $root/dev/null c 1 3 -mknod -m 0600 $root/dev/console c 5 1 -mknod -m 0600 $root/dev/tty c 5 0 -mknod -m 0600 $root/dev/tty0 c 4 0 -mknod -m 0600 $root/dev/tty1 c 4 1 -mknod -m 0600 $root/dev/tty2 c 4 2 -mknod -m 0600 $root/dev/tty3 c 4 3 -mknod -m 0444 $root/dev/urandom c 1 9 - -## needed for sshd and friends. Should actually be made by udev. -mknod -m 0666 $root/dev/ptmx c 5 2 - -rm -f $root/etc/mtab -ln -s /proc/mounts $root/etc/mtab - -# prevent df from barfing -ln -s /proc/mounts /etc/mtab - -## Probe for CD device which contains our CD here and mount /nix and -## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this. -## Find out how Knoppix and SUSE do this... - -DEVICES="/dev/hd?" - -for i in ${DEVICES} -do -echo "Looking for CDROM in: $i" - if mount -t iso9660 $i /cdrom >/dev/null 2>&1 - then - if test -f /cdrom/NIXOS - then - cddevice=$i - echo "Accessing NixOS CDROM at $i" - break - fi - fi -done - -echo mounting /cdrom in the target - -mount --bind /cdrom $root/cdrom -mount --bind /cdrom/lib /lib - -echo switch to /nix from CD -## starting here it's OK to have full blown glibc - -mount --bind /cdrom/nix /nix - -#echo probing for hardware... - -#kudzu - -export NIX_DATA_DIR=$root/nix/share -export NIX_LOG_DIR=$root/nix/log/nix -export NIX_STATE_DIR=$root/nix/var/nix -export NIX_CONF_DIR=$root/nix/etc -NIX=@nix@/bin - -echo bringing up networking... - -#labmachine has 3c59x -#modprobe 3c59x -#vmware has pcnet32 -#modprobe pcnet32 -#dhclient eth0 - -#cp /etc/resolv.conf $root/etc/resolv.conf - -#nic=`kudzu -p | grep eth | sort | uniq | cut -d ' ' -f 2` - -#echo "NIC: $nic" - -echo initialising Nix DB... -$NIX/nix-store --init - -echo verifying Nix DB... -$NIX/nix-store --verify - -echo copying nixpkgs... -mkdir -p $root/nixpkgs/pkgs -tar --directory=$root/nixpkgs/pkgs -zxf /cdrom/nixpkgs.tgz - -make_dir 0755 /tmp/scripts -cp -fa /cdrom/scripts $root/tmp - -echo adding packages - -export NIX_ROOT=$root -unset NIX_DATA_DIR -unset NIX_LOG_DIR -unset NIX_STATE_DIR -unset NIX_CONF_DIR - -cp /cdrom/mystorepaths $root/tmp - -echo copying store - -tar --directory=$root -zxf /cdrom/nixstore.tgz - -echo registering valid paths... - -$NIX/nix-store --register-validity < $root/tmp/mystorepaths - -unset NIX_ROOT -export NIX_DATA_DIR=$root/nix/share -export NIX_LOG_DIR=$root/nix/log/nix -export NIX_STATE_DIR=$root/nix/var/nix -export NIX_CONF_DIR=$root/nix/etc - -echo creating /bin/sh -ln -s @bashGlibc@/bin/sh $root/bin/sh - -echo adding manifest -$NIX/nix-pull file:///cdrom/MANIFEST - -export NIX_ROOT=$root -unset NIX_DATA_DIR -unset NIX_LOG_DIR -unset NIX_STATE_DIR -unset NIX_CONF_DIR - -## Fix this. Probably nix-instantiate, then nix-store -r. -## Also make sure everything gets installed into an actual profile! - -$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A nix -$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A coreutils -$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A gnugrep -#$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A kernel -$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A kernelscripts -$NIX/nix-env -iKf $nixpkgs/pkgs/top-level/all-packages.nix -A grub - -cat $narStorePaths | xargs -n 1 -i% $NIX/nix-env -i % - -echo setting init symlink... -rm -f $root/init -#ln -s $sysvinitPath/sbin/init $root/init -ln -s @sysvinitPath@/sbin/init $root/sbin/init -#ln -s @bash@/bin/bash $root/bin/bash - -echo setting up inittab... -rm -f $root/etc/inittab -echo "id:2:initdefault:" >> $root/etc/inittab -echo "si::bootwait:$bootPath/bin/boot.sh" >> $root/etc/inittab -echo "ht:06:wait:$bootPath/bin/halt.sh" >> $root/etc/inittab -echo "1:2345:respawn:$bootPath/bin/login.sh /dev/tty1" >> $root/etc/inittab -echo "#2:2345:respawn:$mingetty/sbin/mingetty tty2" >> $root/etc/inittab -echo "#3:2345:respawn:$mingetty/sbin/mingetty tty3" >> $root/etc/inittab -#echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab - -echo setting up networking information... - -make_dir 00755 /etc/networking -#cp /etc/resolv.conf $root/etc -rm -f $root/etc/hosts -echo "127.0.0.1 localhost" >> $root/etc/hosts - -echo storing hardware information... - -#kudzu -p > $root/etc/sysconfig/hwconf -#cp /etc/modprobe.conf $root/etc/ - -echo setting up initial account information... - -echo "root:x:0:root" > $root/etc/group -echo "sshd:x:74:" >> $root/etc/group -echo "root:x:0:0:root:/root:/bin/sh" > $root/etc/passwd -echo "sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin" >> $root/etc/passwd -echo "root::12757:0:99999:7:::" >> $root/etc/shadow -echo "sshd:!!:12757:0:99999:7:::" >> $root/etc/shadow - -echo default profile for root -echo "source @nix@/etc/profile.d/nix.sh" > $root/root/.profile - -touch_file /etc/login.defs -touch_file /etc/services - -## -## Do kernel stuff here. -## -strippedName=$(basename $root/@kernel@); -if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then - strippedName=$(echo "$strippedName" | cut -c34- | cut -c 7-) -fi - -kernelhash=$(basename $root/@kernel@); -if echo "$kernelhash" | grep -q '^[a-z0-9]\{32\}-'; then - kernelhash=$(echo "$kernelhash" | cut -c -32) -fi - -version=$strippedName-$kernelhash - -ln -s @kernelscripts@/lib/modules/$version $root/lib/modules/$version - -## -## init -## - -ln -s $device $root/dev/root -ln -s @sysvinitPath@/sbin/init /sbin/init - -## -## Do funky stuff with grub here. -## - -echo installing bootloader - -grub-install --root-directory=${root} --no-floppy ${targetdrive} - -# FIXME "root (hd0,0)" -cat > $root/boot/grub/menu.lst << GRUBEND -default=0 -timeout=5 -title NixOS - kernel @kernel@/vmlinuz root=$device -GRUBEND - -echo clearing substitutes - -$NIX/nix-store --clear-substitutes - -#echo clearing network information - -#rm $root/etc/resolv.conf - -#echo copying install log - -#cp /tmp/install-log $root/root - -# bizar. busybox umount doesn't like things with --bind it seems. -echo umounting filesystem - -umount $root/cdrom -umount $root -#umount /nix -umount /cdrom -#echo ejecting $cddevice -#eject $cddevice - -echo install done -echo it\'s safe to turn off your machine -echo exiting install process - -#while true; do - #sleep 60; -#done diff --git a/test/grub-menu-builder.sh b/grub-menu-builder.sh similarity index 100% rename from test/grub-menu-builder.sh rename to grub-menu-builder.sh diff --git a/test/helpers/unpack-theme.nix b/helpers/unpack-theme.nix similarity index 100% rename from test/helpers/unpack-theme.nix rename to helpers/unpack-theme.nix diff --git a/test/helpers/unpack-theme.sh b/helpers/unpack-theme.sh similarity index 100% rename from test/helpers/unpack-theme.sh rename to helpers/unpack-theme.sh diff --git a/init.sh b/init.sh deleted file mode 100644 index b17a6637f67..00000000000 --- a/init.sh +++ /dev/null @@ -1,79 +0,0 @@ -#! @bash@/bin/sh -e - -export PATH=/bin:/sbin:@bash@/bin:@findutils@/bin:@busybox@/bin:@busybox@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@eject@/bin:@dhcp@/sbin:@modutils@/sbin - -echo mounting special filesystems - -mount -t proc proc /proc -mount -t sysfs sys /sys - -# make a complete /dev filesystem -# ripped permissions and everything from anaconda (loader2/devices.h) - -echo making device nodes - -# consoles - -#mknod -m 0600 /dev/console c 5 1 -mknod -m 0600 /dev/ttyS0 c 4 64 -mknod -m 0600 /dev/ttyS1 c 4 65 -mknod -m 0600 /dev/ttyS2 c 4 66 -mknod -m 0600 /dev/ttyS3 c 4 67 - -# base UNIX devices -mknod -m 0600 /dev/mem c 1 1 -mknod -m 0666 /dev/null c 1 3 -mknod -m 0666 /dev/zero c 1 5 - -# tty -mknod -m 0600 /dev/tty c 5 0 -mknod -m 0600 /dev/tty0 c 4 0 -mknod -m 0600 /dev/tty1 c 4 1 -mknod -m 0600 /dev/tty2 c 4 2 -mknod -m 0600 /dev/tty3 c 4 3 -mknod -m 0600 /dev/tty4 c 4 4 -mknod -m 0600 /dev/tty5 c 4 5 -mknod -m 0600 /dev/tty6 c 4 6 -mknod -m 0600 /dev/tty7 c 4 7 -mknod -m 0600 /dev/tty8 c 4 8 -mknod -m 0600 /dev/tty9 c 4 9 - -mkdir -m 0755 /dev/pts -mknod -m 0666 /dev/ptmx c 5 2 - -# random - -mknod -m 0644 /dev/random c 1 8 -mknod -m 0644 /dev/urandom c 1 9 - -mknod -m 0660 /dev/hda b 3 0 -mknod -m 0660 /dev/hda1 b 3 1 -mknod -m 0660 /dev/hda2 b 3 2 -mknod -m 0660 /dev/hda3 b 3 3 - -mknod -m 0660 /dev/hdb b 3 64 -mknod -m 0660 /dev/hdb1 b 3 65 -mknod -m 0660 /dev/hdb2 b 3 66 -mknod -m 0660 /dev/hdb3 b 3 67 - -mknod -m 0660 /dev/hdc b 22 0 -mknod -m 0660 /dev/hdc1 b 22 1 -mknod -m 0660 /dev/hdc2 b 22 2 -mknod -m 0660 /dev/hdc3 b 22 3 - -mknod -m 0660 /dev/hdd b 22 64 -mknod -m 0660 /dev/hdd1 b 22 65 -mknod -m 0660 /dev/hdd2 b 22 66 -mknod -m 0660 /dev/hdd3 b 22 67 - -#mknod -m 0660 /dev/sda b 8 0 -#mknod -m 0660 /dev/sda1 b 8 1 -#mknod -m 0660 /dev/sda2 b 8 2 -#mknod -m 0660 /dev/sda3 b 8 3 - -mknod -m 0600 /dev/initctl p - -echo starting emergency shell on tty2 - -exec ./ramdisk-login.sh /dev/tty2 & -exec ./login.sh diff --git a/init/builder.sh b/init/builder.sh deleted file mode 100755 index 15ba03d4780..00000000000 --- a/init/builder.sh +++ /dev/null @@ -1,42 +0,0 @@ -#! /bin/sh -e - -. $stdenv/setup - -mkdir $out -mkdir $out/bin - -#for i in $boot $halt $login $env; do -# dst=$out/bin/$(basename $i | cut -c34-) -# sed \ -# -e "s^@bash\@^$bash^g" \ -# -e "s^@coreutils\@^$coreutils^g" \ -# -e "s^@findutils\@^$findutils^g" \ -# -e "s^@utillinux\@^$utillinux^g" \ -# -e "s^@sysvinit\@^$sysvinit^g" \ -# -e "s^@e2fsprogs\@^$e2fsprogs^g" \ -# -e "s^@nettools\@^$nettools^g" \ -# -e "s^@nix\@^$nix^g" \ -# -e "s^@wget\@^$wget^g" \ -# -e "s^@which\@^$which^g" \ -# -e "s^@subversion\@^$subversion^g" \ -# -e "s^@vim\@^$vim^g" \ -# -e "s^@screen\@^$screen^g" \ -# -e "s^@less\@^$less^g" \ -# -e "s^@openssh\@^$openssh^g" \ -# -e "s^@binutils\@^$binutils^g" \ -# -e "s^@strace\@^$strace^g" \ -# -e "s^@shadowutils\@^$shadowutils^g" \ -# -e "s^@iputils\@^$iputils^g" \ -# -e "s^@gnumake\@^$gnumake^g" \ -# -e "s^@curl\@^$curl^g" \ -# -e "s^@gnused\@^$gnused^g" \ -# -e "s^@gnutar\@^$gnutar^g" \ -# -e "s^@gnugrep\@^$gnugrep^g" \ -# -e "s^@gzip\@^$gzip^g" \ -# -e "s^@gcc\@^$gcc^g" \ -# -e "s^@mingetty\@^$mingetty^g" \ -# -e "s^@grub\@^$grub^g" \ -# -e "s^@out\@^$out^g" \ -# < $i > $dst -# chmod +x $dst -#done diff --git a/init/default.nix b/init/default.nix deleted file mode 100644 index f1b10b5bc8f..00000000000 --- a/init/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grubWrapper, parted, module_init_tools, dhcpWrapper}: - -derivation { - name = "init"; - system = stdenv.system; - builder = ./builder.sh; - stage1 = ./prepare-disk.sh; - stage2 = ./install-disk.sh; - inherit stdenv bash coreutils utillinux e2fsprogs nix shadowutils - mingetty grubWrapper parted module_init_tools dhcpWrapper; -} diff --git a/init/install-disk.sh b/init/install-disk.sh deleted file mode 100755 index de158cda600..00000000000 --- a/init/install-disk.sh +++ /dev/null @@ -1,176 +0,0 @@ -#! @bash@/bin/sh -e - -export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin - -sysvinitPath=@sysvinitPath@ -bootPath=@bootPath@ - -#if ! test -n "$1" -#then -# echo "need harddisk device for installing!" -# exit -#else -# device=$1 -#fi - -device=/dev/hda1 -#device=/dev/sda1 - - -make_dir() { - mode=$1 - name=$2 - echo creating $name... - if ! test -d $root/$name; then mkdir $root/$name; fi - chmod $mode $root/$name -} - - -touch_file() { - name=$1 - echo touching $name... - if ! test -d $root/$name; then touch $root/$name; fi -} -root=/tmp/mnt - -mkdir -p /tmp/mnt - -mount -t ext2 $device /tmp/mnt - -cd /sys; echo * - -# mkdir -p /nix -# mkdir -p /nixpkgs/trunk/pkgs - -# temporary hack -# mount --bind /mnt/cdrom1/nix /nix -# mount --bind /mnt/cdrom1/pkgs /nixpkgs/trunk/pkgs - -## -## Create a directory tree on the installation disk. -## - -make_dir 00755 /bin -make_dir 00755 /dev -make_dir 00755 /proc -make_dir 01777 /tmp -make_dir 00755 /etc # global non-constant configuration -make_dir 00755 /etc-secret -make_dir 00755 /var -make_dir 00755 /nix -make_dir 00755 /nix/store -make_dir 00755 /nix/var -make_dir 00755 /nix/var/nix -make_dir 00755 /nix/var/nix/db -make_dir 00755 /nix/var/nix/manifests -make_dir 00755 /nix/var/log -make_dir 00755 /nix/var/log/nix -make_dir 00755 /nixpkgs -make_dir 00755 /nixpkgs/trunk -make_dir 00755 /mnt -make_dir 00755 /mnt/host -make_dir 00755 /home -make_dir 00755 /home/root - -## -## Add a few devices to /dev on the install disk. This is by far complete. -## - -mknod $root/dev/null c 1 3 - -touch_file /etc/passwd -touch_file /etc/shadow -touch_file /etc/group -touch_file /etc/login.defs - -rm -f $root/etc/mtab -#ln -s /proc/mounts $root/etc/mtab - -cat /proc/mounts - -export NIX_DATA_DIR=$root/nix/share -export NIX_LOG_DIR=$root/nix/log/nix -export NIX_STATE_DIR=$root/nix/var/nix -export NIX_CONF_DIR=$root/nix/etc -NIX_CMD_PATH=@NIX_CMD_PATH@/bin - -echo initialising Nix DB... -#/nix/bin/nix-store --init -$NIX_CMD_PATH/nix-store --init - -echo verifying Nix DB... -$NIX_CMD_PATH/nix-store --verify - -echo copying nixpkgs... -cp -fa ../pkgs $root/nixpkgs/trunk - -make_dir 0755 /tmp/scripts -cp -fa ../scripts $root/tmp - -#echo adding manifest -#$NIX_CMD_PATH/nix-pull $manifest - -echo adding packages -export NIX_ROOT=$root -unset NIX_DATA_DIR -unset NIX_LOG_DIR -unset NIX_STATE_DIR -unset NIX_CONF_DIR - -#storeExpr=$(echo '(import /tmp/scripts/pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) -#storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -) -#$NIX_CMD_PATH/nix-store -r $storeExpr -#echo $storeExpr -#storeExpr2=$($NIX_CMD_PATH/nix-store -qR $($NIX_CMD_PATH/nix-store -r $storeExpr)) -#echo storeExpr $storeExpr -#echo $($NIX_CMD_PATH/nix-store -qR --include-outputs $storeExpr) - -echo copying store - -(while read storepaths; do - cp -fa $storepaths $root/nix/store -done) < /mnt/cdrom1/mystorepaths - -#cp -fa ../nix/store/* $root/nix/store - -#echo registering valid paths... -#(while read storepath; do -# echo PATH $storepath -# if ! $NIX_CMD_PATH/nix-store --isvalid $storepath 2> /dev/null; then -# (unset NIX_ROOT; $NIX_CMD_PATH/nix-store --dump $storepath) | $NIX_CMD_PATH/nix-store --restore $storepath -# $NIX_CMD_PATH/nix-store --validpath $storepath -# fi -#done) < /tmp/mystorepaths - -#echo registering successors... -#(while read line; do -# echo SUCC $line -# $NIX_CMD_PATH/nix-store --successor $line -#done) < /tmp/mysuccessors - -exit - -echo setting init symlink... -rm -f $root/init -ln -s $sysvinitPath/sbin/init $root/init - -echo setting up inittab... -rm -f $root/etc/inittab -echo "id:2:initdefault:" >> $root/etc/inittab -echo "si::bootwait:$bootPath/bin/boot.sh" >> $root/etc/inittab -echo "ht:06:wait:$bootPath/bin/halt.sh" >> $root/etc/inittab -echo "1:2345:respawn:$bootPath/bin/login.sh /dev/ttys/0" >> $root/etc/inittab -#echo "2:2345:respawn:$bootPath/bin/login.sh /dev/ttys/1" >> $root/etc/inittab - -echo setting up networking information... -make_dir 00755 /etc/networking -echo 192.168.150.1 > $root/etc/networking/local-ip -echo 192.168.150.3 > $root/etc/networking/gateway-ip -cp /etc/resolv.conf $root/etc -rm -f $root/etc/hosts -echo "127.0.0.1 localhost" >> $root/etc/hosts -echo "192.168.150.1 uml" >> $root/etc/hosts - -### -### Do funky stuff with grub here. -### diff --git a/init/prepare-disk.sh b/init/prepare-disk.sh deleted file mode 100755 index 8ba9e93ddfc..00000000000 --- a/init/prepare-disk.sh +++ /dev/null @@ -1,70 +0,0 @@ -#! @bash@/bin/sh -e - -export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin - -sysvinitPath=@sysvinitPath@ -bootPath=@bootPath@ - -mount -t proc proc /proc -mount -t sysfs sys /sys - -#mount -t /dev/hdc /installimage - -# make a complete /dev filesystem -# ripped permissions and everything from anaconda (loader2/devices.h) - -# consoles - -#mknod -m 0600 /dev/console c 5 1 -mknod -m 0600 /dev/ttyS0 c 4 64 -mknod -m 0600 /dev/ttyS1 c 4 65 -mknod -m 0600 /dev/ttyS2 c 4 66 -mknod -m 0600 /dev/ttyS3 c 4 67 - -# base UNIX devices -mknod -m 0600 /dev/mem c 1 1 -mknod -m 0666 /dev/null c 1 3 -mknod -m 0666 /dev/zero c 1 5 - -# tty -mknod -m 0600 /dev/tty c 5 0 -mknod -m 0600 /dev/tty0 c 4 0 -mknod -m 0600 /dev/tty1 c 4 1 -mknod -m 0600 /dev/tty2 c 4 2 -mknod -m 0600 /dev/tty3 c 4 3 -mknod -m 0600 /dev/tty4 c 4 4 -mknod -m 0600 /dev/tty5 c 4 5 -mknod -m 0600 /dev/tty6 c 4 6 -mknod -m 0600 /dev/tty7 c 4 7 -mknod -m 0600 /dev/tty8 c 4 8 -mknod -m 0600 /dev/tty9 c 4 9 - -mkdir -m 0755 /dev/pts -mknod -m 0666 /dev/ptmx c 5 2 - -# random - -mknod -m 0644 /dev/random c 1 8 -mknod -m 0644 /dev/urandom c 1 9 - -mknod -m 0660 /dev/hda b 3 0 -mknod -m 0660 /dev/hda1 b 3 1 -mknod -m 0660 /dev/hda2 b 3 2 -mknod -m 0660 /dev/hda3 b 3 3 - -#mknod -m 0660 /dev/sda b 8 0 -#mknod -m 0660 /dev/sda1 b 8 1 -#mknod -m 0660 /dev/sda2 b 8 2 -#mknod -m 0660 /dev/sda3 b 8 3 - -echo "dev" -cd /dev; echo * - -mkfs.ext2 /dev/hda1 -mkswap /dev/hda2 - -## Probe for CD device which contains our CD here and mount /nix and -## /nixpkgs from it inside the ramdisk. Anaconda uses kudzu for this. -## Find out how Knoppix and SUSE do this... - -$(./install-disk.sh) diff --git a/install.sh b/install.sh deleted file mode 100644 index 88ce09ccb2b..00000000000 --- a/install.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! @bash@/bin/sh -e - -exec ./fill-disk.sh | @busybox@/bin/tee /tmp/install-log diff --git a/test/installer.nix b/installer.nix similarity index 100% rename from test/installer.nix rename to installer.nix diff --git a/test/installer.sh b/installer.sh similarity index 100% rename from test/installer.sh rename to installer.sh diff --git a/isolinux.cfg b/isolinux.cfg old mode 100755 new mode 100644 index 180b144eeb5..ff19e84c098 --- a/isolinux.cfg +++ b/isolinux.cfg @@ -3,4 +3,4 @@ prompt 1 timeout 60 label linux kernel vmlinuz - append initrd=initram.img init=/bin/sh + append initrd=initrd selinux=0 apm=on acpi=on diff --git a/login.sh b/login.sh deleted file mode 100644 index 1c33a2ebc91..00000000000 --- a/login.sh +++ /dev/null @@ -1,27 +0,0 @@ -#! @bash@/bin/sh -e - -export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@busybox@/bin:@busybox@/sbin:@nano@/bin - -#tty=$1 - -#exec < $tty > $tty 2>&1 - -echo -echo "=== Welcome to Nix! ===" -echo "NixOS Installation instructions" -echo "" -echo "* edit the file called 'disklayout' (vi is provided) and provide" -echo " the following name=value pairs:" -echo " * INSTALLDEVICE (root device, for example /dev/hda1)" -echo " * SWAP (swap device, for example /dev/hda2)" -echo " * TARGETDRIVE (target drive to install grub, for example /dev/hda)" -echo "* run: sh fill-disk.sh" -echo "" -echo "" -echo "" -echo "" - -export HOME=/ -cd $HOME - -exec @bash@/bin/sh diff --git a/test/make-devices.sh b/make-devices.sh similarity index 100% rename from test/make-devices.sh rename to make-devices.sh diff --git a/make-disk.sh b/make-disk.sh deleted file mode 100755 index d3fe502301a..00000000000 --- a/make-disk.sh +++ /dev/null @@ -1,329 +0,0 @@ -#! /bin/sh -e - -set -x - -if test -z "$TMPDIR"; then export TMPDIR=/tmp; fi - -# deps is an array -declare -a deps - -build="nix-build --no-out-link" - -coreutils=$($build ./pkgs.nix -A coreutils) - -# determine where we can find the Nix binaries -NIX=$($coreutils/bin/dirname $(which nix-store)) - -# make sure we use many of our own tools, because it is more pure -mktemp=$($build ./pkgs.nix -A mktemp) - -gnused=$($build ./pkgs.nix -A gnused) -gnutar=$($build ./pkgs.nix -A gnutar151) -cdrtools=$($build ./pkgs.nix -A cdrtools) -gzip=$($build ./pkgs.nix -A gzip) -cpio=$($build ./pkgs.nix -A cpio) - -archivesDir=$($mktemp/bin/mktemp -d) -manifest=${archivesDir}/MANIFEST -nixpkgs=./pkgs -fill_disk=$archivesDir/scripts/fill-disk.sh -ramdisk_login=$archivesDir/scripts/ramdisk-login.sh -login_script=$archivesDir/scripts/login.sh -storePaths=$archivesDir/mystorepaths -narStorePaths=$archivesDir/narstorepaths -validatePaths=$archivesDir/validatepaths -bootiso=$TMPDIR/nixos.iso -initrd=$TMPDIR/initram.img -initdir=${archivesDir}/initdir -initscript=$archivesDir/scripts/init.sh - -nix=$($build ./pkgs.nix -A nix) -busybox=$($build ./pkgs.nix -A busybox) -nano=$($build ./pkgs.nix -A nano) -nanoDiet=$($build ./pkgs.nix -A nanoDiet) -ncurses=$($build ./pkgs.nix -A ncursesDiet) - -nixDeps=$($NIX/nix-store -qR $nix) - -storeExpr=$($build ./pkgs.nix -A boot) - -kernelscripts=$($build ./pkgs.nix -A kernelscripts) - -mkinitrd=$($build ./pkgs.nix -A mkinitrd) - -### make NAR files for everything we want to install and some more. Make sure -### the right URL is in there, so specify /cdrom and not cdrom -$NIX/nix-push --copy $archivesDir $manifest --target file:///cdrom $storeExpr $($build ./pkgs.nix -A kernel) $kernelscripts $mkinitrd - -# Location of sysvinit? -sysvinitPath=$($build ./pkgs.nix -A sysvinit) - -# Location of Nix boot scripts? -bootPath=$($build ./pkgs.nix -A boot) - -syslinux=$($build ./pkgs.nix -A syslinux) - -kernel=$($build ./pkgs.nix -A kernel) -kernelscripts=$($build ./pkgs.nix -A kernelscripts) - -utillinux=$($build ./pkgs.nix -A utillinux) - -gnugrep=$($build ./pkgs.nix -A gnugrep) - -grub=$($build ./pkgs.nix -A grubWrapper) - -findutils=$($build ./pkgs.nix -A findutilsWrapper) - -modutils=$($build ./pkgs.nix -A module_init_toolsStatic) - -dhcp=$($build ./pkgs.nix -A dhcpWrapper) - -#combideps=$($NIX/nix-store -qR $nix $utillinux $gnugrep $grub $gzip $findutils) -combideps=$($NIX/nix-store -qR $nix $busybox $grub $findutils $modutils $dhcp $nano) - -for i in $storeExpr $mkinitrd -do - echo $i >> $narStorePaths -done -#for i in $nixDeps -for i in $combideps -do - echo $i >> $storePaths - echo '' >> $storePaths - deps=$($NIX/nix-store -q --references $i) - pkgs=$(echo $deps | $coreutils/bin/wc -w) - echo $pkgs >> $storePaths - for j in $deps - do - echo $j >> $storePaths - done - echo copying from store: $i - $gnutar/bin/tar -cf - $i | $gnutar/bin/tar --directory=$archivesDir -xf - -done - -tar zcf ${archivesDir}/nixstore.tgz $combideps - -utilLinux=$($build ./pkgs.nix -A utillinuxStatic) -coreUtilsDiet=$($build ./pkgs.nix -A diet.coreutils) - -## temporarily normal e2fsprogs until I can get it to build with dietlibc -e2fsProgs=$($NIX/nix-store -qR $($build ./pkgs.nix -A e2fsprogsDiet)) -#e2fsProgs=$($NIX/nix-store -qR $($build ./pkgs.nix -A e2fsprogs)) -modUtils=$($NIX/nix-store -qR $($build ./pkgs.nix -A module_init_toolsStatic)) -Grub=$($NIX/nix-store -qR $($build ./pkgs.nix -A grubWrapper)) -Kernel=$($NIX/nix-store -qR $($build ./pkgs.nix -A kernel)) -SysVinit=$($NIX/nix-store -qR $($build ./pkgs.nix -A sysvinit)) -BootPath=$($NIX/nix-store -qR $($build ./pkgs.nix -A boot)) - -bashGlibc=$($build ./pkgs.nix -A bash) -bash=$($build ./pkgs.nix -A diet.bash) -coreutilsdiet=$($build ./pkgs.nix -A diet.coreutils) -utillinux=$($build ./pkgs.nix -A utillinux) -e2fsprogs=$($build ./pkgs.nix -A e2fsprogsDiet) -modutils=$($build ./pkgs.nix -A module_init_toolsStatic) -grub=$($build ./pkgs.nix -A grubWrapper) -mingettyWrapper=$($build ./pkgs.nix -A mingettyWrapper) -dhcp=$($build ./pkgs.nix -A dhcpWrapper) -gnugrep=$($build ./pkgs.nix -A gnugrep) -which=$($build ./pkgs.nix -A which) -eject=$($build ./pkgs.nix -A eject) -sysklogd=$($build ./pkgs.nix -A sysklogd) -#kudzu=$($build ./pkgs.nix -A kudzu) - -echo creating directories for bootimage - -$coreutils/bin/mkdir ${initdir} -$coreutils/bin/mkdir ${initdir}/bin -$coreutils/bin/mkdir ${initdir}/cdrom -$coreutils/bin/mkdir ${initdir}/dev -$coreutils/bin/mkdir ${initdir}/etc -$coreutils/bin/mkdir ${initdir}/etc/sysconfig -$coreutils/bin/mkdir ${initdir}/installimage -$coreutils/bin/mkdir ${initdir}/lib -$coreutils/bin/mkdir ${initdir}/modules -$coreutils/bin/mkdir ${initdir}/proc -$coreutils/bin/mkdir ${initdir}/sbin -$coreutils/bin/mkdir ${initdir}/sys -$coreutils/bin/mkdir ${initdir}/tmp -$coreutils/bin/mkdir -p ${initdir}/usr/bin -$coreutils/bin/mkdir -p ${initdir}/usr/sbin -$coreutils/bin/mkdir ${initdir}/var -$coreutils/bin/mkdir ${initdir}/var/run -$coreutils/bin/mkdir -p ${initdir}/var/state/dhcp - -echo copying nixpkgs - -#svn export ${nixpkgs} ${archivesDir}/pkgs -(cd $nixpkgs && tar -zcf ${archivesDir}/nixpkgs.tgz .) - -#echo copying packages from store - -echo copying scripts - -$coreutils/bin/mkdir ${archivesDir}/scripts -$coreutils/bin/cp -fa * ${archivesDir}/scripts -$gnused/bin/sed -e "s^@bash\@^$bash^g" \ - -e "s^@coreutils\@^$coreutilsdiet^g" \ - -e "s^@busybox\@^$busybox^g" \ - < $initscript > $initscript.tmp -$coreutils/bin/mv $initscript.tmp $initscript -$gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ - -e "s^@bootPath\@^$bootPath^g" \ - -e "s^@nix\@^$nix^g" \ - -e "s^@bash\@^$bash^g" \ - -e "s^@bashGlibc\@^$bashGlibc^g" \ - -e "s^@findutils\@^$findutils^g" \ - -e "s^@busybox\@^$busybox^g" \ - -e "s^@coreutilsdiet\@^$coreutilsdiet^g" \ - -e "s^@coreutils\@^$coreutils^g" \ - -e "s^@utilLinux\@^$utilLinux^g" \ - -e "s^@utillinux\@^$utillinux^g" \ - -e "s^@e2fsprogs\@^$e2fsprogs^g" \ - -e "s^@modutils\@^$modutils^g" \ - -e "s^@grub\@^$grub^g" \ - -e "s^@kernel\@^$kernel^g" \ - -e "s^@kernelscripts\@^$kernelscripts^g" \ - -e "s^@gnugrep\@^$gnugrep^g" \ - -e "s^@which\@^$which^g" \ - -e "s^@dhcp\@^$dhcp^g" \ - -e "s^@sysklogd\@^$sysklogd^g" \ - -e "s^@gnutar\@^$gnutar^g" \ - -e "s^@gzip\@^$gzip^g" \ - -e "s^@mingetty\@^$mingettyWrapper^g" \ - < $fill_disk > $fill_disk.tmp -$coreutils/bin/mv $fill_disk.tmp $fill_disk - -$gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ - -e "s^@bootPath\@^$bootPath^g" \ - -e "s^@NIX\@^$nix^g" \ - -e "s^@bash\@^$bash^g" \ - -e "s^@findutils\@^$findutils^g" \ - -e "s^@coreutilsdiet\@^$coreutilsdiet^g" \ - -e "s^@coreutils\@^$coreutils^g" \ - -e "s^@utillinux\@^$utilLinux^g" \ - -e "s^@e2fsprogs\@^$e2fsprogs^g" \ - -e "s^@modutils\@^$modutils^g" \ - -e "s^@grub\@^$grub^g" \ - -e "s^@kernel\@^$kernel^g" \ - -e "s^@kernelscripts\@^$kernelscripts^g" \ - -e "s^@gnugrep\@^$gnugrep^g" \ - -e "s^@which\@^$which^g" \ - -e "s^@gnutar\@^$gnutar^g" \ - -e "s^@mingetty\@^$mingettyWrapper^g" \ - -e "s^@busybox\@^$busybox^g" \ - < $ramdisk_login > $ramdisk_login.tmp -$coreutils/bin/mv $ramdisk_login.tmp $ramdisk_login - -$gnused/bin/sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \ - -e "s^@bootPath\@^$bootPath^g" \ - -e "s^@NIX\@^$nix^g" \ - -e "s^@bash\@^$bash^g" \ - -e "s^@findutils\@^$findutils^g" \ - -e "s^@coreutilsdiet\@^$coreutilsdiet^g" \ - -e "s^@coreutils\@^$coreutils^g" \ - -e "s^@utillinux\@^$utilLinux^g" \ - -e "s^@e2fsprogs\@^$e2fsprogs^g" \ - -e "s^@modutils\@^$modutils^g" \ - -e "s^@grub\@^$grub^g" \ - -e "s^@kernel\@^$kernel^g" \ - -e "s^@kernelscripts\@^$kernelscripts^g" \ - -e "s^@gnugrep\@^$gnugrep^g" \ - -e "s^@which\@^$which^g" \ - -e "s^@gnutar\@^$gnutar^g" \ - -e "s^@mingetty\@^$mingettyWrapper^g" \ - -e "s^@busybox\@^$busybox^g" \ - -e "s^@nano\@^$nanoDiet^g" \ - < $login_script > $login_script.tmp -$coreutils/bin/mv $login_script.tmp $login_script - -echo copying bootimage - -$coreutils/bin/mkdir ${archivesDir}/isolinux -$coreutils/bin/cp ${syslinux}/lib/syslinux/isolinux.bin ${archivesDir}/isolinux -$coreutils/bin/cp isolinux.cfg ${archivesDir}/isolinux -$coreutils/bin/chmod u+w ${archivesDir}/isolinux/* - -echo copying kernel - -# By following the symlink we don't have to know the version number -# of the kernel here. -$coreutils/bin/cp -L $kernel/vmlinuz ${archivesDir}/isolinux - -strippedName=$(basename $kernel); -if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then - strippedName=$(echo "$strippedName" | cut -c34- | cut -c 7-) -fi - -kernelhash=$(basename $root/$kernel); -if echo "$kernelhash" | grep -q '^[a-z0-9]\{32\}-'; then - kernelhash=$(echo "$kernelhash" | cut -c -32) -fi - -version=$strippedName-$kernelhash - -echo version: $version - -#echo linking kernel modules -#$coreutils/bin/ln -s $kernel/lib $archivesDir/lib - -echo copying network drivers -#$coreutils/bin/cp -fau --parents --no-preserve=mode $kernel/lib/modules/*/modules.* $archivesDir -#$coreutils/bin/cp -fau --parents --no-preserve=mode $kernel/lib/modules/*/kernel/drivers/net/* $archivesDir - -$gnutar/bin/tar -cf - $kernel/lib/modules/*/modules.* | $gnutar/bin/tar --directory=$archivesDir --strip-components 3 -xf - -$gnutar/bin/tar -cf - $kernel/lib/modules/*/kernel/drivers/net/* | $gnutar/bin/tar --directory=$archivesDir --strip-components 3 -xf - - -echo creating ramdisk - -umask 0022 - -$coreutils/bin/rm -f ${initrd} -#cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init -$coreutils/bin/cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/ -$coreutils/bin/cp ${archivesDir}/scripts/ramdisk-login.sh ${initdir}/ -$coreutils/bin/cp ${archivesDir}/scripts/login.sh ${initdir}/ -$coreutils/bin/cp ${archivesDir}/scripts/init.sh ${initdir}/init -#ln -s ${bash}/bin/bash ${initdir}/bin/sh -$coreutils/bin/cp ${bash}/bin/bash ${initdir}/bin/sh -$coreutils/bin/chmod u+x ${initdir}/init -$coreutils/bin/chmod u+x ${initdir}/fill-disk.sh -$coreutils/bin/chmod u+x ${initdir}/ramdisk-login.sh -$coreutils/bin/chmod u+x ${initdir}/login.sh -#cp -fau --parents ${utilLinux} ${initdir} -#cp -fau --parents ${coreUtilsDiet} ${initdir} -#cp -fau --parents ${modUtils} ${initdir} -$coreutils/bin/cp -fau --parents ${bash}/bin ${initdir} -#$coreutils/bin/cp -fau --parents ${utilLinux}/bin ${initdir} -#$coreutils/bin/chmod -R u+w ${initdir} -#$coreutils/bin/cp -fau --parents ${utilLinux}/sbin ${initdir} -$coreutils/bin/cp -fau --parents ${e2fsProgs} ${initdir} -#$coreutils/bin/cp -fau --parents ${coreutilsdiet}/bin ${initdir} -$coreutils/bin/cp -fau --parents ${modutils}/bin ${initdir} -$coreutils/bin/chmod -R u+w ${initdir} -$coreutils/bin/cp -fau --parents ${modutils}/sbin ${initdir} -$coreutils/bin/cp -fau --parents ${busybox} ${initdir} -$coreutils/bin/cp -fau --parents ${nanoDiet} ${initdir} -$coreutils/bin/cp -fau --parents ${ncurses} ${initdir} - -$coreutils/bin/touch ${archivesDir}/NIXOS - -(cd ${initdir}; find . |$cpio/bin/cpio -H newc -o) | $gzip/bin/gzip -9 > ${initrd} - -$coreutils/bin/chmod -f -R +w ${initdir}/* -$coreutils/bin/rm -rf ${initdir} - -$coreutils/bin/cp ${initrd} ${archivesDir}/isolinux -$coreutils/bin/rm -f ${initrd} - -echo creating ISO image - -$cdrtools/bin/mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin \ - -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 \ - -boot-info-table ${archivesDir} - -# cleanup, be diskspace friendly - -echo cleaning up - -$coreutils/bin/chmod -f -R +w ${archivesDir}/* -#rm -rf ${archivesDir}/* diff --git a/test/make-initrd.nix b/make-initrd.nix similarity index 100% rename from test/make-initrd.nix rename to make-initrd.nix diff --git a/test/make-initrd.sh b/make-initrd.sh similarity index 100% rename from test/make-initrd.sh rename to make-initrd.sh diff --git a/test/make-iso9660-image.nix b/make-iso9660-image.nix similarity index 100% rename from test/make-iso9660-image.nix rename to make-iso9660-image.nix diff --git a/test/make-iso9660-image.sh b/make-iso9660-image.sh similarity index 100% rename from test/make-iso9660-image.sh rename to make-iso9660-image.sh diff --git a/test/modules-closure.nix b/modules-closure.nix similarity index 100% rename from test/modules-closure.nix rename to modules-closure.nix diff --git a/test/modules-closure.sh b/modules-closure.sh similarity index 100% rename from test/modules-closure.sh rename to modules-closure.sh diff --git a/test/options.nix b/options.nix similarity index 100% rename from test/options.nix rename to options.nix diff --git a/test/paths-from-graph.sh b/paths-from-graph.sh similarity index 100% rename from test/paths-from-graph.sh rename to paths-from-graph.sh diff --git a/pkgs.nix b/pkgs.nix deleted file mode 100644 index ea530f649d1..00000000000 --- a/pkgs.nix +++ /dev/null @@ -1,44 +0,0 @@ -let - - pkgs = import ./pkgs/top-level/all-packages.nix {}; - - # !!! copied from stdenv/linux/make-bootstrap-tools.nix. - pkgsToRemove = - [ "binutils" "gcc" "coreutils" "findutils" "diffutils" "gnused" "gnugrep" - "gawk" "gnutar" "gzip" "bzip2" "gnumake" "bash" "patch" "patchelf" - ]; - - pkgsDiet = import ./pkgs/top-level/all-packages.nix { - bootStdenv = removeAttrs (pkgs.useDietLibC pkgs.stdenv) pkgsToRemove; - }; - -in rec { - - inherit (pkgs) - stdenv kernelscripts kernel bash coreutils coreutilsDiet - findutilsWrapper utillinux utillinuxStatic sysvinit e2fsprogsDiet - e2fsprogs nettools nix subversion gcc wget which vim less screen - openssh binutils nixStatic strace shadowutils iputils gnumake curl gnused - gnutar gnutar151 gnugrep gzip mingettyWrapper grubWrapper syslinux parted - module_init_tools module_init_toolsStatic dhcpWrapper man nano nanoDiet - eject sysklogd mktemp cdrtools cpio busybox mkinitrd ncursesDiet; - - diet = pkgsDiet; - - boot = (import ./boot) { - inherit stdenv bash coreutils findutilsWrapper utillinux sysvinit - e2fsprogs nettools subversion gcc wget which vim less screen openssh - strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip - mingettyWrapper grubWrapper parted module_init_tools dhcpWrapper man - nano nix; - }; - - #init = (import ./init) {inherit stdenv bash bashStatic coreutilsDiet - # utillinux shadowutils mingettyWrapper grubWrapper parted module_init_tools - # dhcpWrapper man nano eject e2fsprogsDiet; - # nix = nixUnstable; - #}; - - everything = [boot sysvinit sysklogd kernelscripts kernel mkinitrd]; - -} diff --git a/pure/devices.nix b/pure/devices.nix deleted file mode 100644 index 140f8afb7e6..00000000000 --- a/pure/devices.nix +++ /dev/null @@ -1,20 +0,0 @@ -[ - { id = "net-dev-1"; - comment = "Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express"; - location = { - busId = "pci-0000:02:00.0"; - macAddr = "00:14:22:bc:68:51"; - prefer = "macAddr"; # i.e., don't care if busId changes - }; - extraModules = []; # tg3 - } - - { id = "keyboard-1"; - comment = "Dell Computer Corp. SK-8125 Keyboard"; - location = { - busId = "usb-003-003"; - }; - extraModules = []; - } - -] diff --git a/pure/disks.nix b/pure/disks.nix deleted file mode 100644 index c1ad104fbd9..00000000000 --- a/pure/disks.nix +++ /dev/null @@ -1,84 +0,0 @@ -{ - - /* Old school. */ - - volume1 = { - mountPoint = "/"; - filesystem = "ext3"; - location = { - device = "/dev/hda1"; - }; - creationParams = { - disk = "/dev/hda"; - partition = 1; - startCylinder = 1; - endCylinder = 1000; - }; - }; - - volume2 = { - filesystem = "swap"; - location = { - device = "/dev/hda2"; - }; - creationParams = { - disk = "/dev/hda"; - startCylinder = 1001; - endCylinder = 1100; - }; - }; - - - /* With partition labels; don't care which device holds the file - system. */ - - volume1 = { - mountPoint = "/"; - filesystem = "auto"; - location = { - label = "ROOT_DISK"; - }; - # Only relevant when creating. - creationParams = { - disk = "/dev/hda"; - partition = 1; - startCylinder = 1; - endCylinder = 1000; - filesystem = "ext3"; - }; - }; - - - /* LVM. */ - - volume1 = { - mountPoint = "/data"; - filesystem = "auto"; - location = { - lvmVolumeGroup = "system"; - lvmVolumeName = "big-volume"; # -> /dev/mapper/system-big-volume - }; - }; - - lvmConfig = { - devices = [ - ... - ]; - groups = [ - { name = "system"; - volumes = [ - { name = "big-volume"; - size = 1048576; # -> 1 GiB - } - { name = "blah"; - size = 1048576; # -> 1 GiB - } - ]; - # When realising this configuration, only delete explicitly - # listed volumes for safety. - canDelete = ["foobar"]; - }; - ]; - }; - -} diff --git a/pure/networking.nix b/pure/networking.nix deleted file mode 100644 index 0f3b550a8f5..00000000000 --- a/pure/networking.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ - - identification = { - fromDHCP = false; - hostname = "foobar"; - }; - - - interfaces = [ - - # Manual configuration. - { name = "eth0"; - hardware = { - type = "ethernet"; - device = "net-dev-1"; - }; - link = { - ip4 = { - address = "192.168.1.2"; - nameservers = [ # to be used when this interface is up - "1.2.3.4"; - "1.2.3.5"; - ]; - routes = [ # idem, add when up - { destination = "0.0.0.0"; - netmask = "0.0.0.0"; - gateway = "192.168.1.1"; - # iface implied (eth0) - } - { destination = "192.168.1.0"; - netmask = "255.255.255.0"; - # iface implied (eth0) - } - ]; - }; - ip6 = ...; - }; - } - - # Automatic configuration via DHCP - { name = "eth0"; - hardware = { - type = "ethernet"; - device = "net-dev-1"; - }; - link = { - useDHCP = true; - }; - } - - ]; - - - firewall = { - # ... - }; - -} \ No newline at end of file diff --git a/pure/top-level.nix b/pure/top-level.nix deleted file mode 100644 index 46c220f5c8e..00000000000 --- a/pure/top-level.nix +++ /dev/null @@ -1,26 +0,0 @@ -rec { - - devices = import ./devices.nix; - - disks = import ./disks.nix; - - networking = import ./networking.nix; - - systemServices = [ - terminalRunner - syslogServer - dhcpClient - sshServer - subversionServer - ]; - - systemInit = { - inherit devices disks networking; - inherit systemServices; - }; - - kernel = import ... { - externalModules = [nvidia vmware ...]; - } - -} diff --git a/ramdisk-login.sh b/ramdisk-login.sh deleted file mode 100644 index e684fc3ce26..00000000000 --- a/ramdisk-login.sh +++ /dev/null @@ -1,15 +0,0 @@ -#! @bash@/bin/sh -e - -export PATH=@bash@/bin:@coreutilsdiet@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin:@gnugrep@/bin:@which@/bin:@gnutar@/bin:@busybox@/bin - -tty=$1 - -exec < $tty > $tty 2>&1 - -echo -echo "=== Welcome to Nix! ===" - -export HOME=/ -cd $HOME - -exec @bash@/bin/sh diff --git a/test/rescue-cd.nix b/rescue-cd.nix similarity index 100% rename from test/rescue-cd.nix rename to rescue-cd.nix diff --git a/run.sh b/run.sh deleted file mode 100755 index e6ec1e005e2..00000000000 --- a/run.sh +++ /dev/null @@ -1,7 +0,0 @@ -#! /bin/sh -e - -image=/tmp/disk.img - -linux ubd0="$image" mem=256M \ - eth0=tuntap,tap1 \ - init="/init" diff --git a/test/splash-themes.nix b/splash-themes.nix similarity index 100% rename from test/splash-themes.nix rename to splash-themes.nix diff --git a/storepaths_format b/storepaths_format deleted file mode 100644 index 5b71b007445..00000000000 --- a/storepaths_format +++ /dev/null @@ -1,13 +0,0 @@ -/nix/store/abcd- -deriver -2 -/nix/store/1234- -/nix/store/5678- - -Amount of dependencies determined by: - -nix-store -q --references p - -or better (for a large expression) - -nix-store -q --requisites p diff --git a/test/system-configuration.nix b/system-configuration.nix similarity index 100% rename from test/system-configuration.nix rename to system-configuration.nix diff --git a/test/system-configuration.sh b/system-configuration.sh similarity index 100% rename from test/system-configuration.sh rename to system-configuration.sh diff --git a/test/isolinux.cfg b/test/isolinux.cfg deleted file mode 100644 index ff19e84c098..00000000000 --- a/test/isolinux.cfg +++ /dev/null @@ -1,6 +0,0 @@ -default linux -prompt 1 -timeout 60 -label linux - kernel vmlinuz - append initrd=initrd selinux=0 apm=on acpi=on diff --git a/test/upgrade.sh b/upgrade.sh similarity index 100% rename from test/upgrade.sh rename to upgrade.sh diff --git a/test/upstart-jobs/ctrl-alt-delete.nix b/upstart-jobs/ctrl-alt-delete.nix similarity index 100% rename from test/upstart-jobs/ctrl-alt-delete.nix rename to upstart-jobs/ctrl-alt-delete.nix diff --git a/test/upstart-jobs/dhclient.nix b/upstart-jobs/dhclient.nix similarity index 100% rename from test/upstart-jobs/dhclient.nix rename to upstart-jobs/dhclient.nix diff --git a/test/upstart-jobs/gather.nix b/upstart-jobs/gather.nix similarity index 100% rename from test/upstart-jobs/gather.nix rename to upstart-jobs/gather.nix diff --git a/test/upstart-jobs/halt.nix b/upstart-jobs/halt.nix similarity index 100% rename from test/upstart-jobs/halt.nix rename to upstart-jobs/halt.nix diff --git a/test/upstart-jobs/hardware-scan.nix b/upstart-jobs/hardware-scan.nix similarity index 100% rename from test/upstart-jobs/hardware-scan.nix rename to upstart-jobs/hardware-scan.nix diff --git a/test/upstart-jobs/maintenance-shell.nix b/upstart-jobs/maintenance-shell.nix similarity index 100% rename from test/upstart-jobs/maintenance-shell.nix rename to upstart-jobs/maintenance-shell.nix diff --git a/test/upstart-jobs/make-job.nix b/upstart-jobs/make-job.nix similarity index 100% rename from test/upstart-jobs/make-job.nix rename to upstart-jobs/make-job.nix diff --git a/test/upstart-jobs/mingetty.nix b/upstart-jobs/mingetty.nix similarity index 100% rename from test/upstart-jobs/mingetty.nix rename to upstart-jobs/mingetty.nix diff --git a/test/upstart-jobs/network-interfaces.nix b/upstart-jobs/network-interfaces.nix similarity index 100% rename from test/upstart-jobs/network-interfaces.nix rename to upstart-jobs/network-interfaces.nix diff --git a/test/upstart-jobs/sshd.nix b/upstart-jobs/sshd.nix similarity index 100% rename from test/upstart-jobs/sshd.nix rename to upstart-jobs/sshd.nix diff --git a/test/upstart-jobs/syslogd.nix b/upstart-jobs/syslogd.nix similarity index 100% rename from test/upstart-jobs/syslogd.nix rename to upstart-jobs/syslogd.nix diff --git a/test/upstart-jobs/tty-backgrounds-combine.sh b/upstart-jobs/tty-backgrounds-combine.sh similarity index 100% rename from test/upstart-jobs/tty-backgrounds-combine.sh rename to upstart-jobs/tty-backgrounds-combine.sh diff --git a/test/upstart-jobs/tty-backgrounds.nix b/upstart-jobs/tty-backgrounds.nix similarity index 100% rename from test/upstart-jobs/tty-backgrounds.nix rename to upstart-jobs/tty-backgrounds.nix -- GitLab From a9234b5c073a62faa002e61f16a601cf190df40a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 27 Nov 2006 19:49:05 +0000 Subject: [PATCH 0267/5331] * Moving stuff around. svn path=/nixu/trunk/; revision=7155 --- test/README | 19 -- test/boot-environment.nix | 259 ------------------- test/boot-stage-1-init.sh | 147 ----------- test/boot-stage-1.nix | 43 --- test/boot-stage-2-init.sh | 168 ------------ test/boot-stage-2.nix | 27 -- test/grub-menu-builder.sh | 52 ---- test/helpers/unpack-theme.nix | 7 - test/helpers/unpack-theme.sh | 18 -- test/installer.nix | 17 -- test/installer.sh | 132 ---------- test/isolinux.cfg | 6 - test/make-devices.sh | 53 ---- test/make-initrd.nix | 31 --- test/make-initrd.sh | 42 --- test/make-iso9660-image.nix | 44 ---- test/make-iso9660-image.sh | 31 --- test/modules-closure.nix | 13 - test/modules-closure.sh | 37 --- test/options.nix | 97 ------- test/paths-from-graph.sh | 10 - test/rescue-cd.nix | 101 -------- test/splash-themes.nix | 58 ----- test/system-configuration.nix | 55 ---- test/system-configuration.sh | 31 --- test/upgrade.sh | 4 - test/upstart-jobs/ctrl-alt-delete.nix | 12 - test/upstart-jobs/dhclient.nix | 43 --- test/upstart-jobs/gather.nix | 19 -- test/upstart-jobs/halt.nix | 41 --- test/upstart-jobs/hardware-scan.nix | 23 -- test/upstart-jobs/maintenance-shell.nix | 19 -- test/upstart-jobs/make-job.nix | 7 - test/upstart-jobs/mingetty.nix | 10 - test/upstart-jobs/network-interfaces.nix | 36 --- test/upstart-jobs/sshd.nix | 32 --- test/upstart-jobs/syslogd.nix | 10 - test/upstart-jobs/tty-backgrounds-combine.sh | 37 --- test/upstart-jobs/tty-backgrounds.nix | 52 ---- 39 files changed, 1843 deletions(-) delete mode 100644 test/README delete mode 100644 test/boot-environment.nix delete mode 100644 test/boot-stage-1-init.sh delete mode 100644 test/boot-stage-1.nix delete mode 100644 test/boot-stage-2-init.sh delete mode 100644 test/boot-stage-2.nix delete mode 100644 test/grub-menu-builder.sh delete mode 100644 test/helpers/unpack-theme.nix delete mode 100644 test/helpers/unpack-theme.sh delete mode 100644 test/installer.nix delete mode 100644 test/installer.sh delete mode 100644 test/isolinux.cfg delete mode 100644 test/make-devices.sh delete mode 100644 test/make-initrd.nix delete mode 100644 test/make-initrd.sh delete mode 100644 test/make-iso9660-image.nix delete mode 100644 test/make-iso9660-image.sh delete mode 100644 test/modules-closure.nix delete mode 100644 test/modules-closure.sh delete mode 100644 test/options.nix delete mode 100644 test/paths-from-graph.sh delete mode 100644 test/rescue-cd.nix delete mode 100644 test/splash-themes.nix delete mode 100644 test/system-configuration.nix delete mode 100644 test/system-configuration.sh delete mode 100755 test/upgrade.sh delete mode 100644 test/upstart-jobs/ctrl-alt-delete.nix delete mode 100644 test/upstart-jobs/dhclient.nix delete mode 100644 test/upstart-jobs/gather.nix delete mode 100644 test/upstart-jobs/halt.nix delete mode 100644 test/upstart-jobs/hardware-scan.nix delete mode 100644 test/upstart-jobs/maintenance-shell.nix delete mode 100644 test/upstart-jobs/make-job.nix delete mode 100644 test/upstart-jobs/mingetty.nix delete mode 100644 test/upstart-jobs/network-interfaces.nix delete mode 100644 test/upstart-jobs/sshd.nix delete mode 100644 test/upstart-jobs/syslogd.nix delete mode 100644 test/upstart-jobs/tty-backgrounds-combine.sh delete mode 100644 test/upstart-jobs/tty-backgrounds.nix diff --git a/test/README b/test/README deleted file mode 100644 index e2f76b08301..00000000000 --- a/test/README +++ /dev/null @@ -1,19 +0,0 @@ -To get a Stage 1 shell: - -Add "debug1" to the kernel command line. - - -Switching to maintenance mode: - -$ shutdown now - -To get out of maintenance mode: - -$ initctl emit startup - - -Updating the current system configuration: - -$ nix-env -p /nix/var/nix/profiles/system -f system-configuration.nix -i -A systemConfiguration -$ /nix/var/nix/profiles/system/bin/switch-to-configuration - diff --git a/test/boot-environment.nix b/test/boot-environment.nix deleted file mode 100644 index 78086e99cfc..00000000000 --- a/test/boot-environment.nix +++ /dev/null @@ -1,259 +0,0 @@ -{ system ? __currentSystem -, autoDetectRootDevice ? false -, rootDevice ? "" -, rootLabel ? "" -, stage2Init -, readOnlyRoot -}: - -rec { - - pkgs = import ./pkgs/top-level/all-packages.nix {inherit system;}; - - pkgsDiet = import ./pkgs/top-level/all-packages.nix { - inherit system; - bootStdenv = pkgs.useDietLibC pkgs.stdenv; - }; - - pkgsStatic = import ./pkgs/top-level/all-packages.nix { - inherit system; - bootStdenv = pkgs.makeStaticBinaries pkgs.stdenv; - }; - - stdenvLinuxStuff = import ./pkgs/stdenv/linux { - system = pkgs.stdenv.system; - allPackages = import ./pkgs/top-level/all-packages.nix; - }; - - nix = pkgs.nixUnstable; # we need the exportReferencesGraph feature - - - # Splash configuration. - splashThemes = import ./splash-themes.nix { - inherit (pkgs) fetchurl; - }; - - - # Determine the set of modules that we need to mount the root FS. - modulesClosure = import ./modules-closure.nix { - inherit (pkgs) stdenv kernel module_init_tools; - rootModules = ["ide-cd" "ide-disk" "ide-generic"]; - }; - - - # 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 - 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 - # mounting the root FS). - bootStage1 = import ./boot-stage-1.nix { - inherit (pkgs) genericSubstituter; - inherit (pkgsDiet) module_init_tools; - inherit extraUtils; - inherit autoDetectRootDevice rootDevice rootLabel; - inherit stage2Init; - modules = modulesClosure; - shell = stdenvLinuxStuff.bootstrapTools.bash; - staticTools = stdenvLinuxStuff.staticTools; - }; - - - # The closure of the init script of boot stage 1 is what we put in - # the initial RAM disk. - initialRamdisk = import ./make-initrd.nix { - inherit (pkgs) stdenv cpio; - contents = [ - { object = bootStage1; - symlink = "/init"; - } - { object = extraUtils; - suffix = "/bin/splash_helper"; - symlink = "/sbin/splash_helper"; - } - { object = import ./helpers/unpack-theme.nix { - inherit (pkgs) stdenv; - theme = splashThemes.splashScreen; - }; - symlink = "/etc/splash"; - } - ]; - }; - - - # The installer. - nixosInstaller = import ./installer.nix { - inherit (pkgs) stdenv genericSubstituter; - inherit nix; - shell = pkgs.bash + "/bin/sh"; - }; - - - # The services (Upstart) configuration for the system. - upstartJobs = import ./upstart-jobs/gather.nix { - inherit (pkgs) stdenv; - - jobs = map makeJob [ - # Syslogd. - (import ./upstart-jobs/syslogd.nix { - inherit (pkgs) sysklogd; - }) - - # Hardware scan; loads modules for PCI devices. - (import ./upstart-jobs/hardware-scan.nix { - inherit (pkgs) kernel module_init_tools; - }) - - # Network interfaces. - (import ./upstart-jobs/network-interfaces.nix { - inherit (pkgs) nettools kernel module_init_tools; - }) - - # DHCP client. - (import ./upstart-jobs/dhclient.nix { - dhcp = pkgs.dhcpWrapper; - }) - - # SSH daemon. - (import ./upstart-jobs/sshd.nix { - inherit (pkgs) openssh; - }) - - # Transparent TTY backgrounds. - (import ./upstart-jobs/tty-backgrounds.nix { - inherit (pkgs) stdenv splashutils; - backgrounds = splashThemes.ttyBackgrounds; - }) - - # Handles the maintenance/stalled event (single-user shell). - (import ./upstart-jobs/maintenance-shell.nix { - inherit (pkgs) bash; - }) - - # Ctrl-alt-delete action. - (import ./upstart-jobs/ctrl-alt-delete.nix) - - ] - - # Handles the reboot/halt events. - ++ (map - (event: makeJob (import ./upstart-jobs/halt.nix { - inherit (pkgs) bash; - inherit event; - })) - ["reboot" "halt" "system-halt" "power-off"] - ) - - # The terminals on ttyX. - ++ (map - (ttyNumber: makeJob (import ./upstart-jobs/mingetty.nix { - mingetty = pkgs.mingettyWrapper; - inherit ttyNumber; - })) - [1 2 3 4 5 6] - ) - - # For the builtin logd job. - ++ [pkgs.upstart]; - }; - - - makeJob = import ./upstart-jobs/make-job.nix { - inherit (pkgs) stdenv; - }; - - - # The init script of boot stage 2, which is supposed to do - # everything else to bring up the system. - bootStage2 = import ./boot-stage-2.nix { - inherit (pkgs) genericSubstituter coreutils findutils - utillinux kernel udev upstart; - inherit upstartJobs; - shell = pkgs.bash + "/bin/sh"; - - # Additional stuff; add whatever you want here. - path = [ - pkgs.bash - pkgs.bzip2 - pkgs.cpio - pkgs.curl - pkgs.e2fsprogs - pkgs.gnugrep - pkgs.gnused - pkgs.gnutar - pkgs.grub - pkgs.gzip - pkgs.iputils - pkgs.less - pkgs.module_init_tools - pkgs.nano - pkgs.netcat - pkgs.nettools - pkgs.perl - pkgs.procps - pkgs.rsync - pkgs.shadowutils - pkgs.strace - pkgs.sysklogd -# pkgs.vim - nix - nixosInstaller - ]; - - inherit readOnlyRoot; - - hostName = config.get ["networking" "hostname"]; - }; - - - lib = import ./pkgs/lib; - - - config = rec { - - # The user configuration. - config = { - networking = { - hostname = "vindaloo"; - }; - }; - - # The option declarations, i.e., option names with defaults and - # documentation. - declarations = import ./options.nix; - - # Get the option named `name' from the user configuration, using - # its default value if it's not defined. - get = name: - let - sameName = lib.filter (opt: lib.eqLists opt.name name) declarations; - default = - if sameName == [] - then abort ("Undeclared option `" + printName name + "'.") - else if !builtins.head sameName ? default - then abort ("Option `" + printName name + "' has no default.") - else (builtins.head sameName).default; - in lib.getAttr name default config; - - printName = name: lib.concatStrings (lib.intersperse "." name); - - }; - - -} diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh deleted file mode 100644 index d62bd157975..00000000000 --- a/test/boot-stage-1-init.sh +++ /dev/null @@ -1,147 +0,0 @@ -#! @shell@ - -fail() { - # If starting stage 2 failed, start an interactive shell. - echo "Stage 2 failed, starting emergency shell..." - exec @shell@ -} - - -# Print a greeting. -echo -echo "<<< NixOS Stage 1 >>>" -echo - - -# Set the PATH. -export PATH=/empty -for i in @path@; do - PATH=$PATH:$i/bin - if test -e $i/sbin; then - PATH=$PATH:$i/sbin - fi -done - - -# Mount special file systems. -mkdir -p /etc # to shut up mount -touch /etc/fstab # idem -mkdir -p /proc -mount -t proc none /proc -mkdir -p /sys -mount -t sysfs none /sys - - -# Process the kernel command line. -stage2Init=@stage2Init@ -for o in $(cat /proc/cmdline); do - case $o in - init=*) - set -- $(IFS==; echo $o) - stage2Init=$2 - ;; - debugtrace) - # Show each command. - set -x - ;; - debug1) - fail - ;; - esac -done - - -# Create device nodes in /dev. -source @makeDevices@ - - -# Load some kernel modules. -export MODULE_DIR=@modules@/lib/modules/ -modprobe ide-generic -modprobe ide-disk -modprobe ide-cd - - -# Try to find and mount the root device. -mkdir /mnt -mkdir /mnt/root - -echo "mounting the root device..." - -if test -n "@autoDetectRootDevice@"; then - - # Look for the root device by label. - echo "probing for the NixOS installation CD..." - - for i in /sys/devices/*/*/media; do - if test "$(cat $i)" = "cdrom"; then - - # Hopefully `drivename' matches the device created in /dev. - devName=/dev/$(cat $(dirname $i)/drivename) - - echo " in $devName..." - - if mount -n -o ro -t iso9660 $devName /mnt/root; then - if test -e "/mnt/root/@rootLabel@"; then - found=1 - break - fi - umount /mnt/root - fi - - fi - done - - if test -z "$found"; then - echo "CD not found!" - fail - fi - -else - - # Hard-coded root device. - rootDevice="@rootDevice@" - - # Check the root device. - fsck -C -a "$rootDevice" - fsckResult=$? - - if test $(($fsckResult | 2)) = $fsckResult; then - echo "fsck finished, rebooting..." - sleep 3 - # reboot -f -d !!! don't have reboot yet - fail - fi - - if test $(($fsckResult | 4)) = $fsckResult; then - echo "$rootDevice has unrepaired errors, please fix them manually." - fail - fi - - if test $fsckResult -ge 8; then - echo "fsck on $rootDevice failed." - fail - fi - - # Mount read-writable. - mount -n -o rw "$rootDevice" /mnt/root || fail - -fi - - -# Start stage 2. -# !!! Note: we can't use pivot_root here (the kernel gods have -# decreed), but we could use run-init from klibc, which deletes all -# files in the initramfs, remounts the target root on /, and chroots. -cd /mnt/root -mount --move . / -umount /proc # cleanup -umount /sys - -echo "INIT = $stage2Init" - -if test -z "$stage2Init"; then fail; fi - -exec chroot . $stage2Init - -fail diff --git a/test/boot-stage-1.nix b/test/boot-stage-1.nix deleted file mode 100644 index ef1ebfc7225..00000000000 --- a/test/boot-stage-1.nix +++ /dev/null @@ -1,43 +0,0 @@ -# This Nix expression builds the script that performs the first stage -# of booting the system: it loads the modules necessary to mount the -# root file system, then calls /init in the root file system to start -# the second boot stage. The closure of the result of this expression -# is supposed to be put into an initial RAM disk (initrd). - -{ genericSubstituter, shell, staticTools -, module_init_tools, extraUtils, modules - -, # Whether to find root device automatically using its label. - autoDetectRootDevice - -, # If not scanning, the root must be specified explicitly. - rootDevice - - # If scanning, we need a disk label. -, rootLabel - -, # The path of the stage 2 init to call once we've mounted the root - # device. - stage2Init ? "/init" -}: - -assert !autoDetectRootDevice -> rootDevice != ""; -assert autoDetectRootDevice -> rootLabel != ""; - -genericSubstituter { - src = ./boot-stage-1-init.sh; - isExecutable = true; - inherit shell modules; - inherit autoDetectRootDevice rootDevice rootLabel; - path = [ - staticTools - module_init_tools - extraUtils - ]; - makeDevices = ./make-devices.sh; - - # We only want the path of the stage 2 init, we don't want it as a - # dependency (since then it the stage 2 init would end up in the - # initrd). - stage2Init = toString stage2Init; # !!! doesn't work -} diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh deleted file mode 100644 index 57a6a20a71f..00000000000 --- a/test/boot-stage-2-init.sh +++ /dev/null @@ -1,168 +0,0 @@ -#! @shell@ - -# !!! copied from stage 1; remove duplication - - -# Print a greeting. -echo -echo "<<< NixOS Stage 2 >>>" -echo - - -# Set the PATH. -export PATH=/empty -for i in @path@; do - PATH=$PATH:$i/bin - if test -e $i/sbin; then - PATH=$PATH:$i/sbin - fi -done - - -# Mount special file systems. - -needWritableDir() { - if test -n "@readOnlyRoot@"; then - mount -t tmpfs -o "mode=$2" none $1 $3 - else - mkdir -m $2 -p $1 - fi -} - -needWritableDir /etc 0755 -n # to shut up mount - -test -e /etc/fstab || touch /etc/fstab # idem - -mount -n -t proc none /proc -cat /proc/mounts > /etc/mtab - - -# Process the kernel command line. -for o in $(cat /proc/cmdline); do - case $o in - debugtrace) - # Show each command. - set -x - ;; - debug2) - echo "Debug shell called from @out@" - exec @shell@ - ;; - S|s|single) - # !!! argh, can't pass a startup event to Upstart yet. - exec @shell@ - ;; - esac -done - - -# More special file systems, initialise required directories. -mount -t sysfs none /sys -mount -t tmpfs -o "mode=0755" none /dev -needWritableDir /tmp 01777 -needWritableDir /var 0755 -needWritableDir /nix/var 0755 - -mkdir -m 0755 -p /nix/var/nix/db -mkdir -m 0755 -p /nix/var/nix/gcroots -mkdir -m 0755 -p /nix/var/nix/temproots - -mkdir -m 0755 -p /var/log - -ln -sf /nix/var/nix/profiles /nix/var/nix/gcroots/ - - -# Ensure that the module tools can find the kernel modules. -export MODULE_DIR=@kernel@/lib/modules/ - - -# Miscellaneous cleanup. -rm -rf /var/run -mkdir -m 0755 -p /var/run - -echo -n > /var/run/utmp # must exist -chmod 664 /var/run/utmp - - -# Start udev. -udevd --daemon - - -# Let udev create device nodes for all modules that have already been -# loaded into the kernel (or for which support is built into the -# kernel). -udevtrigger -udevsettle # wait for udev to finish - - -# Necessary configuration for syslogd. -echo "*.* /dev/tty10" > /etc/syslog.conf -echo "syslog 514/udp" > /etc/services # required, even if we don't use it - - -# login/su absolutely need this. -test -e /etc/login.defs || touch /etc/login.defs - - -# Enable a password-less root login. -if ! test -e /etc/passwd; then - echo "root::0:0:root:/:@shell@" > /etc/passwd -fi -if ! test -e /etc/group; then - echo "root:*:0" > /etc/group -fi - - -# We need "localhost" (!!! destructive hack for NIXOS-41). -echo "127.0.0.1 localhost" > /etc/hosts -echo "hosts: files dns" > /etc/nsswitch.conf - - -# Set up the Upstart jobs. -export UPSTART_CFG_DIR=/etc/event.d - -rm -f /etc/event.d -ln -sf @upstartJobs@/etc/event.d /etc/event.d - - -# Show a nice greeting on each terminal. -cat > /etc/issue <>> - - -EOF - - -# Additional path for the interactive shell. -for i in @extraPath@; do - PATH=$PATH:$i/bin - if test -e $i/sbin; then - PATH=$PATH:$i/sbin - fi -done - -cat > /etc/profile <" - exit 1 -fi - - -target=/boot/grub/menu.lst -tmp=$target.tmp - -cat > $tmp << GRUBEND -# Automatically generated. DO NOT EDIT THIS FILE! -default=0 -timeout=5 -GRUBEND - -addEntry() { - name="$1" - path="$2" - - cat >> $tmp << GRUBEND -title $name -GRUBEND - - #cat $path/menu.lst >> $tmp - - grep -v "title \|default=\|timeout=" < $path/menu.lst >> $tmp -} - - -if test -n "$tmp"; then - addEntry "NixOS - Default" $default -fi - - -# Add all generations of the system profile to the menu, in reverse -# (most recent to least recent) order. -for generation in $( - (cd /nix/var/nix/profiles && ls -d system-*-link) \ - | sed 's/system-\([0-9]\+\)-link/\1/' \ - | sort -n -r); do - echo $generation - link=/nix/var/nix/profiles/system-$generation-link - date=$(stat --printf="%y\n" $link | sed 's/\..*//') - addEntry "NixOS - Configuration $generation ($date)" $link - -done - - -cp $tmp $target diff --git a/test/helpers/unpack-theme.nix b/test/helpers/unpack-theme.nix deleted file mode 100644 index 69d2eebe530..00000000000 --- a/test/helpers/unpack-theme.nix +++ /dev/null @@ -1,7 +0,0 @@ -{stdenv, theme}: - -stdenv.mkDerivation { - name = "theme"; - builder = ./unpack-theme.sh; - inherit theme; -} diff --git a/test/helpers/unpack-theme.sh b/test/helpers/unpack-theme.sh deleted file mode 100644 index 6eda7bcfbd4..00000000000 --- a/test/helpers/unpack-theme.sh +++ /dev/null @@ -1,18 +0,0 @@ -source $stdenv/setup - -ensureDir $out - -tar xvfj $theme -C $out - -themeName=$(cd $out && ls) - -for i in $out/$themeName/config/*.cfg; do - echo "converting $i" - # Rewrite /etc paths. Also, the file names - # config/bootsplash-.cfg should be .cfg. - sed "s^/etc/bootsplash/themes^$out^g" < $i > $out/$themeName/$(basename $i | sed 's^.*-^^') -done - -rm $out/$themeName/config/*.cfg - -ln -s $themeName $out/default diff --git a/test/installer.nix b/test/installer.nix deleted file mode 100644 index 44080b86a85..00000000000 --- a/test/installer.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ stdenv, genericSubstituter, shell, nix -}: - -genericSubstituter { - src = ./installer.sh; - dir = "bin"; - isExecutable = true; - inherit shell nix; - - pathsFromGraph = ./paths-from-graph.sh; - - nixClosure = stdenv.mkDerivation { - name = "closure"; - exportReferencesGraph = ["refs" nix]; - builder = builtins.toFile "builder.sh" "source $stdenv/setup; cp refs $out"; - }; -} diff --git a/test/installer.sh b/test/installer.sh deleted file mode 100644 index 04c3c80c212..00000000000 --- a/test/installer.sh +++ /dev/null @@ -1,132 +0,0 @@ -#! @shell@ - -# Syntax: installer.sh -# (e.g., installer.sh /dev/hda1 ./my-machine.nix) - -# - mount target device -# - make Nix store etc. -# - copy closure of rescue env to target device -# - register validity -# - start the "target" installer in a chroot to the target device -# * do a nix-pull -# * nix-env -p system-profile -i -# * run hook scripts provided by packages in the configuration? -# - install/update grub - -set -e - -targetDevice="$1" -nixExpr="$2" - -if test -z "$targetDevice" -o -z "$nixExpr"; then - echo "Syntax: installer.sh " - exit 1 -fi - -nixExpr=$(readlink -f "$nixExpr") - - -# Make sure that the target device isn't mounted. -umount "$targetDevice" 2> /dev/null || true - - -# Check it. -fsck -n "$targetDevice" - - -# Mount the target device. -mountPoint=/tmp/inst-mnt -mkdir -p $mountPoint -mount "$targetDevice" $mountPoint - -mkdir -m 0755 -p $mountPoint/dev $mountPoint/proc $mountPoint/sys $mountPoint/mnt -mount --rbind / $mountPoint/mnt -mount --bind /dev $mountPoint/dev -mount --bind /proc $mountPoint/proc -mount --bind /sys $mountPoint/sys - -cleanup() { - for i in $(grep -F "$mountPoint" /proc/mounts \ - | perl -e 'while (<>) { /^\S+\s+(\S+)\s+/; print "$1\n"; }' \ - | sort -r); - do - umount $i - done -} - -trap "cleanup" EXIT - -mkdir -m 01777 -p $mountPoint/tmp -mkdir -m 0755 -p $mountPoint/var - - -# Create the necessary Nix directories on the target device, if they -# don't already exist. -mkdir -m 0755 -p \ - $mountPoint/nix/store \ - $mountPoint/nix/var/nix/gcroots \ - $mountPoint/nix/var/nix/temproots \ - $mountPoint/nix/var/nix/manifests \ - $mountPoint/nix/var/nix/userpool \ - $mountPoint/nix/var/nix/profiles \ - $mountPoint/nix/var/nix/db \ - $mountPoint/nix/var/log/nix/drvs - - -# Get the store paths to copy from the references graph. -storePaths=$(@shell@ @pathsFromGraph@ @nixClosure@) - -# Copy Nix to the Nix store on the target device. -echo "copying Nix to $targetDevice...." -for i in $storePaths; do - echo " $i" - rsync -a $i $mountPoint/nix/store/ -done - - -# Register the paths in the Nix closure as valid. This is necessary -# to prevent them from being deleted the first time we install -# something. (I.e., Nix will see that, e.g., the glibc path is not -# valid, delete it to get it out of the way, but as a result nothing -# will work anymore.) -chroot $mountPoint @nix@/bin/nix-store --register-validity < @nixClosure@ - - -# Create the required /bin/sh symlink; otherwise lots of things -# (notably the system() function) won't work. -mkdir -m 0755 -p $mountPoint/bin -ln -sf $(type -tp sh) $mountPoint/bin/sh - - -# Enable networking in the chroot. -mkdir -m 0755 -p $mountPoint/etc -cp /etc/resolv.conf $mountPoint/etc/ - - -# Do a nix-pull to speed up building. -nixpkgsURL=http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre6984 -chroot $mountPoint @nix@/bin/nix-pull $nixpkgsURL/MANIFEST - - -# Build the specified Nix expression in the target store and install -# it into the system configuration profile. - -#rm -rf $mountPoint/scratch -#mkdir $mountPoint/scratch -#curl $nixpkgsURL/nixexprs.tar.bz2 | tar xj -C $mountPoint/scratch -#nixpkgsName=$(cd $mountPoint/scratch && ls) - -chroot $mountPoint @nix@/bin/nix-env \ - -p /nix/var/nix/profiles/system \ - -f "/mnt/$nixExpr" -i -A systemConfiguration - - -# Grub needs a mtab. -echo "$targetDevice / somefs rw 0 0" > $mountPoint/etc/mtab - - -# Switch to the new system configuration. This will install Grub with -# a menu default pointing at the kernel/initrd/etc of the new -# configuration. -echo "finalising the installation..." -NIXOS_INSTALL_GRUB=1 chroot $mountPoint /nix/var/nix/profiles/system/bin/switch-to-configuration diff --git a/test/isolinux.cfg b/test/isolinux.cfg deleted file mode 100644 index ff19e84c098..00000000000 --- a/test/isolinux.cfg +++ /dev/null @@ -1,6 +0,0 @@ -default linux -prompt 1 -timeout 60 -label linux - kernel vmlinuz - append initrd=initrd selinux=0 apm=on acpi=on diff --git a/test/make-devices.sh b/test/make-devices.sh deleted file mode 100644 index 1e9f9719ea4..00000000000 --- a/test/make-devices.sh +++ /dev/null @@ -1,53 +0,0 @@ -mknod -m 0600 /dev/ttyS0 c 4 64 -mknod -m 0600 /dev/ttyS1 c 4 65 -mknod -m 0600 /dev/ttyS2 c 4 66 -mknod -m 0600 /dev/ttyS3 c 4 67 - -# base UNIX devices -mknod -m 0600 /dev/mem c 1 1 -mknod -m 0666 /dev/null c 1 3 -mknod -m 0666 /dev/zero c 1 5 - -# tty -mknod -m 0600 /dev/tty c 5 0 -if ! test -e /dev/console; then - mknod -m 0600 /dev/console c 5 1 -fi -for i in $(seq 0 10); do - mknod -m 0600 /dev/tty$i c 4 $i -done - -mkdir -m 0755 /dev/pts -mknod -m 0666 /dev/ptmx c 5 2 - -# random - -mknod -m 0644 /dev/random c 1 8 -mknod -m 0644 /dev/urandom c 1 9 - -mknod -m 0660 /dev/hda b 3 0 -mknod -m 0660 /dev/hda1 b 3 1 -mknod -m 0660 /dev/hda2 b 3 2 -mknod -m 0660 /dev/hda3 b 3 3 - -mknod -m 0660 /dev/hdb b 3 64 -mknod -m 0660 /dev/hdb1 b 3 65 -mknod -m 0660 /dev/hdb2 b 3 66 -mknod -m 0660 /dev/hdb3 b 3 67 - -mknod -m 0660 /dev/hdc b 22 0 -mknod -m 0660 /dev/hdc1 b 22 1 -mknod -m 0660 /dev/hdc2 b 22 2 -mknod -m 0660 /dev/hdc3 b 22 3 - -mknod -m 0660 /dev/hdd b 22 64 -mknod -m 0660 /dev/hdd1 b 22 65 -mknod -m 0660 /dev/hdd2 b 22 66 -mknod -m 0660 /dev/hdd3 b 22 67 - -#mknod -m 0660 /dev/sda b 8 0 -#mknod -m 0660 /dev/sda1 b 8 1 -#mknod -m 0660 /dev/sda2 b 8 2 -#mknod -m 0660 /dev/sda3 b 8 3 - -mknod -m 0600 /dev/initctl p diff --git a/test/make-initrd.nix b/test/make-initrd.nix deleted file mode 100644 index a28c312564e..00000000000 --- a/test/make-initrd.nix +++ /dev/null @@ -1,31 +0,0 @@ -# Create an initial ramdisk containing the closure of the specified -# file system objects. An initial ramdisk is used during the initial -# stages of booting a Linux system. It is loaded by the boot loader -# along with the kernel image. It's supposed to contain everything -# (such as kernel modules) necessary to allow us to mount the root -# file system. Once the root file system is mounted, the `real' boot -# script can be called. -# -# An initrd is really just a gzipped cpio archive. -# -# Symlinks are created for each top-level file system object. E.g., -# `contents = {object = ...; symlink = /init;}' is a typical -# argument. - -{stdenv, cpio, contents}: - -stdenv.mkDerivation { - name = "initrd"; - builder = ./make-initrd.sh; - buildInputs = [cpio]; - - # !!! should use XML. - objects = map (x: x.object) contents; - symlinks = map (x: x.symlink) contents; - suffices = map (x: if x ? suffix then x.suffix else "none") contents; - - # For obtaining the closure of `contents'. - exportReferencesGraph = - map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents; - pathsFromGraph = ./paths-from-graph.sh; -} diff --git a/test/make-initrd.sh b/test/make-initrd.sh deleted file mode 100644 index 8d07300466b..00000000000 --- a/test/make-initrd.sh +++ /dev/null @@ -1,42 +0,0 @@ -source $stdenv/setup - -set -o pipefail - -objects=($objects) -symlinks=($symlinks) -suffices=($suffices) - -mkdir root - -# Needed for splash_helper, which gets run before init. -mkdir root/dev -mkdir root/sys -mkdir root/proc - - -for ((n = 0; n < ${#objects[*]}; n++)); do - object=${objects[$n]} - symlink=${symlinks[$n]} - suffix=${suffices[$n]} - if test "$suffix" = none; then suffix=; fi - - # Get the paths in the closure of `object'. - closure=closure-$(basename $symlink) - if ! test -e $closure; then - echo 'Your Nix installation is too old! Upgrade to nix-0.11pre7038 or newer.' - exit 1 - fi - storePaths=$($SHELL $pathsFromGraph $closure) - - # Paths in cpio archives *must* be relative, otherwise the kernel - # won't unpack 'em. - (cd root && cp -prd --parents $storePaths .) - - mkdir -p $(dirname root/$symlink) - ln -s $object$suffix root/$symlink -done - - -# Put the closure in a gzipped cpio archive. -ensureDir $out -(cd root && find * -print0 | cpio -ov -H newc --null | gzip -9 > $out/initrd) diff --git a/test/make-iso9660-image.nix b/test/make-iso9660-image.nix deleted file mode 100644 index e98de8ffcb4..00000000000 --- a/test/make-iso9660-image.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ stdenv, cdrtools - - # The file name of the resulting ISO image. -, isoName ? "cd.iso" - -, # The files and directories to be placed in the ISO file system. - # This is a list of attribute sets {source, target} where `source' - # is the file system object (regular file or directory) to be - # grafted in the file system at path `target'. - contents - -/* -, # In addition to `contents', the closure of the store paths listed - # in `packages' are also placed in the file system. - packages ? [] -*/ - -, # `init' should be a store path, the closure of which is added to - # the image, just like `packages'. However, in addition, a symlink - # `/init' to `init' will be created. - init ? null - - # Whether this should be an El-Torito bootable CD. -, bootable ? false - - # The path (in the ISO file system) of the boot image. -, bootImage ? "" - -}: - -assert bootable -> bootImage != ""; - -stdenv.mkDerivation { - name = "iso9660-image"; - builder = ./make-iso9660-image.sh; - buildInputs = [cdrtools]; - inherit isoName init bootable bootImage; - sources = map ({source, target}: source) contents; - targets = map ({source, target}: target) contents; - - # For obtaining the closure of `init'. - exportReferencesGraph = ["init-closure" init]; - pathsFromGraph = ./paths-from-graph.sh; -} diff --git a/test/make-iso9660-image.sh b/test/make-iso9660-image.sh deleted file mode 100644 index 9a8bef7416d..00000000000 --- a/test/make-iso9660-image.sh +++ /dev/null @@ -1,31 +0,0 @@ -source $stdenv/setup - -if test -n "$bootable"; then - bootFlags="-b $bootImage -c boot.cat -no-emul-boot -boot-load-size 4" -fi - -graftList= -sources_=($sources) -targets_=($targets) -for ((i = 0; i < ${#targets_[@]}; i++)); do - graftList="$graftList ${targets_[$i]}=$(readlink -f ${sources_[$i]})" -done - -storePaths=$($SHELL $pathsFromGraph ./init-closure) - -for i in $storePaths; do - graftList="$graftList ${i:1}=$i" -done - -if test -n "$init"; then - ln -s $init init - graftList="$graftList init=init" -fi - -# !!! -f is a quick hack. -ensureDir $out/iso -mkisofs -r -J -o $out/iso/$isoName $bootFlags \ - -graft-points $graftList - -ensureDir $out/nix-support -echo $system > $out/nix-support/system diff --git a/test/modules-closure.nix b/test/modules-closure.nix deleted file mode 100644 index 86015a8b182..00000000000 --- a/test/modules-closure.nix +++ /dev/null @@ -1,13 +0,0 @@ -# Given a kernel build (with modules in $kernel/lib/modules/VERSION), -# produce a module tree in $out/lib/modules/VERSION that contains only -# the modules identified by `rootModules', plus their dependencies. -# Also generate an appropriate modules.dep. - -{stdenv, kernel, rootModules, module_init_tools}: - -stdenv.mkDerivation { - name = kernel.name + "-shrunk"; - builder = ./modules-closure.sh; - inherit kernel rootModules module_init_tools; - allowedReferences = ["out"]; -} diff --git a/test/modules-closure.sh b/test/modules-closure.sh deleted file mode 100644 index c5fcbba87f1..00000000000 --- a/test/modules-closure.sh +++ /dev/null @@ -1,37 +0,0 @@ -source $stdenv/setup - -set -o pipefail - -PATH=$module_init_tools/sbin:$PATH - -version=$(cd $kernel/lib/modules && ls -d *) - -echo "kernel version is $version" - -export MODULE_DIR=$kernel/lib/modules/ - -# Determine the dependencies of each root module. -closure= -for module in $rootModules; do - echo "root module: $module" - deps=$(modprobe --set-version "$version" --show-depends "$module" \ - | sed 's/^insmod //') - for i in $deps; do echo $i; done - closure="$closure $deps" -done - -# Remove duplicates. -closure=$(for i in $closure; do echo $i; done | sort | uniq) - -echo "closure:" -ensureDir $out -for module in $closure; do - echo $module - target=$(echo $module | sed "s^$kernel^$out^") - mkdir -p $(dirname $target) - cp $module $target - grep "^$module" $kernel/lib/modules/$version/modules.dep \ - | sed "s^$kernel^$out^g" \ - >> $out/lib/modules/$version/modules.dep -done - diff --git a/test/options.nix b/test/options.nix deleted file mode 100644 index 4cd2f3a7343..00000000000 --- a/test/options.nix +++ /dev/null @@ -1,97 +0,0 @@ -[ - - { - name = ["networking" "hostname"]; - default = "nixos"; - description = "The name of the machine."; - } - - { - name = ["networking" "useDHCP"]; - default = true; - description = " - Whether to use DHCP to obtain an IP adress and other - configuration for all network interfaces that are not manually - configured. - "; - } - - { - name = ["networking" "interfaces"]; - default = []; - example = [ - { interface = "eth0"; - ipAddress = "131.211.84.78"; - netmask = "255.255.255.128"; - gateway = "131.211.84.1"; - } - ]; - description = " - The configuration for each network interface. If - is true, then each interface - not listed here will be configured using DHCP. - "; - } - - { - name = ["filesystems" "mountPoints"]; - example = [ - { device = "/dev/hda2"; - mountPoint = "/"; - } - ]; - description = " - The file systems to be mounted by NixOS. It must include an - entry for the root directory (mountPoint = - \"/\"). This is the file system on which NixOS is (to - be) installed.. - "; - } - - { - name = ["services" "syslogd" "tty"]; - default = 10; - description = " - The tty device on which syslogd will print important log - messages. - "; - } - - { - name = ["services" "mingetty" "ttys"]; - default = [1 2 3 4 5 6]; - description = " - The list of tty (virtual console) devices on which to start a - login prompt. - "; - } - - { - name = ["services" "mingetty" "waitOnMounts"]; - default = false; - description = " - Whether the login prompts on the virtual consoles will be - started before or after all file systems have been mounted. By - default we don't wait, but if for example your /home is on a - separate partition, you may want to turn this on. - "; - } - - { - name = ["services" "sshd" "enable"]; - default = false; - description = " - Whether to enable the Secure Shell daemon, which allows secure - remote logins. - "; - } - - { - name = ["services" "sshd" "forwardX11"]; - default = false; - description = " - Whether to enable sshd to forward X11 connections. - "; - } - -] diff --git a/test/paths-from-graph.sh b/test/paths-from-graph.sh deleted file mode 100644 index 4a134cb3165..00000000000 --- a/test/paths-from-graph.sh +++ /dev/null @@ -1,10 +0,0 @@ -graph="$1" - -while read storePath; do - echo $storePath - read deriver - read count - for ((i = 0; i < $count; i++)); do - read ref - done -done < $graph diff --git a/test/rescue-cd.nix b/test/rescue-cd.nix deleted file mode 100644 index 48040f6495c..00000000000 --- a/test/rescue-cd.nix +++ /dev/null @@ -1,101 +0,0 @@ -let - - # The label used to identify the installation CD. - cdromLabel = "NIXOS"; - -in - - # Build boot scripts for the CD that find the CD-ROM automatically. - with import ./boot-environment.nix { - autoDetectRootDevice = true; - rootLabel = cdromLabel; - stage2Init = "/init"; - readOnlyRoot = true; - }; - - -rec { - - inherit nixosInstaller bootStage1 upstartJobs; # !!! debug - - - # 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} - "; - }; - - - # 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') - "; - }; - - - # Put the current directory in the tarball. !!! This gives us a lot - # of crap (like .svn if this is a working copy). An "svn export" - # would be better, but that's impure. - nixosTarball = makeTarball "nixos.tar.bz2" ./.; - - - nixpkgsTarball = pkgs.fetchurl { - url = http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre7087/nixpkgs-0.11pre7087.tar.bz2; - md5 = "c5840fcd049d75e00ad856ecbbef6857"; - }; - - - # Create an ISO image containing the isolinux boot loader, the - # kernel, the initrd produced above, and the closure of the stage 2 - # init. - rescueCD = import ./make-iso9660-image.nix { - inherit (pkgs) stdenv cdrtools; - isoName = "nixos.iso"; - - contents = [ - { source = pkgs.syslinux + "/lib/syslinux/isolinux.bin"; - target = "isolinux/isolinux.bin"; - } - { source = ./isolinux.cfg; - target = "isolinux/isolinux.cfg"; - } - { source = pkgs.kernel + "/vmlinuz"; - target = "isolinux/vmlinuz"; - } - { source = initialRamdisk + "/initrd"; - target = "isolinux/initrd"; - } - { source = cdMountPoints; - target = "/"; - } - { source = nixosTarball + "/" + nixosTarball.tarName; - target = "/" + nixosTarball.tarName; - } - { source = nixpkgsTarball; - target = "/nixpkgs.tar.bz2"; - } - ]; - - init = bootStage2; - - bootable = true; - bootImage = "isolinux/isolinux.bin"; - }; - - -} diff --git a/test/splash-themes.nix b/test/splash-themes.nix deleted file mode 100644 index 25be6168b37..00000000000 --- a/test/splash-themes.nix +++ /dev/null @@ -1,58 +0,0 @@ -{fetchurl}: - -rec { - - # Some themes. - - themeBabyTux = fetchurl { - url = http://www.bootsplash.de/files/themes/Theme-BabyTux.tar.bz2; - md5 = "a6d89d1c1cff3b6a08e2f526f2eab4e0"; - }; - - themeFrozenBubble = fetchurl { - url = http://www.bootsplash.de/files/themes/Theme-FrozenBubble.tar.bz2; - md5 = "da49f04988ab04b7e0de117b0d25061a"; - }; - - themePativo = fetchurl { # Yeah! - url = http://www.bootsplash.de/files/themes/Theme-Pativo.tar.bz2; - md5 = "9e13beaaadf88d43a5293e7ab757d569"; - }; - - themeGNU = fetchurl { - url = http://www.bootsplash.de/files/themes/Theme-GNU.tar.bz2; - md5 = "61969309d23c631e57b0a311102ef034"; - }; - - - # The splash screen. - - splashScreen = themeBabyTux; - - - # The themes to use for each tty. For each tty except the first - # entry in the list, you can omit `theme' to get the same theme as - # the first one. If a tty does not appear, it doesn't get a - # theme (i.e., it will keep a black background). - - ttyBackgrounds = [ - { tty = 1; - theme = themeBabyTux; - } - { tty = 2; - } - { tty = 3; - theme = themeGNU; - } - { tty = 4; - theme = themeGNU; - } - { tty = 5; - theme = themePativo; - } - { tty = 10; # logging console - theme = themeGNU; - } - ]; - -} diff --git a/test/system-configuration.nix b/test/system-configuration.nix deleted file mode 100644 index 640f17f907e..00000000000 --- a/test/system-configuration.nix +++ /dev/null @@ -1,55 +0,0 @@ -let - - # The root device. - rootDevice = "/dev/hda1"; - - # The device on which GRUB should be installed (leave empty if you - # don't want GRUB to be installed). - grubDevice = "/dev/hda"; - - # Build boot scripts. - bootEnv = import ./boot-environment.nix { - autoDetectRootDevice = false; - inherit rootDevice; - stage2Init = ""; # Passed on the command line via Grub. - readOnlyRoot = false; - }; - - # Extra kernel command line arguments. - extraKernelParams = [ - "selinux=0" - "apm=on" - "acpi=on" - "vga=0x317" - "console=tty1" - "splash=verbose" - ]; - -in - -with bootEnv; - -rec { - - - systemConfiguration = pkgs.stdenv.mkDerivation { - name = "system-configuration"; - builder = ./system-configuration.sh; - inherit (pkgs) grub coreutils gnused gnugrep diffutils; - inherit grubDevice; - inherit bootStage2; - inherit grubMenuBuilder; - kernel = pkgs.kernel + "/vmlinuz"; - initrd = initialRamdisk + "/initrd"; - inherit extraKernelParams; - }; - - - grubMenuBuilder = pkgs.genericSubstituter { - src = ./grub-menu-builder.sh; - isExecutable = true; - inherit (pkgs) bash; - }; - - -} diff --git a/test/system-configuration.sh b/test/system-configuration.sh deleted file mode 100644 index fa2e7def257..00000000000 --- a/test/system-configuration.sh +++ /dev/null @@ -1,31 +0,0 @@ -source $stdenv/setup - -ensureDir $out - -ln -s $kernel $out/kernel -ln -s $grub $out/grub -ln -s $bootStage2 $out/init -ln -s $initrd $out/initrd -echo "$extraKernelParams" > $out/kernel-params - -cat > $out/menu.lst << GRUBEND -kernel $kernel init=$bootStage2 $extraKernelParams -initrd $initrd -GRUBEND - -ensureDir $out/bin - -cat > $out/bin/switch-to-configuration <>>\" - echo \"\" - - # Do an initial sync just in case. - sync || true - - # Unmount file systems. - umount -n -a || true - - # Remount / read-only - mount -n -o remount,ro /dontcare / || true - - # Final sync. - sync || true - - # Right now all events above power off the system. - if test ${event} = reboot; then - exec reboot -f - else - exec halt -f -p - fi -end script - "; - -} diff --git a/test/upstart-jobs/hardware-scan.nix b/test/upstart-jobs/hardware-scan.nix deleted file mode 100644 index 3ffd8f9223f..00000000000 --- a/test/upstart-jobs/hardware-scan.nix +++ /dev/null @@ -1,23 +0,0 @@ -# !!! Don't like it that I have to pass the kernel here. -{kernel, module_init_tools}: - -{ - name = "hardware-scan"; - - job = " -start on startup - -script - export MODULE_DIR=${kernel}/lib/modules/ - - # Try to load modules for all PCI devices. - for i in /sys/bus/pci/devices/*/modalias; do - echo \"Trying to load a module for $(basename $(dirname $i))...\" - ${module_init_tools}/sbin/modprobe $(cat $i) || true - echo \"\" - done -end script - - "; - -} diff --git a/test/upstart-jobs/maintenance-shell.nix b/test/upstart-jobs/maintenance-shell.nix deleted file mode 100644 index 9e2acdaa0f5..00000000000 --- a/test/upstart-jobs/maintenance-shell.nix +++ /dev/null @@ -1,19 +0,0 @@ -{bash}: - -{ - name = "maintenance-shell"; - - job = " -start on maintenance -start on stalled - -script - exec < /dev/tty1 > /dev/tty1 2>&1 - echo \"\" - echo \"<<< MAINTENANCE SHELL >>>\" - echo \"\" - exec ${bash}/bin/sh -end script - "; - -} diff --git a/test/upstart-jobs/make-job.nix b/test/upstart-jobs/make-job.nix deleted file mode 100644 index 3995a8f21aa..00000000000 --- a/test/upstart-jobs/make-job.nix +++ /dev/null @@ -1,7 +0,0 @@ -{stdenv}: 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"; -} diff --git a/test/upstart-jobs/mingetty.nix b/test/upstart-jobs/mingetty.nix deleted file mode 100644 index cdce937535c..00000000000 --- a/test/upstart-jobs/mingetty.nix +++ /dev/null @@ -1,10 +0,0 @@ -{mingetty, ttyNumber}: - -{ - name = "tty" + toString ttyNumber; - job = " - start on startup - stop on shutdown - respawn ${mingetty}/sbin/mingetty --noclear tty${toString ttyNumber} - "; -} diff --git a/test/upstart-jobs/network-interfaces.nix b/test/upstart-jobs/network-interfaces.nix deleted file mode 100644 index d85c7e02001..00000000000 --- a/test/upstart-jobs/network-interfaces.nix +++ /dev/null @@ -1,36 +0,0 @@ -# !!! Don't like it that I have to pass the kernel here. -{nettools, kernel, module_init_tools}: - -{ - name = "network-interfaces"; - - job = " -start on hardware-scan -stop on shutdown - -start script - export MODULE_DIR=${kernel}/lib/modules/ - - ${module_init_tools}/sbin/modprobe af_packet - - for i in $(cd /sys/class/net && ls -d *); do - echo \"Bringing up network device $i...\" - ${nettools}/sbin/ifconfig $i up || true - done - -end script - -# Hack: Upstart doesn't yet support what we want: a service that -# doesn't have a running process associated with it. -respawn sleep 10000 - -stop script - for i in $(cd /sys/class/net && ls -d *); do - echo \"Taking down network device $i...\" - ${nettools}/sbin/ifconfig $i down || true - done -end script - - "; - -} diff --git a/test/upstart-jobs/sshd.nix b/test/upstart-jobs/sshd.nix deleted file mode 100644 index 466c7616f55..00000000000 --- a/test/upstart-jobs/sshd.nix +++ /dev/null @@ -1,32 +0,0 @@ -{openssh}: - -{ - name = "sshd"; - - job = " -description \"SSH server\" - -start on network-interfaces/started -stop on network-interfaces/stop - -start script - mkdir -m 0555 -p /var/empty - - mkdir -m 0755 -p /etc/ssh - - echo 'X11Forwarding yes' > /etc/ssh/sshd_config - - if ! test -f /etc/ssh/ssh_host_dsa_key; then - ${openssh}/bin/ssh-keygen -t dsa -b 1024 -f /etc/ssh/ssh_host_dsa_key -N '' - fi - - if ! grep -q '^sshd:' /etc/passwd; then - echo 'sshd:x:74:74:SSH privilege separation user:/var/empty:/noshell' >> /etc/passwd - fi - -end script - -respawn ${openssh}/sbin/sshd -D -h /etc/ssh/ssh_host_dsa_key -f /etc/ssh/sshd_config - "; - -} diff --git a/test/upstart-jobs/syslogd.nix b/test/upstart-jobs/syslogd.nix deleted file mode 100644 index 8f326b0d6cf..00000000000 --- a/test/upstart-jobs/syslogd.nix +++ /dev/null @@ -1,10 +0,0 @@ -{sysklogd}: - -{ - name = "syslogd"; - job = " - start on startup - stop on shutdown - respawn ${sysklogd}/sbin/syslogd -n - "; -} diff --git a/test/upstart-jobs/tty-backgrounds-combine.sh b/test/upstart-jobs/tty-backgrounds-combine.sh deleted file mode 100644 index 894952d6940..00000000000 --- a/test/upstart-jobs/tty-backgrounds-combine.sh +++ /dev/null @@ -1,37 +0,0 @@ -source $stdenv/setup - -ttys=($ttys) -themes=($themes) - -ensureDir $out - -default= - -for ((n = 0; n < ${#ttys[*]}; n++)); do - tty=${ttys[$n]} - theme=${themes[$n]} - - if test "$theme" = "default"; then - if test -z "$default"; then - echo "No default theme!" - exit 1 - fi - theme=$default - fi - - if test -z "$default"; then default=$theme; fi - - echo "TTY $tty -> $theme" - - themeName=$(cd $theme && ls | grep -v default) - - ln -sf $theme/$themeName $out/$themeName - - if test -e $out/$tty; then - echo "Multiple themes defined for the same TTY!" - exit 1 - fi - - ln -sf $themeName $out/$tty - -done diff --git a/test/upstart-jobs/tty-backgrounds.nix b/test/upstart-jobs/tty-backgrounds.nix deleted file mode 100644 index abe6f52305a..00000000000 --- a/test/upstart-jobs/tty-backgrounds.nix +++ /dev/null @@ -1,52 +0,0 @@ -{stdenv, splashutils, backgrounds}: - -rec { - name = "tty-backgrounds"; - - unpackTheme = theme: import ../helpers/unpack-theme.nix { - inherit stdenv theme; - }; - - themesUnpacked = stdenv.mkDerivation { - name = "splash-themes"; - builder = ./tty-backgrounds-combine.sh; - # !!! Should use XML here. - ttys = map (x: x.tty) backgrounds; - themes = map (x: if x ? theme then (unpackTheme x.theme) else "default") backgrounds; - }; - - job = " -start on hardware-scan - -start script - - rm -f /etc/splash - ln -s ${themesUnpacked} /etc/splash - - # Critical: tell the kernel where to find splash_helper. It calls - # this program every time we switch between consoles. - echo ${splashutils}/bin/splash_helper > /proc/sys/kernel/fbsplash - - # Set the theme for each console, as determined by - # tty-backgrounds-combine.sh above. - for tty in ${toString (map (x: x.tty) backgrounds)}; do - theme=$(readlink ${themesUnpacked}/$tty) - ${splashutils}/bin/splash_util --tty $tty -c setcfg -t $theme || true - ${splashutils}/bin/splash_util --tty $tty -c setpic -t $theme || true - ${splashutils}/bin/splash_util --tty $tty -c on || true - done - -end script - -respawn sleep 10000 # !!! Hack - -stop script - # Disable the theme on each console. - for tty in ${toString (map (x: x.tty) backgrounds)}; do - ${splashutils}/bin/splash_util --tty $tty -c off || true - done -end script - - "; - -} -- GitLab From 5c89e891dfd63ba4ed1189de153b6cbd0ad7c906 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 28 Nov 2006 10:45:21 +0000 Subject: [PATCH 0268/5331] * Refactoring. svn path=/nixos/trunk/; revision=7156 --- .../boot-stage-1-init.sh | 0 boot-stage-1.nix => boot/boot-stage-1.nix | 0 .../boot-stage-2-init.sh | 0 boot-stage-2.nix => boot/boot-stage-2.nix | 0 make-devices.sh => boot/make-devices.sh | 0 make-initrd.nix => boot/make-initrd.nix | 2 +- make-initrd.sh => boot/make-initrd.sh | 0 .../boot-environment.nix | 48 +++++++++---------- options.nix => configuration/options.nix | 0 .../splash-themes.nix | 0 .../system-configuration.nix | 2 +- .../system-configuration.sh | 0 isolinux.cfg => helpers/isolinux.cfg | 0 .../make-iso9660-image.nix | 0 .../make-iso9660-image.sh | 0 .../modules-closure.nix | 0 .../modules-closure.sh | 0 .../paths-from-graph.sh | 0 .../grub-menu-builder.sh | 0 .../nixos-installer.nix | 4 +- installer.sh => installer/nixos-installer.sh | 0 rescue-cd.nix => instances/rescue-cd.nix | 6 +-- 22 files changed, 31 insertions(+), 31 deletions(-) rename boot-stage-1-init.sh => boot/boot-stage-1-init.sh (100%) rename boot-stage-1.nix => boot/boot-stage-1.nix (100%) rename boot-stage-2-init.sh => boot/boot-stage-2-init.sh (100%) rename boot-stage-2.nix => boot/boot-stage-2.nix (100%) rename make-devices.sh => boot/make-devices.sh (100%) rename make-initrd.nix => boot/make-initrd.nix (95%) rename make-initrd.sh => boot/make-initrd.sh (100%) rename boot-environment.nix => configuration/boot-environment.nix (81%) rename options.nix => configuration/options.nix (100%) rename splash-themes.nix => configuration/splash-themes.nix (100%) rename system-configuration.nix => configuration/system-configuration.nix (96%) rename system-configuration.sh => configuration/system-configuration.sh (100%) rename isolinux.cfg => helpers/isolinux.cfg (100%) rename make-iso9660-image.nix => helpers/make-iso9660-image.nix (100%) rename make-iso9660-image.sh => helpers/make-iso9660-image.sh (100%) rename modules-closure.nix => helpers/modules-closure.nix (100%) rename modules-closure.sh => helpers/modules-closure.sh (100%) rename paths-from-graph.sh => helpers/paths-from-graph.sh (100%) rename grub-menu-builder.sh => installer/grub-menu-builder.sh (100%) rename installer.nix => installer/nixos-installer.nix (79%) rename installer.sh => installer/nixos-installer.sh (100%) rename rescue-cd.nix => instances/rescue-cd.nix (94%) diff --git a/boot-stage-1-init.sh b/boot/boot-stage-1-init.sh similarity index 100% rename from boot-stage-1-init.sh rename to boot/boot-stage-1-init.sh diff --git a/boot-stage-1.nix b/boot/boot-stage-1.nix similarity index 100% rename from boot-stage-1.nix rename to boot/boot-stage-1.nix diff --git a/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh similarity index 100% rename from boot-stage-2-init.sh rename to boot/boot-stage-2-init.sh diff --git a/boot-stage-2.nix b/boot/boot-stage-2.nix similarity index 100% rename from boot-stage-2.nix rename to boot/boot-stage-2.nix diff --git a/make-devices.sh b/boot/make-devices.sh similarity index 100% rename from make-devices.sh rename to boot/make-devices.sh diff --git a/make-initrd.nix b/boot/make-initrd.nix similarity index 95% rename from make-initrd.nix rename to boot/make-initrd.nix index a28c312564e..b737b2f9779 100644 --- a/make-initrd.nix +++ b/boot/make-initrd.nix @@ -27,5 +27,5 @@ stdenv.mkDerivation { # For obtaining the closure of `contents'. exportReferencesGraph = map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents; - pathsFromGraph = ./paths-from-graph.sh; + pathsFromGraph = ../helpers/paths-from-graph.sh; } diff --git a/make-initrd.sh b/boot/make-initrd.sh similarity index 100% rename from make-initrd.sh rename to boot/make-initrd.sh diff --git a/boot-environment.nix b/configuration/boot-environment.nix similarity index 81% rename from boot-environment.nix rename to configuration/boot-environment.nix index 78086e99cfc..b38c73b0035 100644 --- a/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -8,21 +8,21 @@ rec { - pkgs = import ./pkgs/top-level/all-packages.nix {inherit system;}; + pkgs = import ../pkgs/top-level/all-packages.nix {inherit system;}; - pkgsDiet = import ./pkgs/top-level/all-packages.nix { + pkgsDiet = import ../pkgs/top-level/all-packages.nix { inherit system; bootStdenv = pkgs.useDietLibC pkgs.stdenv; }; - pkgsStatic = import ./pkgs/top-level/all-packages.nix { + pkgsStatic = import ../pkgs/top-level/all-packages.nix { inherit system; bootStdenv = pkgs.makeStaticBinaries pkgs.stdenv; }; - stdenvLinuxStuff = import ./pkgs/stdenv/linux { + stdenvLinuxStuff = import ../pkgs/stdenv/linux { system = pkgs.stdenv.system; - allPackages = import ./pkgs/top-level/all-packages.nix; + allPackages = import ../pkgs/top-level/all-packages.nix; }; nix = pkgs.nixUnstable; # we need the exportReferencesGraph feature @@ -35,7 +35,7 @@ rec { # Determine the set of modules that we need to mount the root FS. - modulesClosure = import ./modules-closure.nix { + modulesClosure = import ../helpers/modules-closure.nix { inherit (pkgs) stdenv kernel module_init_tools; rootModules = ["ide-cd" "ide-disk" "ide-generic"]; }; @@ -63,7 +63,7 @@ rec { # The init script of boot stage 1 (loading kernel modules for # mounting the root FS). - bootStage1 = import ./boot-stage-1.nix { + bootStage1 = import ../boot/boot-stage-1.nix { inherit (pkgs) genericSubstituter; inherit (pkgsDiet) module_init_tools; inherit extraUtils; @@ -77,7 +77,7 @@ rec { # The closure of the init script of boot stage 1 is what we put in # the initial RAM disk. - initialRamdisk = import ./make-initrd.nix { + initialRamdisk = import ../boot/make-initrd.nix { inherit (pkgs) stdenv cpio; contents = [ { object = bootStage1; @@ -87,7 +87,7 @@ rec { suffix = "/bin/splash_helper"; symlink = "/sbin/splash_helper"; } - { object = import ./helpers/unpack-theme.nix { + { object = import ../helpers/unpack-theme.nix { inherit (pkgs) stdenv; theme = splashThemes.splashScreen; }; @@ -98,7 +98,7 @@ rec { # The installer. - nixosInstaller = import ./installer.nix { + nixosInstaller = import ../installer/nixos-installer.nix { inherit (pkgs) stdenv genericSubstituter; inherit nix; shell = pkgs.bash + "/bin/sh"; @@ -106,54 +106,54 @@ rec { # The services (Upstart) configuration for the system. - upstartJobs = import ./upstart-jobs/gather.nix { + upstartJobs = import ../upstart-jobs/gather.nix { inherit (pkgs) stdenv; jobs = map makeJob [ # Syslogd. - (import ./upstart-jobs/syslogd.nix { + (import ../upstart-jobs/syslogd.nix { inherit (pkgs) sysklogd; }) # Hardware scan; loads modules for PCI devices. - (import ./upstart-jobs/hardware-scan.nix { + (import ../upstart-jobs/hardware-scan.nix { inherit (pkgs) kernel module_init_tools; }) # Network interfaces. - (import ./upstart-jobs/network-interfaces.nix { + (import ../upstart-jobs/network-interfaces.nix { inherit (pkgs) nettools kernel module_init_tools; }) # DHCP client. - (import ./upstart-jobs/dhclient.nix { + (import ../upstart-jobs/dhclient.nix { dhcp = pkgs.dhcpWrapper; }) # SSH daemon. - (import ./upstart-jobs/sshd.nix { + (import ../upstart-jobs/sshd.nix { inherit (pkgs) openssh; }) # Transparent TTY backgrounds. - (import ./upstart-jobs/tty-backgrounds.nix { + (import ../upstart-jobs/tty-backgrounds.nix { inherit (pkgs) stdenv splashutils; backgrounds = splashThemes.ttyBackgrounds; }) # Handles the maintenance/stalled event (single-user shell). - (import ./upstart-jobs/maintenance-shell.nix { + (import ../upstart-jobs/maintenance-shell.nix { inherit (pkgs) bash; }) # Ctrl-alt-delete action. - (import ./upstart-jobs/ctrl-alt-delete.nix) + (import ../upstart-jobs/ctrl-alt-delete.nix) ] # Handles the reboot/halt events. ++ (map - (event: makeJob (import ./upstart-jobs/halt.nix { + (event: makeJob (import ../upstart-jobs/halt.nix { inherit (pkgs) bash; inherit event; })) @@ -162,7 +162,7 @@ rec { # The terminals on ttyX. ++ (map - (ttyNumber: makeJob (import ./upstart-jobs/mingetty.nix { + (ttyNumber: makeJob (import ../upstart-jobs/mingetty.nix { mingetty = pkgs.mingettyWrapper; inherit ttyNumber; })) @@ -174,14 +174,14 @@ rec { }; - makeJob = import ./upstart-jobs/make-job.nix { + makeJob = import ../upstart-jobs/make-job.nix { inherit (pkgs) stdenv; }; # The init script of boot stage 2, which is supposed to do # everything else to bring up the system. - bootStage2 = import ./boot-stage-2.nix { + bootStage2 = import ../boot/boot-stage-2.nix { inherit (pkgs) genericSubstituter coreutils findutils utillinux kernel udev upstart; inherit upstartJobs; @@ -222,7 +222,7 @@ rec { }; - lib = import ./pkgs/lib; + lib = pkgs.library; config = rec { diff --git a/options.nix b/configuration/options.nix similarity index 100% rename from options.nix rename to configuration/options.nix diff --git a/splash-themes.nix b/configuration/splash-themes.nix similarity index 100% rename from splash-themes.nix rename to configuration/splash-themes.nix diff --git a/system-configuration.nix b/configuration/system-configuration.nix similarity index 96% rename from system-configuration.nix rename to configuration/system-configuration.nix index 640f17f907e..db4482306e4 100644 --- a/system-configuration.nix +++ b/configuration/system-configuration.nix @@ -46,7 +46,7 @@ rec { grubMenuBuilder = pkgs.genericSubstituter { - src = ./grub-menu-builder.sh; + src = ../installer/grub-menu-builder.sh; isExecutable = true; inherit (pkgs) bash; }; diff --git a/system-configuration.sh b/configuration/system-configuration.sh similarity index 100% rename from system-configuration.sh rename to configuration/system-configuration.sh diff --git a/isolinux.cfg b/helpers/isolinux.cfg similarity index 100% rename from isolinux.cfg rename to helpers/isolinux.cfg diff --git a/make-iso9660-image.nix b/helpers/make-iso9660-image.nix similarity index 100% rename from make-iso9660-image.nix rename to helpers/make-iso9660-image.nix diff --git a/make-iso9660-image.sh b/helpers/make-iso9660-image.sh similarity index 100% rename from make-iso9660-image.sh rename to helpers/make-iso9660-image.sh diff --git a/modules-closure.nix b/helpers/modules-closure.nix similarity index 100% rename from modules-closure.nix rename to helpers/modules-closure.nix diff --git a/modules-closure.sh b/helpers/modules-closure.sh similarity index 100% rename from modules-closure.sh rename to helpers/modules-closure.sh diff --git a/paths-from-graph.sh b/helpers/paths-from-graph.sh similarity index 100% rename from paths-from-graph.sh rename to helpers/paths-from-graph.sh diff --git a/grub-menu-builder.sh b/installer/grub-menu-builder.sh similarity index 100% rename from grub-menu-builder.sh rename to installer/grub-menu-builder.sh diff --git a/installer.nix b/installer/nixos-installer.nix similarity index 79% rename from installer.nix rename to installer/nixos-installer.nix index 44080b86a85..818b3e19887 100644 --- a/installer.nix +++ b/installer/nixos-installer.nix @@ -2,12 +2,12 @@ }: genericSubstituter { - src = ./installer.sh; + src = ./nixos-installer.sh; dir = "bin"; isExecutable = true; inherit shell nix; - pathsFromGraph = ./paths-from-graph.sh; + pathsFromGraph = ../helpers/paths-from-graph.sh; nixClosure = stdenv.mkDerivation { name = "closure"; diff --git a/installer.sh b/installer/nixos-installer.sh similarity index 100% rename from installer.sh rename to installer/nixos-installer.sh diff --git a/rescue-cd.nix b/instances/rescue-cd.nix similarity index 94% rename from rescue-cd.nix rename to instances/rescue-cd.nix index 48040f6495c..a8a88836911 100644 --- a/rescue-cd.nix +++ b/instances/rescue-cd.nix @@ -6,7 +6,7 @@ let in # Build boot scripts for the CD that find the CD-ROM automatically. - with import ./boot-environment.nix { + with import ../configuration/boot-environment.nix { autoDetectRootDevice = true; rootLabel = cdromLabel; stage2Init = "/init"; @@ -63,7 +63,7 @@ rec { # Create an ISO image containing the isolinux boot loader, the # kernel, the initrd produced above, and the closure of the stage 2 # init. - rescueCD = import ./make-iso9660-image.nix { + rescueCD = import ../helpers/make-iso9660-image.nix { inherit (pkgs) stdenv cdrtools; isoName = "nixos.iso"; @@ -71,7 +71,7 @@ rec { { source = pkgs.syslinux + "/lib/syslinux/isolinux.bin"; target = "isolinux/isolinux.bin"; } - { source = ./isolinux.cfg; + { source = ../helpers/isolinux.cfg; target = "isolinux/isolinux.cfg"; } { source = pkgs.kernel + "/vmlinuz"; -- GitLab From cba92bbdf132f25fb00b6ca1455dca6dc9bac650 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 28 Nov 2006 13:36:27 +0000 Subject: [PATCH 0269/5331] * First step towards setuid/setgid support: a setuid/setgid wrapper program. The Nix store cannot directly support setuid binaries for a number of reasons: - Builds are generally not performed as root (and they shouldn't be), so the builder cannot chown/chmod executables to the right setuid ownership. - Unpacking a NAR archive containing a setuid binary would only work when Nix is run as root. - Worst of all, setuid binaries don't fit in the purely functional model: if a security bug is discovered in a setuid binary, that binary should be removed from the system to prevent users from calling it. But we cannot garbage collect it unless all references to it are gone, which might never happen. Of course, we could just remove setuid permission, but that would also be impure. So the solution is to keep setuid-ness out of the Nix store. Rather, for programs that we want to execute as setuid, we generate wrapper programs (as root) that are setuid and do an execve() to call the real, non-setuid program in the Nix store. That's what setuid-wrapper does. It determines its own name (e.g., /var/setuid-wrappers/passwd), reads the name of the wrapped program from .real (e.g., /var/setuid-wrappers/passwd.real, which might contain /nix/var/nix/profiles/system/bin/passwd), and executes it. Thus, the non-setuid passwd in the Nix store would be executed with the effective user set to root. Setuid-wrapper also performs a few security checks to prevent it from reading a fake .real file through hard-linking tricks. svn path=/nixos/trunk/; revision=7157 --- helpers/setuid/setuid-wrapper.c | 77 +++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 helpers/setuid/setuid-wrapper.c diff --git a/helpers/setuid/setuid-wrapper.c b/helpers/setuid/setuid-wrapper.c new file mode 100644 index 00000000000..04923896d4e --- /dev/null +++ b/helpers/setuid/setuid-wrapper.c @@ -0,0 +1,77 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +extern char **environ; + +static char * wrapperDir = "/home/root/nixos/helpers/setuid"; + +int main(int argc, char * * argv) +{ + char self[PATH_MAX]; + + int len = readlink("/proc/self/exe", self, sizeof(self) - 1); + if (len == -1) abort(); + self[len] = 0; + + //printf("self = %s, ch = %c\n", self, self[strlen(wrapperDir)]); + + + /* Make sure that we are being executed from the right location, + i.e., `wrapperDir'. This is to prevent someone from + creating hard link `X' from some other location, along with a + false `X.real' file, to allow arbitrary programs from being + executed setuid. */ + if ((strncmp(self, wrapperDir, sizeof(wrapperDir)) != 0) || + (self[strlen(wrapperDir)] != '/')) + abort(); + + + /* Make *really* *really* sure that we were executed as `self', + and not, say, as some other setuid program. That is, our + effective uid/gid should match the uid/gid of `self'. */ + //printf("%d %d\n", geteuid(), getegid()); + + struct stat st; + if (lstat(self, &st) == -1) abort(); + + //printf("%d %d\n", st.st_uid, st.st_gid); + + if ((st.st_mode & S_ISUID) != 0 && + st.st_uid != geteuid()) + abort(); + + if ((st.st_mode & S_ISGID) != 0 && + st.st_gid != getegid()) + abort(); + + /* And, of course, we shouldn't be writable. */ + if (st.st_mode & (S_IWGRP | S_IWOTH)) + abort(); + + + /* Read the path of the real (wrapped) program from .real. */ + char realFN[PATH_MAX + 10]; + if (snprintf(realFN, sizeof(realFN), "%s.real", self) >= sizeof(realFN)) + abort(); + + int fdSelf = open(realFN, O_RDONLY); + if (fdSelf == -1) abort(); + + char real[PATH_MAX]; + len = read(fdSelf, real, PATH_MAX); + if (len == -1) abort(); + if (len == sizeof(real)) abort(); + real[len] = 0; + + //printf("real = %s, len = %d\n", real, len); + + execve(real, argv, environ); + + exit(1); +} -- GitLab From cb6c02f092bcdec37dae6f71a16b3c378c3e80bb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 28 Nov 2006 15:06:08 +0000 Subject: [PATCH 0270/5331] * Set NIX_CONF_DIR. svn path=/nixos/trunk/; revision=7158 --- boot/boot-stage-2-init.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index 57a6a20a71f..009e9af7c87 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -145,6 +145,7 @@ done cat > /etc/profile < Date: Tue, 28 Nov 2006 16:47:14 +0000 Subject: [PATCH 0271/5331] * Don't put every package in the boot environment in $PATH but rather create a symlink tree and put that in $PATH. svn path=/nixos/trunk/; revision=7161 --- boot/boot-stage-2-init.sh | 9 ++------- boot/boot-stage-2.nix | 30 ++++++++++++++++++++++++------ configuration/boot-environment.nix | 2 +- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index 009e9af7c87..ee18c320c97 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -11,7 +11,7 @@ echo # Set the PATH. export PATH=/empty -for i in @path@; do +for i in @startPath@; do PATH=$PATH:$i/bin if test -e $i/sbin; then PATH=$PATH:$i/sbin @@ -135,12 +135,7 @@ EOF # Additional path for the interactive shell. -for i in @extraPath@; do - PATH=$PATH:$i/bin - if test -e $i/sbin; then - PATH=$PATH:$i/sbin - fi -done +PATH=@fullPath@/bin:@fullPath@/sbin cat > /etc/profile < Date: Tue, 28 Nov 2006 16:59:47 +0000 Subject: [PATCH 0272/5331] * Handle the case where nix-env is a symlink. svn path=/nixos/trunk/; revision=7162 --- boot/boot-stage-2-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index ee18c320c97..5ad85bea27e 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -142,7 +142,7 @@ export PATH=$PATH export MODULE_DIR=$MODULE_DIR export NIX_CONF_DIR=/nix/etc/nix -source $(dirname $(type -tp nix-env))/../etc/profile.d/nix.sh +source $(dirname $(readlink -f $(type -tp nix-env)))/../etc/profile.d/nix.sh alias ll="ls -l" -- GitLab From 39ac293b58e3d10dfba686067df5f12f80807d92 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 28 Nov 2006 17:34:27 +0000 Subject: [PATCH 0273/5331] * Create setuid wrappers for a few programs (su and passwd). This is still a bit ad hoc, but it works. svn path=/nixos/trunk/; revision=7163 --- boot/boot-stage-2-init.sh | 15 ++++++++++++++- boot/boot-stage-2.nix | 7 ++++--- configuration/boot-environment.nix | 7 +++++++ helpers/setuid/builder.sh | 5 +++++ helpers/setuid/default.nix | 8 ++++++++ helpers/setuid/setuid-wrapper.c | 2 +- 6 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 helpers/setuid/builder.sh create mode 100644 helpers/setuid/default.nix diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index 5ad85bea27e..262412c9eb4 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -135,7 +135,7 @@ EOF # Additional path for the interactive shell. -PATH=@fullPath@/bin:@fullPath@/sbin +PATH=@wrapperDir@:@fullPath@/bin:@fullPath@/sbin cat > /etc/profile < $wrapperDir/$i.real + chown root.root $wrapperDir/$i + chmod 4755 $wrapperDir/$i +done + + # Set the host name. hostname @hostName@ diff --git a/boot/boot-stage-2.nix b/boot/boot-stage-2.nix index 9c1640bc455..9e92194ded7 100644 --- a/boot/boot-stage-2.nix +++ b/boot/boot-stage-2.nix @@ -1,5 +1,5 @@ { genericSubstituter, buildEnv, shell, coreutils, findutils -, utillinux, kernel, udev, upstart +, utillinux, kernel, udev, upstart, setuidWrapper , path ? [] , # Whether the root device is root only. If so, we'll mount a @@ -20,6 +20,7 @@ let utillinux udev upstart + setuidWrapper ]; in @@ -40,6 +41,6 @@ genericSubstituter { pathsToLink = ["/bin" "/sbin" "/man/man1" "/share/man/man1"]; ignoreCollisions = true; }; - - extraPath = path; + + wrapperDir = setuidWrapper.wrapperDir; } diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index 885c994eea7..34c9a73079f 100644 --- a/configuration/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -179,11 +179,18 @@ rec { }; + setuidWrapper = import ../helpers/setuid { + inherit (pkgs) stdenv; + wrapperDir = "/var/setuid-wrappers"; + }; + + # The init script of boot stage 2, which is supposed to do # everything else to bring up the system. bootStage2 = import ../boot/boot-stage-2.nix { inherit (pkgs) genericSubstituter buildEnv coreutils findutils utillinux kernel udev upstart; + inherit setuidWrapper; inherit upstartJobs; shell = pkgs.bash + "/bin/sh"; diff --git a/helpers/setuid/builder.sh b/helpers/setuid/builder.sh new file mode 100644 index 00000000000..f9e13b1115c --- /dev/null +++ b/helpers/setuid/builder.sh @@ -0,0 +1,5 @@ +source $stdenv/setup + +ensureDir $out/bin + +gcc -Wall -O2 -DWRAPPER_DIR=\"$wrapperDir\" $setuidWrapper -o $out/bin/setuid-wrapper diff --git a/helpers/setuid/default.nix b/helpers/setuid/default.nix new file mode 100644 index 00000000000..412b5ed2208 --- /dev/null +++ b/helpers/setuid/default.nix @@ -0,0 +1,8 @@ +{stdenv, wrapperDir}: + +stdenv.mkDerivation { + name = "setuid-wrapper"; + builder = ./builder.sh; + setuidWrapper = ./setuid-wrapper.c; + inherit wrapperDir; +} \ No newline at end of file diff --git a/helpers/setuid/setuid-wrapper.c b/helpers/setuid/setuid-wrapper.c index 04923896d4e..805ede7e2dd 100644 --- a/helpers/setuid/setuid-wrapper.c +++ b/helpers/setuid/setuid-wrapper.c @@ -9,7 +9,7 @@ extern char **environ; -static char * wrapperDir = "/home/root/nixos/helpers/setuid"; +static char * wrapperDir = WRAPPER_DIR; int main(int argc, char * * argv) { -- GitLab From a66bae7b2f6cbb2a7e1c1c80db5e6d46652d0e68 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 28 Nov 2006 17:40:56 +0000 Subject: [PATCH 0274/5331] * Strip. svn path=/nixos/trunk/; revision=7164 --- helpers/setuid/builder.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helpers/setuid/builder.sh b/helpers/setuid/builder.sh index f9e13b1115c..574a73ac11c 100644 --- a/helpers/setuid/builder.sh +++ b/helpers/setuid/builder.sh @@ -3,3 +3,5 @@ source $stdenv/setup ensureDir $out/bin gcc -Wall -O2 -DWRAPPER_DIR=\"$wrapperDir\" $setuidWrapper -o $out/bin/setuid-wrapper + +strip -s $out/bin/setuid-wrapper -- GitLab From 8532f2be8e7d46485feeef730496a29c1960ae2d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 28 Nov 2006 22:27:56 +0000 Subject: [PATCH 0275/5331] * Add the X server as an Upstart service. The X server is pure, except for the fonts, which are still hardcoded. The current configuration uses the VESA driver, which should work on most machines. Of course, the configuration should now be generated from a higher-level specification. svn path=/nixos/trunk/; revision=7165 --- configuration/boot-environment.nix | 6 +++ configuration/system-configuration.nix | 2 + upstart-jobs/xserver.conf | 68 ++++++++++++++++++++++++++ upstart-jobs/xserver.nix | 49 +++++++++++++++++++ 4 files changed, 125 insertions(+) create mode 100644 upstart-jobs/xserver.conf create mode 100644 upstart-jobs/xserver.nix diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index 34c9a73079f..cc7dd45bc10 100644 --- a/configuration/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -135,6 +135,12 @@ rec { inherit (pkgs) openssh; }) + # X server. + (import ../upstart-jobs/xserver.nix { + inherit (pkgs) genericSubstituter; + inherit (pkgs.xorg) xorgserver xf86inputkeyboard xf86inputmouse xf86videovesa; + }) + # Transparent TTY backgrounds. (import ../upstart-jobs/tty-backgrounds.nix { inherit (pkgs) stdenv splashutils; diff --git a/configuration/system-configuration.nix b/configuration/system-configuration.nix index db4482306e4..f080e61078a 100644 --- a/configuration/system-configuration.nix +++ b/configuration/system-configuration.nix @@ -31,6 +31,8 @@ with bootEnv; rec { + inherit upstartJobs; + systemConfiguration = pkgs.stdenv.mkDerivation { name = "system-configuration"; diff --git a/upstart-jobs/xserver.conf b/upstart-jobs/xserver.conf new file mode 100644 index 00000000000..48a89781ec5 --- /dev/null +++ b/upstart-jobs/xserver.conf @@ -0,0 +1,68 @@ +Section "Files" +EndSection + + +Section "ServerFlags" + Option "AllowMouseOpenFail" "on" + Option "DontVTSwitch" "off" +EndSection + + +Section "Module" +EndSection + + +Section "InputDevice" + Driver "kbd" + Identifier "Keyboard[0]" + Option "Protocol" "Standard" + Option "XkbLayout" "us" + Option "XkbModel" "pc104" + Option "XkbRules" "xfree86" +EndSection + + +Section "InputDevice" + Driver "mouse" + Identifier "Mouse[0]" + Option "Device" "/dev/mice" +EndSection + + +Section "Monitor" + Identifier "Monitor[0]" + Option "DPMS" + UseModes "Modes[0]" +EndSection + + +Section "Modes" + Identifier "Modes[0]" +EndSection + + +Section "Screen" + Identifier "Screen[0]" + Device "Device[0]" + Monitor "Monitor[0]" + DefaultDepth 16 + SubSection "Display" + Depth 16 + Modes "1024x768" + EndSubSection +EndSection + + +Section "Device" + Identifier "Device[0]" + Driver "vesa" +EndSection + + +Section "ServerLayout" + Identifier "Layout[all]" + InputDevice "Keyboard[0]" "CoreKeyboard" + InputDevice "Mouse[0]" "CorePointer" + Screen "Screen[0]" +EndSection + diff --git a/upstart-jobs/xserver.nix b/upstart-jobs/xserver.nix new file mode 100644 index 00000000000..d654dcffa7e --- /dev/null +++ b/upstart-jobs/xserver.nix @@ -0,0 +1,49 @@ +{ genericSubstituter + +, xorgserver + +, xf86inputkeyboard + +, xf86inputmouse + +, xf86videovesa + +, # Virtual console for the X server. + tty ? 7 + +, # X display number. + display ? 0 + +}: + +let + + config = genericSubstituter { + name = "xserver.conf"; + src = ./xserver.conf; + }; + +in + +rec { + name = "xserver"; + + job = " +start on network-interfaces + +start script + +end script + +# !!! -ac is a bad idea. +exec ${xorgserver}/bin/X \\ + -ac -nolisten tcp -terminate \\ + -logfile /var/log/X.${toString display}.log \\ + -fp /var/fonts \\ + -modulepath ${xorgserver}/lib/xorg/modules,${xf86inputkeyboard}/lib/xorg/modules/input,${xf86inputmouse}/lib/xorg/modules/input,${xf86videovesa}/lib/xorg/modules/drivers \\ + -config ${config} \\ + :${toString display} vt${toString tty} + + "; + +} -- GitLab From 79464e0d9c4523a9221b2d9169ad79c9f6b7a508 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 29 Nov 2006 22:34:59 +0000 Subject: [PATCH 0276/5331] * Don't start X by default. svn path=/nixos/trunk/; revision=7170 --- upstart-jobs/xserver.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upstart-jobs/xserver.nix b/upstart-jobs/xserver.nix index d654dcffa7e..4a5fb534819 100644 --- a/upstart-jobs/xserver.nix +++ b/upstart-jobs/xserver.nix @@ -29,7 +29,7 @@ rec { name = "xserver"; job = " -start on network-interfaces +#start on network-interfaces start script -- GitLab From ec764b7c081f419a6c41866ae11730eb27787563 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 29 Nov 2006 23:10:22 +0000 Subject: [PATCH 0277/5331] * Helper script to check for and create accounts. svn path=/nixos/trunk/; revision=7171 --- configuration/system-configuration.sh | 1 + helpers/accounts.sh | 20 ++++++++++++++++++++ upstart-jobs/sshd.nix | 6 ++++-- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 helpers/accounts.sh diff --git a/configuration/system-configuration.sh b/configuration/system-configuration.sh index fa2e7def257..0020053edf7 100644 --- a/configuration/system-configuration.sh +++ b/configuration/system-configuration.sh @@ -26,6 +26,7 @@ if test -n "$grubDevice"; then $grub/sbin/grub-install "$grubDevice" --no-floppy --recheck fi fi +sync EOF chmod +x $out/bin/switch-to-configuration diff --git a/helpers/accounts.sh b/helpers/accounts.sh new file mode 100644 index 00000000000..1e189c56e7f --- /dev/null +++ b/helpers/accounts.sh @@ -0,0 +1,20 @@ +userExists() { + local name="$1" + if id -u "$name" > /dev/null 2>&1; then + return 0 # true + else + return 1 # false + fi +} + + +createUser() { + local name="$1" + local password="$2" + local uid="$3" + local gid="$4" + local gecos="$5" + local homedir="$6" + local shell="$7" + echo "$name:$password:$uid:$gid:$gecos:$homedir:$shell" >> /etc/passwd +} diff --git a/upstart-jobs/sshd.nix b/upstart-jobs/sshd.nix index 466c7616f55..3f210467277 100644 --- a/upstart-jobs/sshd.nix +++ b/upstart-jobs/sshd.nix @@ -10,6 +10,8 @@ start on network-interfaces/started stop on network-interfaces/stop start script + source ${../helpers/accounts.sh} + mkdir -m 0555 -p /var/empty mkdir -m 0755 -p /etc/ssh @@ -20,8 +22,8 @@ start script ${openssh}/bin/ssh-keygen -t dsa -b 1024 -f /etc/ssh/ssh_host_dsa_key -N '' fi - if ! grep -q '^sshd:' /etc/passwd; then - echo 'sshd:x:74:74:SSH privilege separation user:/var/empty:/noshell' >> /etc/passwd + if ! userExists sshd; then + createUser sshd x 74 74 'SSH privilege separation user' /var/empty /noshell fi end script -- GitLab From bc3f4f8352b907bcc0e861451e3e2c8327587015 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 29 Nov 2006 23:41:21 +0000 Subject: [PATCH 0278/5331] * Set up Nix so that builds are never performed as root, but rather under nix-build-N. svn path=/nixos/trunk/; revision=7172 --- boot/boot-stage-2-init.sh | 33 ++++++++++++++++++++++++++++++++- boot/boot-stage-2.nix | 2 ++ installer/nixos-installer.sh | 4 +++- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index 262412c9eb4..e5ab202ea14 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -105,9 +105,18 @@ test -e /etc/login.defs || touch /etc/login.defs # Enable a password-less root login. +source @accounts@ + if ! test -e /etc/passwd; then - echo "root::0:0:root:/:@shell@" > /etc/passwd + if test -n "@readOnlyRoot@"; then + rootHome=/ + else + rootHome=/home/root + mkdir -p $rootHome + fi + createUser root '' 0 0 'System administrator' $rootHome/var/empty @shell@ fi + if ! test -e /etc/group; then echo "root:*:0" > /etc/group fi @@ -118,6 +127,28 @@ echo "127.0.0.1 localhost" > /etc/hosts echo "hosts: files dns" > /etc/nsswitch.conf +# Set up Nix accounts. +if test -z "@readOnlyRoot@"; then + + for i in $(seq 1 10); do + account=nix-build-$i + if ! userExists $account; then + createUser $account x \ + $((i + 30000)) $((i + 30000)) \ + 'Nix build user' /var/empty /noshell + fi + accounts="$accounts $account" + done + + mkdir -p /nix/etc/nix + cat > /nix/etc/nix/nix.conf < Date: Sat, 9 Dec 2006 00:06:18 +0000 Subject: [PATCH 0279/5331] * Multi-user Nix setup has changed. svn path=/nixos/trunk/; revision=7285 --- boot/boot-stage-2-init.sh | 15 ++++++++++----- boot/boot-stage-2.nix | 3 ++- configuration/boot-environment.nix | 5 ++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index e5ab202ea14..df5a399b1aa 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -131,21 +131,26 @@ echo "hosts: files dns" > /etc/nsswitch.conf if test -z "@readOnlyRoot@"; then for i in $(seq 1 10); do - account=nix-build-$i + account=nixbld$i if ! userExists $account; then createUser $account x \ - $((i + 30000)) $((i + 30000)) \ + $((i + 30000)) 30000 \ 'Nix build user' /var/empty /noshell fi - accounts="$accounts $account" + accounts="$accounts${accounts:+,}$account" done + if ! grep -q "^nixbld:" /etc/group; then + echo "nixbld:*:30000:$accounts" >> /etc/group + fi + mkdir -p /nix/etc/nix cat > /nix/etc/nix/nix.conf < Date: Sat, 9 Dec 2006 02:51:42 +0000 Subject: [PATCH 0280/5331] * More semi-purification of /etc. svn path=/nixos/trunk/; revision=7290 --- boot/boot-stage-2-init.sh | 36 ++++++++------------- boot/boot-stage-2.nix | 6 +++- configuration/boot-environment.nix | 51 ++++++++++++++++++++++++++++++ configuration/etc/hosts | 1 + configuration/etc/issue | 4 +++ configuration/etc/login.defs | 11 +++++++ configuration/etc/nsswitch.conf | 8 +++++ configuration/etc/sshd_config | 1 + configuration/etc/syslog.conf | 3 ++ helpers/make-etc.nix | 11 +++++++ helpers/make-etc.sh | 10 ++++++ upstart-jobs/sshd.nix | 2 -- 12 files changed, 118 insertions(+), 26 deletions(-) create mode 100644 configuration/etc/hosts create mode 100644 configuration/etc/issue create mode 100644 configuration/etc/login.defs create mode 100644 configuration/etc/nsswitch.conf create mode 100644 configuration/etc/sshd_config create mode 100644 configuration/etc/syslog.conf create mode 100644 helpers/make-etc.nix create mode 100644 helpers/make-etc.sh diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index df5a399b1aa..9645586b4f5 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -72,6 +72,16 @@ mkdir -m 0755 -p /var/log ln -sf /nix/var/nix/profiles /nix/var/nix/gcroots/ +# Set up the statically computed bits of /etc. +rm -f /etc/static +ln -s @etc@/etc /etc/static +for i in $(cd /etc/static && find * -type l); do + mkdir -p /etc/$(dirname $i) + rm -f /etc/$i + ln -s /etc/static/$i /etc/$i +done + + # Ensure that the module tools can find the kernel modules. export MODULE_DIR=@kernel@/lib/modules/ @@ -95,15 +105,6 @@ udevtrigger udevsettle # wait for udev to finish -# Necessary configuration for syslogd. -echo "*.* /dev/tty10" > /etc/syslog.conf -echo "syslog 514/udp" > /etc/services # required, even if we don't use it - - -# login/su absolutely need this. -test -e /etc/login.defs || touch /etc/login.defs - - # Enable a password-less root login. source @accounts@ @@ -122,11 +123,6 @@ if ! test -e /etc/group; then fi -# We need "localhost" (!!! destructive hack for NIXOS-41). -echo "127.0.0.1 localhost" > /etc/hosts -echo "hosts: files dns" > /etc/nsswitch.conf - - # Set up Nix accounts. if test -z "@readOnlyRoot@"; then @@ -161,15 +157,6 @@ rm -f /etc/event.d ln -sf @upstartJobs@/etc/event.d /etc/event.d -# Show a nice greeting on each terminal. -cat > /etc/issue <>> - - -EOF - - # Additional path for the interactive shell. PATH=@wrapperDir@:@fullPath@/bin:@fullPath@/sbin @@ -177,6 +164,9 @@ cat > /etc/profile <>> + + diff --git a/configuration/etc/login.defs b/configuration/etc/login.defs new file mode 100644 index 00000000000..d146275b9f5 --- /dev/null +++ b/configuration/etc/login.defs @@ -0,0 +1,11 @@ +DEFAULT_HOME yes + +SYSTEM_UID_MIN 100 +SYSTEM_UID_MAX 499 +UID_MIN 1000 +UID_MAX 29999 + +SYSTEM_GID_MIN 100 +SYSTEM_GID_MAX 499 +GID_MIN 1000 +GID_MAX 29999 diff --git a/configuration/etc/nsswitch.conf b/configuration/etc/nsswitch.conf new file mode 100644 index 00000000000..de9c533f07b --- /dev/null +++ b/configuration/etc/nsswitch.conf @@ -0,0 +1,8 @@ +passwd: compat +group: compat + +hosts: files dns +networks: files dns + +services: files +protocols: files diff --git a/configuration/etc/sshd_config b/configuration/etc/sshd_config new file mode 100644 index 00000000000..33619c72028 --- /dev/null +++ b/configuration/etc/sshd_config @@ -0,0 +1 @@ +X11Forwarding yes diff --git a/configuration/etc/syslog.conf b/configuration/etc/syslog.conf new file mode 100644 index 00000000000..f89bcc6b2ad --- /dev/null +++ b/configuration/etc/syslog.conf @@ -0,0 +1,3 @@ +*.* /dev/tty10 + +*.* -/var/log/messages diff --git a/helpers/make-etc.nix b/helpers/make-etc.nix new file mode 100644 index 00000000000..9785823248a --- /dev/null +++ b/helpers/make-etc.nix @@ -0,0 +1,11 @@ +{stdenv, configFiles}: + +stdenv.mkDerivation { + name = "etc"; + + builder = ./make-etc.sh; + + /* !!! Use toXML. */ + sources = map (x: x.source) configFiles; + targets = map (x: x.target) configFiles; +} diff --git a/helpers/make-etc.sh b/helpers/make-etc.sh new file mode 100644 index 00000000000..7834d553fdc --- /dev/null +++ b/helpers/make-etc.sh @@ -0,0 +1,10 @@ +source $stdenv/setup + +ensureDir $out/etc + +sources_=($sources) +targets_=($targets) +for ((i = 0; i < ${#targets_[@]}; i++)); do + ensureDir $out/etc/$(dirname ${targets_[$i]}) + ln -s ${sources_[$i]} $out/etc/${targets_[$i]} +done diff --git a/upstart-jobs/sshd.nix b/upstart-jobs/sshd.nix index 3f210467277..d3002f87e25 100644 --- a/upstart-jobs/sshd.nix +++ b/upstart-jobs/sshd.nix @@ -16,8 +16,6 @@ start script mkdir -m 0755 -p /etc/ssh - echo 'X11Forwarding yes' > /etc/ssh/sshd_config - if ! test -f /etc/ssh/ssh_host_dsa_key; then ${openssh}/bin/ssh-keygen -t dsa -b 1024 -f /etc/ssh/ssh_host_dsa_key -N '' fi -- GitLab From 2fe4badb9a4799b96b2de6d8ebf18c9b5e2c9171 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 9 Dec 2006 03:11:14 +0000 Subject: [PATCH 0281/5331] * Start the Nix daemon to enable multi-user package management in NixOS. svn path=/nixos/trunk/; revision=7291 --- boot/boot-stage-2-init.sh | 6 +++++- configuration/boot-environment.nix | 5 +++++ upgrade.sh | 2 +- upstart-jobs/nix-daemon.nix | 13 +++++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 upstart-jobs/nix-daemon.nix diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index 9645586b4f5..7e0bee2cdc6 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -105,6 +105,10 @@ udevtrigger udevsettle # wait for udev to finish +# !!! Hack - should be done with udev rules. +chmod 666 /dev/null + + # Enable a password-less root login. source @accounts@ @@ -164,7 +168,7 @@ cat > /etc/profile < Date: Sat, 9 Dec 2006 18:18:27 +0000 Subject: [PATCH 0282/5331] * Remove symlinks in /etc that are not in the current configuration. svn path=/nixos/trunk/; revision=7293 --- boot/boot-stage-2-init.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index 7e0bee2cdc6..96d4e086275 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -73,12 +73,24 @@ ln -sf /nix/var/nix/profiles /nix/var/nix/gcroots/ # Set up the statically computed bits of /etc. -rm -f /etc/static -ln -s @etc@/etc /etc/static -for i in $(cd /etc/static && find * -type l); do +staticEtc=/etc/static +rm -f $staticEtc +ln -s @etc@/etc $staticEtc +for i in $(cd $staticEtc && find * -type l); do mkdir -p /etc/$(dirname $i) rm -f /etc/$i - ln -s /etc/static/$i /etc/$i + ln -s $staticEtc/$i /etc/$i +done + + +# Remove dangling symlinks that point to /etc/static. These are +# configuration files that existed in a previous configuration but not +# in the current one. +for i in $(find /etc/ -type l); do + target=$(readlink "$i") + if test "${target:0:${#staticEtc}}" = "$staticEtc" -a ! -e "$i"; then + rm -f "$i" + fi done -- GitLab From 9986bda673cf84775d8cb2584e8573cb82553006 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 9 Dec 2006 19:25:23 +0000 Subject: [PATCH 0283/5331] * Move the stuff in boot-stage-2-init.sh that doesn't have to happen at boot time into a separate script. This will allow us to change the configuration without rebooting (provided that the configuration doesn't have a different kernel, init, etc.). svn path=/nixos/trunk/; revision=7294 --- boot/boot-stage-2-init.sh | 118 +----------------------- boot/boot-stage-2.nix | 33 +------ configuration/activate-configuration.sh | 110 ++++++++++++++++++++++ configuration/boot-environment.nix | 109 ++++++++++++++-------- 4 files changed, 191 insertions(+), 179 deletions(-) create mode 100644 configuration/activate-configuration.sh diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index 96d4e086275..824e89a8a75 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -72,26 +72,9 @@ mkdir -m 0755 -p /var/log ln -sf /nix/var/nix/profiles /nix/var/nix/gcroots/ -# Set up the statically computed bits of /etc. -staticEtc=/etc/static -rm -f $staticEtc -ln -s @etc@/etc $staticEtc -for i in $(cd $staticEtc && find * -type l); do - mkdir -p /etc/$(dirname $i) - rm -f /etc/$i - ln -s $staticEtc/$i /etc/$i -done - - -# Remove dangling symlinks that point to /etc/static. These are -# configuration files that existed in a previous configuration but not -# in the current one. -for i in $(find /etc/ -type l); do - target=$(readlink "$i") - if test "${target:0:${#staticEtc}}" = "$staticEtc" -a ! -e "$i"; then - rm -f "$i" - fi -done +# Run the script that performs all configuration activation that does +# not have to be done at boot time. +source @activateConfiguration@ # Ensure that the module tools can find the kernel modules. @@ -117,103 +100,10 @@ udevtrigger udevsettle # wait for udev to finish -# !!! Hack - should be done with udev rules. -chmod 666 /dev/null - - -# Enable a password-less root login. -source @accounts@ - -if ! test -e /etc/passwd; then - if test -n "@readOnlyRoot@"; then - rootHome=/ - else - rootHome=/home/root - mkdir -p $rootHome - fi - createUser root '' 0 0 'System administrator' $rootHome/var/empty @shell@ -fi - -if ! test -e /etc/group; then - echo "root:*:0" > /etc/group -fi - - -# Set up Nix accounts. -if test -z "@readOnlyRoot@"; then - - for i in $(seq 1 10); do - account=nixbld$i - if ! userExists $account; then - createUser $account x \ - $((i + 30000)) 30000 \ - 'Nix build user' /var/empty /noshell - fi - accounts="$accounts${accounts:+,}$account" - done - - if ! grep -q "^nixbld:" /etc/group; then - echo "nixbld:*:30000:$accounts" >> /etc/group - fi - - mkdir -p /nix/etc/nix - cat > /nix/etc/nix/nix.conf < /etc/profile < $wrapperDir/$i.real - chown root.root $wrapperDir/$i - chmod 4755 $wrapperDir/$i -done - - -# Set the host name. -hostname @hostName@ - - # Start an interactive shell. #exec @shell@ # Start Upstart's init. +export UPSTART_CFG_DIR=/etc/event.d exec @upstart@/sbin/init -v diff --git a/boot/boot-stage-2.nix b/boot/boot-stage-2.nix index ed157930b5f..051a7105642 100644 --- a/boot/boot-stage-2.nix +++ b/boot/boot-stage-2.nix @@ -1,19 +1,10 @@ -{ genericSubstituter, buildEnv, shell, coreutils, findutils -, gnugrep, utillinux, kernel, udev, upstart, setuidWrapper -, path ? [] +{ genericSubstituter, shell, coreutils, findutils +, gnugrep, utillinux, kernel, udev, upstart +, activateConfiguration , # Whether the root device is root only. If so, we'll mount a # ramdisk on /etc, /var and so on. readOnlyRoot - -, # The Upstart job configuration. - upstartJobs - -, # Static configuration files to be placed (through symlinks) in - # /etc. - etc - -, hostName }: let @@ -25,7 +16,6 @@ let utillinux udev upstart - setuidWrapper ]; in @@ -33,21 +23,6 @@ in genericSubstituter { src = ./boot-stage-2-init.sh; isExecutable = true; - inherit shell kernel upstart readOnlyRoot upstartJobs etc hostName; + inherit shell kernel upstart readOnlyRoot activateConfiguration; inherit startPath; - - # We don't want to put all of `startPath' and `path' in $PATH, since - # then we get an embarrassingly long $PATH. So use the user - # environment builder to make a directory with symlinks to those - # packages. - fullPath = buildEnv { - name = "boot-stage-2-path"; - paths = startPath ++ path; - pathsToLink = ["/bin" "/sbin" "/man/man1" "/share/man/man1"]; - ignoreCollisions = true; - }; - - wrapperDir = setuidWrapper.wrapperDir; - - accounts = ../helpers/accounts.sh; } diff --git a/configuration/activate-configuration.sh b/configuration/activate-configuration.sh new file mode 100644 index 00000000000..0aee051503a --- /dev/null +++ b/configuration/activate-configuration.sh @@ -0,0 +1,110 @@ +#! @shell@ + + +# !!! Hack - should be done with udev rules. +chmod 666 /dev/null + + +# Set up the statically computed bits of /etc. +staticEtc=/etc/static +rm -f $staticEtc +ln -s @etc@/etc $staticEtc +for i in $(cd $staticEtc && find * -type l); do + mkdir -p /etc/$(dirname $i) + rm -f /etc/$i + ln -s $staticEtc/$i /etc/$i +done + + +# Remove dangling symlinks that point to /etc/static. These are +# configuration files that existed in a previous configuration but not +# in the current one. +for i in $(find /etc/ -type l); do + target=$(readlink "$i") + if test "${target:0:${#staticEtc}}" = "$staticEtc" -a ! -e "$i"; then + rm -f "$i" + fi +done + + +# Enable a password-less root login. +source @accounts@ + +if ! test -e /etc/passwd; then + if test -n "@readOnlyRoot@"; then + rootHome=/ + else + rootHome=/home/root + mkdir -p $rootHome + fi + createUser root '' 0 0 'System administrator' $rootHome/var/empty @shell@ +fi + +if ! test -e /etc/group; then + echo "root:*:0" > /etc/group +fi + + +# Set up Nix accounts. +if test -z "@readOnlyRoot@"; then + + for i in $(seq 1 10); do + account=nixbld$i + if ! userExists $account; then + createUser $account x \ + $((i + 30000)) 30000 \ + 'Nix build user' /var/empty /noshell + fi + accounts="$accounts${accounts:+,}$account" + done + + if ! grep -q "^nixbld:" /etc/group; then + echo "nixbld:*:30000:$accounts" >> /etc/group + fi + + mkdir -p /nix/etc/nix + cat > /nix/etc/nix/nix.conf < /etc/profile < $wrapperDir/$i.real + chown root.root $wrapperDir/$i + chmod 4755 $wrapperDir/$i +done + + +# Set the host name. +hostname @hostName@ diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index df445fb12db..721d21cb668 100644 --- a/configuration/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -230,7 +230,12 @@ rec { source = ./etc/sshd_config; target = "ssh/sshd_config"; } - + + { # The Upstart events defined above. + source = upstartJobs + "/etc/event.d"; + target = "event.d"; + } + ]; }; @@ -246,47 +251,79 @@ rec { }; + # The packages you want in the boot environment. + fullPath = [ + pkgs.bash + pkgs.bzip2 + pkgs.coreutils + pkgs.cpio + pkgs.curl + pkgs.e2fsprogs + pkgs.findutils + pkgs.gnugrep + pkgs.gnused + pkgs.gnutar + pkgs.grub + pkgs.gzip + pkgs.iputils + pkgs.less + pkgs.module_init_tools + pkgs.nano + pkgs.netcat + pkgs.nettools + pkgs.perl + pkgs.procps + pkgs.rsync + pkgs.shadowutils + pkgs.strace + pkgs.sysklogd + pkgs.udev + pkgs.upstart + pkgs.utillinux +# pkgs.vim + nix + nixosInstaller + setuidWrapper + ]; + + + # The script that activates the configuration, i.e., it sets up + # /etc, accounts, etc. It doesn't do anything that can only be done + # at boot time (such as start `init'). + activateConfiguration = pkgs.genericSubstituter { + src = ./activate-configuration.sh; + isExecutable = true; + + shell = pkgs.bash + "/bin/sh"; + + inherit etc; + inherit readOnlyRoot; + inherit (pkgs) kernel; + hostName = config.get ["networking" "hostname"]; + wrapperDir = setuidWrapper.wrapperDir; + accounts = ../helpers/accounts.sh; + + # We don't want to put all of `startPath' and `path' in $PATH, since + # then we get an embarrassingly long $PATH. So use the user + # environment builder to make a directory with symlinks to those + # packages. + fullPath = pkgs.buildEnv { + name = "boot-stage-2-path"; + paths = fullPath; + pathsToLink = ["/bin" "/sbin" "/man/man1" "/share/man/man1"]; + ignoreCollisions = true; + }; + }; + + # The init script of boot stage 2, which is supposed to do # everything else to bring up the system. bootStage2 = import ../boot/boot-stage-2.nix { - inherit (pkgs) genericSubstituter buildEnv coreutils findutils + inherit (pkgs) genericSubstituter coreutils findutils gnugrep utillinux kernel udev upstart; - inherit setuidWrapper; - inherit upstartJobs; - inherit etc; shell = pkgs.bash + "/bin/sh"; - - # Additional stuff; add whatever you want here. - path = [ - pkgs.bash - pkgs.bzip2 - pkgs.cpio - pkgs.curl - pkgs.e2fsprogs - pkgs.gnused - pkgs.gnutar - pkgs.grub - pkgs.gzip - pkgs.iputils - pkgs.less - pkgs.module_init_tools - pkgs.nano - pkgs.netcat - pkgs.nettools - pkgs.perl - pkgs.procps - pkgs.rsync - pkgs.shadowutils - pkgs.strace - pkgs.sysklogd -# pkgs.vim - nix - nixosInstaller - ]; - inherit readOnlyRoot; - - hostName = config.get ["networking" "hostname"]; + inherit activateConfiguration; }; -- GitLab From 4ac288e7245f9c155aa284f7dc6590859d6c2d10 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 10 Dec 2006 00:04:58 +0000 Subject: [PATCH 0284/5331] * Allow switching to a new configuration without rebooting. However, we don't stop/start/restart Upstart jobs yet. svn path=/nixos/trunk/; revision=7297 --- configuration/system-configuration.nix | 3 ++- configuration/system-configuration.sh | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/configuration/system-configuration.nix b/configuration/system-configuration.nix index f080e61078a..c470dbf1cff 100644 --- a/configuration/system-configuration.nix +++ b/configuration/system-configuration.nix @@ -37,9 +37,10 @@ rec { systemConfiguration = pkgs.stdenv.mkDerivation { name = "system-configuration"; builder = ./system-configuration.sh; - inherit (pkgs) grub coreutils gnused gnugrep diffutils; + inherit (pkgs) grub coreutils gnused gnugrep diffutils findutils; inherit grubDevice; inherit bootStage2; + inherit activateConfiguration; inherit grubMenuBuilder; kernel = pkgs.kernel + "/vmlinuz"; initrd = initialRamdisk + "/initrd"; diff --git a/configuration/system-configuration.sh b/configuration/system-configuration.sh index 0020053edf7..72cbe430e5d 100644 --- a/configuration/system-configuration.sh +++ b/configuration/system-configuration.sh @@ -6,6 +6,7 @@ ln -s $kernel $out/kernel ln -s $grub $out/grub ln -s $bootStage2 $out/init ln -s $initrd $out/initrd +ln -s $activateConfiguration $out/activate echo "$extraKernelParams" > $out/kernel-params cat > $out/menu.lst << GRUBEND @@ -18,7 +19,8 @@ ensureDir $out/bin cat > $out/bin/switch-to-configuration < Date: Sun, 10 Dec 2006 22:29:44 +0000 Subject: [PATCH 0285/5331] * Lots of refactoring. * Clear the PATH in most scripts. This helps to ensure purity. svn path=/nixos/trunk/; revision=7299 --- boot/boot-stage-1-init.sh | 4 +-- boot/boot-stage-1.nix | 6 ++-- boot/boot-stage-2-init.sh | 22 +++++--------- boot/boot-stage-2.nix | 13 +++++---- boot/make-initrd.sh | 2 +- configuration/activate-configuration.sh | 25 ++++++++++++++-- configuration/boot-environment.nix | 27 ++++++++++------- configuration/switch-to-configuration.sh | 37 ++++++++++++++++++++++++ configuration/system-configuration.nix | 9 ++++-- configuration/system-configuration.sh | 26 ++--------------- installer/grub-menu-builder.sh | 3 ++ installer/nixos-installer.nix | 7 ++--- upgrade.sh | 2 +- upstart-jobs/dhclient.nix | 4 +-- upstart-jobs/xserver.nix | 4 +-- 15 files changed, 117 insertions(+), 74 deletions(-) create mode 100644 configuration/switch-to-configuration.sh diff --git a/boot/boot-stage-1-init.sh b/boot/boot-stage-1-init.sh index d62bd157975..e3b26127d46 100644 --- a/boot/boot-stage-1-init.sh +++ b/boot/boot-stage-1-init.sh @@ -1,9 +1,9 @@ -#! @shell@ +#! @staticShell@ fail() { # If starting stage 2 failed, start an interactive shell. echo "Stage 2 failed, starting emergency shell..." - exec @shell@ + exec @staticShell@ } diff --git a/boot/boot-stage-1.nix b/boot/boot-stage-1.nix index ef1ebfc7225..f8b84eb6fdb 100644 --- a/boot/boot-stage-1.nix +++ b/boot/boot-stage-1.nix @@ -4,7 +4,7 @@ # the second boot stage. The closure of the result of this expression # is supposed to be put into an initial RAM disk (initrd). -{ genericSubstituter, shell, staticTools +{ substituteAll, staticShell, staticTools , module_init_tools, extraUtils, modules , # Whether to find root device automatically using its label. @@ -24,10 +24,10 @@ assert !autoDetectRootDevice -> rootDevice != ""; assert autoDetectRootDevice -> rootLabel != ""; -genericSubstituter { +substituteAll { src = ./boot-stage-1-init.sh; isExecutable = true; - inherit shell modules; + inherit staticShell modules; inherit autoDetectRootDevice rootDevice rootLabel; path = [ staticTools diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index 824e89a8a75..4a4a5f6f7e2 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -63,32 +63,24 @@ needWritableDir /tmp 01777 needWritableDir /var 0755 needWritableDir /nix/var 0755 -mkdir -m 0755 -p /nix/var/nix/db -mkdir -m 0755 -p /nix/var/nix/gcroots -mkdir -m 0755 -p /nix/var/nix/temproots -mkdir -m 0755 -p /var/log +# Miscellaneous boot time cleanup. +rm -rf /var/run + -ln -sf /nix/var/nix/profiles /nix/var/nix/gcroots/ +# Create the minimal device nodes needed before we run udev. +mknod -m 0666 /dev/null c 1 3 # Run the script that performs all configuration activation that does # not have to be done at boot time. -source @activateConfiguration@ +@activateConfiguration@ # Ensure that the module tools can find the kernel modules. export MODULE_DIR=@kernel@/lib/modules/ -# Miscellaneous cleanup. -rm -rf /var/run -mkdir -m 0755 -p /var/run - -echo -n > /var/run/utmp # must exist -chmod 664 /var/run/utmp - - # Start udev. udevd --daemon @@ -106,4 +98,6 @@ udevsettle # wait for udev to finish # Start Upstart's init. export UPSTART_CFG_DIR=/etc/event.d +export PATH=/empty +for i in @upstartPath@; do PATH=$PATH:$i/bin; done exec @upstart@/sbin/init -v diff --git a/boot/boot-stage-2.nix b/boot/boot-stage-2.nix index 051a7105642..f501c12017f 100644 --- a/boot/boot-stage-2.nix +++ b/boot/boot-stage-2.nix @@ -1,18 +1,19 @@ -{ genericSubstituter, shell, coreutils, findutils -, gnugrep, utillinux, kernel, udev, upstart +{ substituteAll, coreutils +, utillinux, kernel, udev, upstart , activateConfiguration , # Whether the root device is root only. If so, we'll mount a # ramdisk on /etc, /var and so on. readOnlyRoot + +, # Path for Upstart jobs. Should be quite minimal. + upstartPath }: let startPath = [ coreutils - findutils - gnugrep utillinux udev upstart @@ -20,9 +21,9 @@ let in -genericSubstituter { +substituteAll { src = ./boot-stage-2-init.sh; isExecutable = true; - inherit shell kernel upstart readOnlyRoot activateConfiguration; + inherit kernel upstart readOnlyRoot activateConfiguration upstartPath; inherit startPath; } diff --git a/boot/make-initrd.sh b/boot/make-initrd.sh index 8d07300466b..45ee036e4e8 100644 --- a/boot/make-initrd.sh +++ b/boot/make-initrd.sh @@ -35,7 +35,7 @@ for ((n = 0; n < ${#objects[*]}; n++)); do mkdir -p $(dirname root/$symlink) ln -s $object$suffix root/$symlink done - + # Put the closure in a gzipped cpio archive. ensureDir $out diff --git a/configuration/activate-configuration.sh b/configuration/activate-configuration.sh index 0aee051503a..a6971c9f7fc 100644 --- a/configuration/activate-configuration.sh +++ b/configuration/activate-configuration.sh @@ -1,8 +1,7 @@ #! @shell@ - -# !!! Hack - should be done with udev rules. -chmod 666 /dev/null +export PATH=/empty +for i in @path@; do PATH=$PATH:$i/bin; done # Set up the statically computed bits of /etc. @@ -27,6 +26,15 @@ for i in $(find /etc/ -type l); do done +# Various log directories. +mkdir -m 0755 -p /var/run + +echo -n > /var/run/utmp # must exist +chmod 664 /var/run/utmp + +mkdir -m 0755 -p /var/log + + # Enable a password-less root login. source @accounts@ @@ -93,6 +101,17 @@ fi EOF +# Nix initialisation. +mkdir -m 0755 -p /nix/var/nix/db +mkdir -m 0755 -p /nix/var/nix/gcroots +mkdir -m 0755 -p /nix/var/nix/temproots + +ln -sf /nix/var/nix/profiles /nix/var/nix/gcroots/ + +chown root.nixbld /nix/store +chmod 1775 /nix/store + + # Make a few setuid programs work. wrapperDir=@wrapperDir@ if test -d $wrapperDir; then rm -f $wrapperDir/*; fi diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index 721d21cb668..f6890108774 100644 --- a/configuration/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -64,13 +64,13 @@ rec { # The init script of boot stage 1 (loading kernel modules for # mounting the root FS). bootStage1 = import ../boot/boot-stage-1.nix { - inherit (pkgs) genericSubstituter; + inherit (pkgs) substituteAll; inherit (pkgsDiet) module_init_tools; inherit extraUtils; inherit autoDetectRootDevice rootDevice rootLabel; inherit stage2Init; modules = modulesClosure; - shell = stdenvLinuxStuff.bootstrapTools.bash; + staticShell = stdenvLinuxStuff.bootstrapTools.bash; staticTools = stdenvLinuxStuff.staticTools; }; @@ -99,9 +99,8 @@ rec { # The installer. nixosInstaller = import ../installer/nixos-installer.nix { - inherit (pkgs) stdenv genericSubstituter; + inherit (pkgs) stdenv substituteAll; inherit nix; - shell = pkgs.bash + "/bin/sh"; }; @@ -127,6 +126,7 @@ rec { # DHCP client. (import ../upstart-jobs/dhclient.nix { + inherit (pkgs) nettools; dhcp = pkgs.dhcpWrapper; }) @@ -142,7 +142,7 @@ rec { # X server. (import ../upstart-jobs/xserver.nix { - inherit (pkgs) genericSubstituter; + inherit (pkgs) substituteAll; inherit (pkgs.xorg) xorgserver xf86inputkeyboard xf86inputmouse xf86videovesa; }) @@ -290,12 +290,10 @@ rec { # The script that activates the configuration, i.e., it sets up # /etc, accounts, etc. It doesn't do anything that can only be done # at boot time (such as start `init'). - activateConfiguration = pkgs.genericSubstituter { + activateConfiguration = pkgs.substituteAll { src = ./activate-configuration.sh; isExecutable = true; - shell = pkgs.bash + "/bin/sh"; - inherit etc; inherit readOnlyRoot; inherit (pkgs) kernel; @@ -303,6 +301,8 @@ rec { wrapperDir = setuidWrapper.wrapperDir; accounts = ../helpers/accounts.sh; + path = [pkgs.coreutils pkgs.gnugrep pkgs.findutils]; + # We don't want to put all of `startPath' and `path' in $PATH, since # then we get an embarrassingly long $PATH. So use the user # environment builder to make a directory with symlinks to those @@ -319,11 +319,16 @@ rec { # The init script of boot stage 2, which is supposed to do # everything else to bring up the system. bootStage2 = import ../boot/boot-stage-2.nix { - inherit (pkgs) genericSubstituter coreutils findutils - gnugrep utillinux kernel udev upstart; - shell = pkgs.bash + "/bin/sh"; + inherit (pkgs) substituteAll coreutils + utillinux kernel udev upstart; inherit readOnlyRoot; inherit activateConfiguration; + upstartPath = [ + pkgs.coreutils + pkgs.findutils + pkgs.gnugrep + pkgs.gnused + ]; }; diff --git a/configuration/switch-to-configuration.sh b/configuration/switch-to-configuration.sh new file mode 100644 index 00000000000..8c03311a7c5 --- /dev/null +++ b/configuration/switch-to-configuration.sh @@ -0,0 +1,37 @@ +#! @shell@ + +set -e +export PATH=/empty +for i in @path@; do PATH=$PATH:$i/bin; done +action="$1" + +if test -z "$action"; then + cat <&2 + fi +fi + +if test "$action" = "switch" -o "$action" = "test"; then + echo "Activating the configuration..." + @out@/activate + kill -TERM 1 # make Upstart reload its events +fi + +sync diff --git a/configuration/system-configuration.nix b/configuration/system-configuration.nix index c470dbf1cff..39b4f961f16 100644 --- a/configuration/system-configuration.nix +++ b/configuration/system-configuration.nix @@ -34,24 +34,29 @@ rec { inherit upstartJobs; - systemConfiguration = pkgs.stdenv.mkDerivation { + systemConfiguration = pkgs.stdenvNew.mkDerivation { name = "system-configuration"; builder = ./system-configuration.sh; + switchToConfiguration = ./switch-to-configuration.sh; inherit (pkgs) grub coreutils gnused gnugrep diffutils findutils; inherit grubDevice; inherit bootStage2; inherit activateConfiguration; inherit grubMenuBuilder; + inherit etc; kernel = pkgs.kernel + "/vmlinuz"; initrd = initialRamdisk + "/initrd"; inherit extraKernelParams; + # Most of these are needed by grub-install. + path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils]; }; - grubMenuBuilder = pkgs.genericSubstituter { + grubMenuBuilder = pkgs.substituteAll { src = ../installer/grub-menu-builder.sh; isExecutable = true; inherit (pkgs) bash; + path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep]; }; diff --git a/configuration/system-configuration.sh b/configuration/system-configuration.sh index 72cbe430e5d..e1f240e218f 100644 --- a/configuration/system-configuration.sh +++ b/configuration/system-configuration.sh @@ -7,6 +7,8 @@ ln -s $grub $out/grub ln -s $bootStage2 $out/init ln -s $initrd $out/initrd ln -s $activateConfiguration $out/activate +ln -s $etc/etc $out/etc + echo "$extraKernelParams" > $out/kernel-params cat > $out/menu.lst << GRUBEND @@ -15,27 +17,5 @@ initrd $initrd GRUBEND ensureDir $out/bin - -cat > $out/bin/switch-to-configuration <" diff --git a/installer/nixos-installer.nix b/installer/nixos-installer.nix index 818b3e19887..783a48f40a9 100644 --- a/installer/nixos-installer.nix +++ b/installer/nixos-installer.nix @@ -1,11 +1,10 @@ -{ stdenv, genericSubstituter, shell, nix -}: +{stdenv, substituteAll, nix}: -genericSubstituter { +substituteAll { src = ./nixos-installer.sh; dir = "bin"; isExecutable = true; - inherit shell nix; + inherit nix; pathsFromGraph = ../helpers/paths-from-graph.sh; diff --git a/upgrade.sh b/upgrade.sh index 857b5dc0155..961bc1959ef 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -1,4 +1,4 @@ #! /bin/sh set -e nix-env -p /nix/var/nix/profiles/system -f configuration/system-configuration.nix -i -A systemConfiguration -/nix/var/nix/profiles/system/bin/switch-to-configuration +/nix/var/nix/profiles/system/bin/switch-to-configuration switch diff --git a/upstart-jobs/dhclient.nix b/upstart-jobs/dhclient.nix index 7ccc87615ad..3b8161820d8 100644 --- a/upstart-jobs/dhclient.nix +++ b/upstart-jobs/dhclient.nix @@ -1,4 +1,4 @@ -{dhcp}: +{dhcp, nettools}: { name = "dhclient"; @@ -23,7 +23,7 @@ script # fi #done - for i in $(ifconfig | grep '^[^ ]' | sed 's/ .*//'); do + for i in $(${nettools}/sbin/ifconfig | grep '^[^ ]' | sed 's/ .*//'); do if test \"$i\" != \"lo\"; then interfaces=\"$interfaces $i\" fi diff --git a/upstart-jobs/xserver.nix b/upstart-jobs/xserver.nix index 4a5fb534819..8979092cbc2 100644 --- a/upstart-jobs/xserver.nix +++ b/upstart-jobs/xserver.nix @@ -1,4 +1,4 @@ -{ genericSubstituter +{ substituteAll , xorgserver @@ -18,7 +18,7 @@ let - config = genericSubstituter { + config = substituteAll { name = "xserver.conf"; src = ./xserver.conf; }; -- GitLab From c063ea2bfa56245100b3971376c0f9231b9d2722 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 10 Dec 2006 22:43:04 +0000 Subject: [PATCH 0286/5331] * Use runCommand. svn path=/nixos/trunk/; revision=7300 --- configuration/boot-environment.nix | 22 +++++++++----------- installer/nixos-installer.nix | 10 ++++----- instances/rescue-cd.nix | 33 +++++++++++------------------- upstart-jobs/gather.nix | 14 ++++--------- upstart-jobs/make-job.nix | 9 +++----- 5 files changed, 33 insertions(+), 55 deletions(-) diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index f6890108774..c9e01d1773f 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 783a48f40a9..651efeabeb5 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 a8a88836911..bfe4dca3fd1 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 914c78e7a89..47193167360 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 3995a8f21aa..630ae1d83e1 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" -- GitLab From 578b56d3c6fa4c47e5b2a98b840c2f0ec3c20204 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 Dec 2006 00:52:36 +0000 Subject: [PATCH 0287/5331] * Make halt/reboot work again (umount and reboot were no longer in $PATH). * Use the login from pam_login instead of shadowutils. svn path=/nixos/trunk/; revision=7302 --- boot/boot-stage-2-init.sh | 22 +++++++++++++--------- boot/boot-stage-2.nix | 16 +++++----------- configuration/boot-environment.nix | 5 +++-- upstart-jobs/halt.nix | 4 +++- upstart-jobs/mingetty.nix | 4 ++-- 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index 4a4a5f6f7e2..a3387fbac57 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -10,13 +10,18 @@ echo # Set the PATH. -export PATH=/empty -for i in @startPath@; do - PATH=$PATH:$i/bin - if test -e $i/sbin; then - PATH=$PATH:$i/sbin - fi -done +setPath() { + local dirs="$1" + export PATH=/empty + for i in $dirs; do + PATH=$PATH:$i/bin + if test -e $i/sbin; then + PATH=$PATH:$i/sbin + fi + done +} + +setPath "@path@" # Mount special file systems. @@ -98,6 +103,5 @@ udevsettle # wait for udev to finish # Start Upstart's init. export UPSTART_CFG_DIR=/etc/event.d -export PATH=/empty -for i in @upstartPath@; do PATH=$PATH:$i/bin; done +setPath "@upstartPath@" exec @upstart@/sbin/init -v diff --git a/boot/boot-stage-2.nix b/boot/boot-stage-2.nix index f501c12017f..8772759aaf4 100644 --- a/boot/boot-stage-2.nix +++ b/boot/boot-stage-2.nix @@ -10,20 +10,14 @@ upstartPath }: -let - - startPath = [ +substituteAll { + src = ./boot-stage-2-init.sh; + isExecutable = true; + inherit kernel upstart readOnlyRoot activateConfiguration upstartPath; + path = [ coreutils utillinux udev upstart ]; - -in - -substituteAll { - src = ./boot-stage-2-init.sh; - isExecutable = true; - inherit kernel upstart readOnlyRoot activateConfiguration upstartPath; - inherit startPath; } diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index c9e01d1773f..5ffe9576026 100644 --- a/configuration/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -163,7 +163,7 @@ rec { # Handles the reboot/halt events. ++ (map (event: makeJob (import ../upstart-jobs/halt.nix { - inherit (pkgs) bash; + inherit (pkgs) bash utillinux; inherit event; })) ["reboot" "halt" "system-halt" "power-off"] @@ -172,7 +172,7 @@ rec { # The terminals on ttyX. ++ (map (ttyNumber: makeJob (import ../upstart-jobs/mingetty.nix { - mingetty = pkgs.mingettyWrapper; + inherit (pkgs) mingetty pam_login; inherit ttyNumber; })) [1 2 3 4 5 6] @@ -326,6 +326,7 @@ rec { pkgs.findutils pkgs.gnugrep pkgs.gnused + pkgs.upstart ]; }; diff --git a/upstart-jobs/halt.nix b/upstart-jobs/halt.nix index 58be12db69c..6e4e833f643 100644 --- a/upstart-jobs/halt.nix +++ b/upstart-jobs/halt.nix @@ -1,4 +1,4 @@ -{bash, event}: +{bash, event, utillinux}: assert event == "reboot" || event == "halt" @@ -17,6 +17,8 @@ script echo \"<<< SYSTEM SHUTDOWN >>>\" echo \"\" + export PATH=${utillinux}/bin:$PATH + # Do an initial sync just in case. sync || true diff --git a/upstart-jobs/mingetty.nix b/upstart-jobs/mingetty.nix index cdce937535c..f67a8ced92c 100644 --- a/upstart-jobs/mingetty.nix +++ b/upstart-jobs/mingetty.nix @@ -1,10 +1,10 @@ -{mingetty, ttyNumber}: +{mingetty, pam_login, ttyNumber}: { name = "tty" + toString ttyNumber; job = " start on startup stop on shutdown - respawn ${mingetty}/sbin/mingetty --noclear tty${toString ttyNumber} + respawn ${mingetty}/sbin/mingetty --loginprog=${pam_login}/bin/login --noclear tty${toString ttyNumber} "; } -- GitLab From 06256e22d80978882939471383e7108488198fde Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 Dec 2006 01:03:26 +0000 Subject: [PATCH 0288/5331] * A script to test configurations, i.e., make them current without making them the boot default. So if we screw up, we can just reset to get back to normal. svn path=/nixos/trunk/; revision=7303 --- configuration/boot-environment.nix | 2 +- test.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100755 test.sh diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index 5ffe9576026..4c4092bf3c9 100644 --- a/configuration/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -271,8 +271,8 @@ rec { pkgs.nettools pkgs.perl pkgs.procps + pkgs.pwdutils pkgs.rsync - pkgs.shadowutils pkgs.strace pkgs.sysklogd pkgs.udev diff --git a/test.sh b/test.sh new file mode 100755 index 00000000000..6bb66bf742e --- /dev/null +++ b/test.sh @@ -0,0 +1,4 @@ +#! /bin/sh +set -e +nix-build configuration/system-configuration.nix -A systemConfiguration -K -k +./result/bin/switch-to-configuration test -- GitLab From f327b072cb8446a44b0b7de7076f79247a29868e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 Dec 2006 02:44:26 +0000 Subject: [PATCH 0289/5331] * Very basic PAM configuration. We now use Blowfish hashing for /etc/shadow. svn path=/nixos/trunk/; revision=7306 --- configuration/boot-environment.nix | 26 +++++++++++++++++++++++++- configuration/etc/default/passwd | 15 +++++++++++++++ configuration/etc/pam.d/login | 4 ++++ configuration/etc/pam.d/other | 8 ++++++++ configuration/etc/pam.d/passwd | 4 ++++ configuration/etc/pam.d/useradd | 5 +++++ 6 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 configuration/etc/default/passwd create mode 100644 configuration/etc/pam.d/login create mode 100644 configuration/etc/pam.d/other create mode 100644 configuration/etc/pam.d/passwd create mode 100644 configuration/etc/pam.d/useradd diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index 4c4092bf3c9..6e14ef2e193 100644 --- a/configuration/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -234,7 +234,31 @@ rec { target = "event.d"; } - ]; + { # Configuration for passwd and friends (e.g., hash algorithm + # for /etc/passwd). + source = ./etc/default/passwd; + target = "default/passwd"; + } + + ] + + # A bunch of PAM configuration files for various programs. + ++ (map + (program: + { source = pkgs.substituteAll { + src = ./etc/pam.d + ("/" + program); + inherit (pkgs) pam_unix2; + }; + target = "pam.d/" + program; + } + ) + [ + "login" + "passwd" + "useradd" + "other" + ] + ); }; diff --git a/configuration/etc/default/passwd b/configuration/etc/default/passwd new file mode 100644 index 00000000000..5804e28c38b --- /dev/null +++ b/configuration/etc/default/passwd @@ -0,0 +1,15 @@ +# Define default crypt hash +# CRYPT={des,md5,blowfish} +CRYPT=des + +# for local files, use a more secure hash. We +# don't need to be portable here: +CRYPT_FILES=blowfish + +# sometimes we need to specify special options for +# a hash (variable is prepended by the name of the +# crypt hash). +BLOWFISH_CRYPT_FILES=10 + +# For NIS, we should always use DES: +CRYPT_YP=des diff --git a/configuration/etc/pam.d/login b/configuration/etc/pam.d/login new file mode 100644 index 00000000000..29ec6d7b11a --- /dev/null +++ b/configuration/etc/pam.d/login @@ -0,0 +1,4 @@ +auth required @pam_unix2@/lib/security/pam_unix2.so +account required @pam_unix2@/lib/security/pam_unix2.so +password required @pam_unix2@/lib/security/pam_unix2.so nullok use_first_pass use_authtok +session required @pam_unix2@/lib/security/pam_unix2.so diff --git a/configuration/etc/pam.d/other b/configuration/etc/pam.d/other new file mode 100644 index 00000000000..b1ed9205b72 --- /dev/null +++ b/configuration/etc/pam.d/other @@ -0,0 +1,8 @@ +auth required pam_warn.so +auth required pam_deny.so +account required pam_warn.so +account required pam_deny.so +password required pam_warn.so +password required pam_deny.so +session required pam_warn.so +session required pam_deny.so diff --git a/configuration/etc/pam.d/passwd b/configuration/etc/pam.d/passwd new file mode 100644 index 00000000000..423e0efb496 --- /dev/null +++ b/configuration/etc/pam.d/passwd @@ -0,0 +1,4 @@ +auth required @pam_unix2@/lib/security/pam_unix2.so +account required @pam_unix2@/lib/security/pam_unix2.so +password required @pam_unix2@/lib/security/pam_unix2.so nullok debug +session required @pam_unix2@/lib/security/pam_unix2.so diff --git a/configuration/etc/pam.d/useradd b/configuration/etc/pam.d/useradd new file mode 100644 index 00000000000..b4aac2aba95 --- /dev/null +++ b/configuration/etc/pam.d/useradd @@ -0,0 +1,5 @@ +auth sufficient pam_rootok.so +auth required pam_permit.so +account required pam_permit.so +password required pam_permit.so +session required pam_permit.so -- GitLab From 85fc6aedf2f57811adf601057a26e29136c23fa0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 Dec 2006 02:52:23 +0000 Subject: [PATCH 0290/5331] * Cleanup. svn path=/nixos/trunk/; revision=7307 --- configuration/etc/pam.d/login | 2 +- configuration/etc/pam.d/passwd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/etc/pam.d/login b/configuration/etc/pam.d/login index 29ec6d7b11a..d3463aab5ae 100644 --- a/configuration/etc/pam.d/login +++ b/configuration/etc/pam.d/login @@ -1,4 +1,4 @@ auth required @pam_unix2@/lib/security/pam_unix2.so account required @pam_unix2@/lib/security/pam_unix2.so -password required @pam_unix2@/lib/security/pam_unix2.so nullok use_first_pass use_authtok +password required @pam_unix2@/lib/security/pam_unix2.so nullok session required @pam_unix2@/lib/security/pam_unix2.so diff --git a/configuration/etc/pam.d/passwd b/configuration/etc/pam.d/passwd index 423e0efb496..d3463aab5ae 100644 --- a/configuration/etc/pam.d/passwd +++ b/configuration/etc/pam.d/passwd @@ -1,4 +1,4 @@ auth required @pam_unix2@/lib/security/pam_unix2.so account required @pam_unix2@/lib/security/pam_unix2.so -password required @pam_unix2@/lib/security/pam_unix2.so nullok debug +password required @pam_unix2@/lib/security/pam_unix2.so nullok session required @pam_unix2@/lib/security/pam_unix2.so -- GitLab From b80769d5aed53e747d8d5ec169fbc4df37e86882 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 Dec 2006 02:55:28 +0000 Subject: [PATCH 0291/5331] * Hm, "set" doesn't seem to do the right thing. svn path=/nixos/trunk/; revision=7308 --- upstart-jobs/nix-daemon.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/upstart-jobs/nix-daemon.nix b/upstart-jobs/nix-daemon.nix index a730c9e4d84..84bbdea4f11 100644 --- a/upstart-jobs/nix-daemon.nix +++ b/upstart-jobs/nix-daemon.nix @@ -6,8 +6,10 @@ job = " start on startup stop on shutdown - set NIX_CONF_DIR=/nix/etc/nix - respawn ${nix}/bin/nix-worker --daemon > /dev/null 2>&1 + script + export NIX_CONF_DIR=/nix/etc/nix + exec ${nix}/bin/nix-worker --daemon > /dev/null 2>&1 + end script "; } -- GitLab From efa9b1ba88163d4dfeb87547a423d5d1abdc4695 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 Dec 2006 03:03:42 +0000 Subject: [PATCH 0292/5331] * Grmbl. svn path=/nixos/trunk/; revision=7309 --- boot/boot-stage-2-init.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index a3387fbac57..c31b4620911 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -96,6 +96,8 @@ udevd --daemon udevtrigger udevsettle # wait for udev to finish +chmod 666 /dev/null # grmbl + # Start an interactive shell. #exec @shell@ -- GitLab From 1561e2421d0ff068f627cdd1219ec04803e16d87 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 Dec 2006 03:25:13 +0000 Subject: [PATCH 0293/5331] * Enable PAM in the SSH daemon. svn path=/nixos/trunk/; revision=7311 --- configuration/boot-environment.nix | 1 + configuration/etc/sshd_config | 1 + 2 files changed, 2 insertions(+) diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index 6e14ef2e193..ecc58406948 100644 --- a/configuration/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -254,6 +254,7 @@ rec { ) [ "login" + "sshd" "passwd" "useradd" "other" diff --git a/configuration/etc/sshd_config b/configuration/etc/sshd_config index 33619c72028..994042bc78f 100644 --- a/configuration/etc/sshd_config +++ b/configuration/etc/sshd_config @@ -1 +1,2 @@ X11Forwarding yes +UsePAM yes -- GitLab From 970924e487c0c17563f2c6654295ead0462b1997 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 Dec 2006 14:16:03 +0000 Subject: [PATCH 0294/5331] * Forgotten to add. svn path=/nixos/trunk/; revision=7312 --- configuration/etc/pam.d/sshd | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 configuration/etc/pam.d/sshd diff --git a/configuration/etc/pam.d/sshd b/configuration/etc/pam.d/sshd new file mode 100644 index 00000000000..d3463aab5ae --- /dev/null +++ b/configuration/etc/pam.d/sshd @@ -0,0 +1,4 @@ +auth required @pam_unix2@/lib/security/pam_unix2.so +account required @pam_unix2@/lib/security/pam_unix2.so +password required @pam_unix2@/lib/security/pam_unix2.so nullok +session required @pam_unix2@/lib/security/pam_unix2.so -- GitLab From 16a9702c4a102b5a7883a75c098513b9befa06d6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 Dec 2006 15:32:10 +0000 Subject: [PATCH 0295/5331] * Move some stuff out of boot-environment.nix. svn path=/nixos/trunk/; revision=7313 --- configuration/boot-environment.nix | 164 +---------------------------- configuration/etc.nix | 80 ++++++++++++++ configuration/upstart.nix | 88 ++++++++++++++++ 3 files changed, 173 insertions(+), 159 deletions(-) create mode 100644 configuration/etc.nix create mode 100644 configuration/upstart.nix diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index ecc58406948..dfab2b61670 100644 --- a/configuration/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -103,171 +103,17 @@ rec { # The services (Upstart) configuration for the system. - upstartJobs = import ../upstart-jobs/gather.nix { - inherit (pkgs) runCommand; - - jobs = map makeJob [ - # Syslogd. - (import ../upstart-jobs/syslogd.nix { - inherit (pkgs) sysklogd; - }) - - # Hardware scan; loads modules for PCI devices. - (import ../upstart-jobs/hardware-scan.nix { - inherit (pkgs) kernel module_init_tools; - }) - - # Network interfaces. - (import ../upstart-jobs/network-interfaces.nix { - inherit (pkgs) nettools kernel module_init_tools; - }) - - # DHCP client. - (import ../upstart-jobs/dhclient.nix { - inherit (pkgs) nettools; - dhcp = pkgs.dhcpWrapper; - }) - - # SSH daemon. - (import ../upstart-jobs/sshd.nix { - inherit (pkgs) openssh; - }) - - # Nix daemon - required for multi-user Nix. - (import ../upstart-jobs/nix-daemon.nix { - inherit nix; - }) - - # X server. - (import ../upstart-jobs/xserver.nix { - inherit (pkgs) substituteAll; - inherit (pkgs.xorg) xorgserver xf86inputkeyboard xf86inputmouse xf86videovesa; - }) - - # Transparent TTY backgrounds. - (import ../upstart-jobs/tty-backgrounds.nix { - inherit (pkgs) stdenv splashutils; - backgrounds = splashThemes.ttyBackgrounds; - }) - - # Handles the maintenance/stalled event (single-user shell). - (import ../upstart-jobs/maintenance-shell.nix { - inherit (pkgs) bash; - }) - - # Ctrl-alt-delete action. - (import ../upstart-jobs/ctrl-alt-delete.nix) - - ] - - # Handles the reboot/halt events. - ++ (map - (event: makeJob (import ../upstart-jobs/halt.nix { - inherit (pkgs) bash utillinux; - inherit event; - })) - ["reboot" "halt" "system-halt" "power-off"] - ) - - # The terminals on ttyX. - ++ (map - (ttyNumber: makeJob (import ../upstart-jobs/mingetty.nix { - inherit (pkgs) mingetty pam_login; - inherit ttyNumber; - })) - [1 2 3 4 5 6] - ) - - # For the builtin logd job. - ++ [pkgs.upstart]; + upstartJobs = import ./upstart.nix { + inherit pkgs nix splashThemes; }; - etc = import ../helpers/make-etc.nix { - inherit (pkgs) stdenv; - - configFiles = [ - - { # TCP/UDP port assignments. - source = pkgs.iana_etc + "/etc/services"; - target = "services"; - } - - { # IP protocol numbers. - source = pkgs.iana_etc + "/etc/protocols"; - target = "protocols"; - } - - { # Hostname-to-IP mappings. - source = ./etc/hosts; - target = "hosts"; - } - - { # Name Service Switch configuration file. Required by the C library. - source = ./etc/nsswitch.conf; - target = "nsswitch.conf"; - } - - { # Configuration file for the system logging daemon. - source = ./etc/syslog.conf; - target = "syslog.conf"; - } - - { # Friendly greeting on the virtual consoles. - source = ./etc/issue; - target = "issue"; - } - - { # Configuration for pwdutils (login, passwd, useradd, etc.). - # You cannot login without it! - source = ./etc/login.defs; - target = "login.defs"; - } - - { # SSH daemon configuration. - source = ./etc/sshd_config; - target = "ssh/sshd_config"; - } - - { # The Upstart events defined above. - source = upstartJobs + "/etc/event.d"; - target = "event.d"; - } - - { # Configuration for passwd and friends (e.g., hash algorithm - # for /etc/passwd). - source = ./etc/default/passwd; - target = "default/passwd"; - } - - ] - - # A bunch of PAM configuration files for various programs. - ++ (map - (program: - { source = pkgs.substituteAll { - src = ./etc/pam.d + ("/" + program); - inherit (pkgs) pam_unix2; - }; - target = "pam.d/" + program; - } - ) - [ - "login" - "sshd" - "passwd" - "useradd" - "other" - ] - ); + # The static parts of /etc. + etc = import ./etc.nix { + inherit pkgs upstartJobs; }; - makeJob = import ../upstart-jobs/make-job.nix { - inherit (pkgs) runCommand; - }; - - setuidWrapper = import ../helpers/setuid { inherit (pkgs) stdenv; wrapperDir = "/var/setuid-wrappers"; diff --git a/configuration/etc.nix b/configuration/etc.nix new file mode 100644 index 00000000000..d8027c6873e --- /dev/null +++ b/configuration/etc.nix @@ -0,0 +1,80 @@ +{pkgs, upstartJobs}: + +import ../helpers/make-etc.nix { + inherit (pkgs) stdenv; + + configFiles = [ + + { # TCP/UDP port assignments. + source = pkgs.iana_etc + "/etc/services"; + target = "services"; + } + + { # IP protocol numbers. + source = pkgs.iana_etc + "/etc/protocols"; + target = "protocols"; + } + + { # Hostname-to-IP mappings. + source = ./etc/hosts; + target = "hosts"; + } + + { # Name Service Switch configuration file. Required by the C library. + source = ./etc/nsswitch.conf; + target = "nsswitch.conf"; + } + + { # Configuration file for the system logging daemon. + source = ./etc/syslog.conf; + target = "syslog.conf"; + } + + { # Friendly greeting on the virtual consoles. + source = ./etc/issue; + target = "issue"; + } + + { # Configuration for pwdutils (login, passwd, useradd, etc.). + # You cannot login without it! + source = ./etc/login.defs; + target = "login.defs"; + } + + { # SSH daemon configuration. + source = ./etc/sshd_config; + target = "ssh/sshd_config"; + } + + { # The Upstart events defined above. + source = upstartJobs + "/etc/event.d"; + target = "event.d"; + } + + { # Configuration for passwd and friends (e.g., hash algorithm + # for /etc/passwd). + source = ./etc/default/passwd; + target = "default/passwd"; + } + + ] + + # A bunch of PAM configuration files for various programs. + ++ (map + (program: + { source = pkgs.substituteAll { + src = ./etc/pam.d + ("/" + program); + inherit (pkgs) pam_unix2; + }; + target = "pam.d/" + program; + } + ) + [ + "login" + "sshd" + "passwd" + "useradd" + "other" + ] + ); +} \ No newline at end of file diff --git a/configuration/upstart.nix b/configuration/upstart.nix new file mode 100644 index 00000000000..8efa0a4ca75 --- /dev/null +++ b/configuration/upstart.nix @@ -0,0 +1,88 @@ +{pkgs, nix, splashThemes}: + +let + + makeJob = import ../upstart-jobs/make-job.nix { + inherit (pkgs) runCommand; + }; + +in + +import ../upstart-jobs/gather.nix { + inherit (pkgs) runCommand; + + jobs = map makeJob [ + # Syslogd. + (import ../upstart-jobs/syslogd.nix { + inherit (pkgs) sysklogd; + }) + + # Hardware scan; loads modules for PCI devices. + (import ../upstart-jobs/hardware-scan.nix { + inherit (pkgs) kernel module_init_tools; + }) + + # Network interfaces. + (import ../upstart-jobs/network-interfaces.nix { + inherit (pkgs) nettools kernel module_init_tools; + }) + + # DHCP client. + (import ../upstart-jobs/dhclient.nix { + inherit (pkgs) nettools; + dhcp = pkgs.dhcpWrapper; + }) + + # SSH daemon. + (import ../upstart-jobs/sshd.nix { + inherit (pkgs) openssh; + }) + + # Nix daemon - required for multi-user Nix. + (import ../upstart-jobs/nix-daemon.nix { + inherit nix; + }) + + # X server. + (import ../upstart-jobs/xserver.nix { + inherit (pkgs) substituteAll; + inherit (pkgs.xorg) xorgserver xf86inputkeyboard xf86inputmouse xf86videovesa; + }) + + # Transparent TTY backgrounds. + (import ../upstart-jobs/tty-backgrounds.nix { + inherit (pkgs) stdenv splashutils; + backgrounds = splashThemes.ttyBackgrounds; + }) + + # Handles the maintenance/stalled event (single-user shell). + (import ../upstart-jobs/maintenance-shell.nix { + inherit (pkgs) bash; + }) + + # Ctrl-alt-delete action. + (import ../upstart-jobs/ctrl-alt-delete.nix) + + ] + + # Handles the reboot/halt events. + ++ (map + (event: makeJob (import ../upstart-jobs/halt.nix { + inherit (pkgs) bash utillinux; + inherit event; + })) + ["reboot" "halt" "system-halt" "power-off"] + ) + + # The terminals on ttyX. + ++ (map + (ttyNumber: makeJob (import ../upstart-jobs/mingetty.nix { + inherit (pkgs) mingetty pam_login; + inherit ttyNumber; + })) + [1 2 3 4 5 6] + ) + + # For the builtin logd job. + ++ [pkgs.upstart]; +} -- GitLab From ce29e4efc7f7986612be1f6cbd7598814545cdbe Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 Dec 2006 15:42:02 +0000 Subject: [PATCH 0296/5331] * More refactoring. svn path=/nixos/trunk/; revision=7314 --- configuration/boot-environment.nix | 35 +++++------------------------- configuration/config.nix | 29 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 30 deletions(-) create mode 100644 configuration/config.nix diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index dfab2b61670..4d7f9d38d7b 100644 --- a/configuration/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -202,38 +202,13 @@ rec { }; - lib = pkgs.library; + config = import ./config.nix pkgs.library configData; - - config = rec { - - # The user configuration. - config = { - networking = { - hostname = "nixos"; - }; + # The user configuration. + configData = { + networking = { + hostname = "nixos"; }; - - # The option declarations, i.e., option names with defaults and - # documentation. - declarations = import ./options.nix; - - # Get the option named `name' from the user configuration, using - # its default value if it's not defined. - get = name: - let - sameName = lib.filter (opt: lib.eqLists opt.name name) declarations; - default = - if sameName == [] - then abort ("Undeclared option `" + printName name + "'.") - else if !builtins.head sameName ? default - then abort ("Option `" + printName name + "' has no default.") - else (builtins.head sameName).default; - in lib.getAttr name default config; - - printName = name: lib.concatStrings (lib.intersperse "." name); - }; - } diff --git a/configuration/config.nix b/configuration/config.nix new file mode 100644 index 00000000000..705b44407af --- /dev/null +++ b/configuration/config.nix @@ -0,0 +1,29 @@ +# Given a configuration, this function returns an object with a `get' +# method for retrieving the values of options, falling back to the +# defaults declared in options.nix if no value is given for an +# option. + +lib: config: + +rec { + + # The option declarations, i.e., option names with defaults and + # documentation. + declarations = import ./options.nix; + + # Get the option named `name' from the user configuration, using + # its default value if it's not defined. + get = name: + let + sameName = lib.filter (opt: lib.eqLists opt.name name) declarations; + default = + if sameName == [] + then abort ("Undeclared option `" + printName name + "'.") + else if !builtins.head sameName ? default + then abort ("Option `" + printName name + "' has no default.") + else (builtins.head sameName).default; + in lib.getAttr name default config; + + printName = name: lib.concatStrings (lib.intersperse "." name); + +} -- GitLab From 7573a88ca683f3715976765f21b7c1de29fbd1aa Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 Dec 2006 15:47:30 +0000 Subject: [PATCH 0297/5331] * More refactoring. svn path=/nixos/trunk/; revision=7316 --- configuration/boot-environment.nix | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index 4d7f9d38d7b..31af084695c 100644 --- a/configuration/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -4,10 +4,16 @@ , rootLabel ? "" , stage2Init , readOnlyRoot +, configData ? {} }: rec { + # Make a configuration object from which we can retrieve option + # values. + config = import ./config.nix pkgs.library configData; + + pkgs = import ../pkgs/top-level/all-packages.nix {inherit system;}; pkgsDiet = import ../pkgs/top-level/all-packages.nix { @@ -113,7 +119,9 @@ rec { inherit pkgs upstartJobs; }; - + + # The wrapper setuid programs (since we can't have setuid programs + # in the Nix store). setuidWrapper = import ../helpers/setuid { inherit (pkgs) stdenv; wrapperDir = "/var/setuid-wrappers"; @@ -201,14 +209,4 @@ rec { ]; }; - - config = import ./config.nix pkgs.library configData; - - # The user configuration. - configData = { - networking = { - hostname = "nixos"; - }; - }; - } -- GitLab From 74783a4510bef6594da0c7aea69d25772344b5cb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 Dec 2006 16:10:23 +0000 Subject: [PATCH 0298/5331] * More refactoring; move some of the boot time options into the options framework. svn path=/nixos/trunk/; revision=7317 --- boot/boot-stage-1.nix | 7 ++- configuration/boot-environment.nix | 16 +++--- configuration/options.nix | 72 ++++++++++++++++++++++++-- configuration/system-configuration.nix | 22 ++++---- test.sh | 2 +- 5 files changed, 90 insertions(+), 29 deletions(-) diff --git a/boot/boot-stage-1.nix b/boot/boot-stage-1.nix index f8b84eb6fdb..63c562a13b9 100644 --- a/boot/boot-stage-1.nix +++ b/boot/boot-stage-1.nix @@ -21,14 +21,13 @@ stage2Init ? "/init" }: -assert !autoDetectRootDevice -> rootDevice != ""; -assert autoDetectRootDevice -> rootLabel != ""; - substituteAll { src = ./boot-stage-1-init.sh; isExecutable = true; inherit staticShell modules; - inherit autoDetectRootDevice rootDevice rootLabel; + inherit autoDetectRootDevice; + rootDevice = if !autoDetectRootDevice then rootDevice else ""; + rootLabel = if autoDetectRootDevice then rootLabel else ""; path = [ staticTools module_init_tools diff --git a/configuration/boot-environment.nix b/configuration/boot-environment.nix index 31af084695c..762e2042401 100644 --- a/configuration/boot-environment.nix +++ b/configuration/boot-environment.nix @@ -1,17 +1,13 @@ { system ? __currentSystem -, autoDetectRootDevice ? false -, rootDevice ? "" -, rootLabel ? "" , stage2Init -, readOnlyRoot -, configData ? {} +, configuration }: rec { # Make a configuration object from which we can retrieve option # values. - config = import ./config.nix pkgs.library configData; + config = import ./config.nix pkgs.library configuration; pkgs = import ../pkgs/top-level/all-packages.nix {inherit system;}; @@ -71,7 +67,9 @@ rec { inherit (pkgs) substituteAll; inherit (pkgsDiet) module_init_tools; inherit extraUtils; - inherit autoDetectRootDevice rootDevice rootLabel; + autoDetectRootDevice = config.get ["boot" "autoDetectRootDevice"]; + rootDevice = config.get ["boot" "rootDevice"]; + rootLabel = config.get ["boot" "rootLabel"]; inherit stage2Init; modules = modulesClosure; staticShell = stdenvLinuxStuff.bootstrapTools.bash; @@ -172,8 +170,8 @@ rec { isExecutable = true; inherit etc; - inherit readOnlyRoot; inherit (pkgs) kernel; + readOnlyRoot = config.get ["boot" "readOnlyRoot"]; hostName = config.get ["networking" "hostname"]; wrapperDir = setuidWrapper.wrapperDir; accounts = ../helpers/accounts.sh; @@ -198,8 +196,8 @@ rec { bootStage2 = import ../boot/boot-stage-2.nix { inherit (pkgs) substituteAll coreutils utillinux kernel udev upstart; - inherit readOnlyRoot; inherit activateConfiguration; + readOnlyRoot = config.get ["boot" "readOnlyRoot"]; upstartPath = [ pkgs.coreutils pkgs.findutils diff --git a/configuration/options.nix b/configuration/options.nix index 4cd2f3a7343..31842627bb5 100644 --- a/configuration/options.nix +++ b/configuration/options.nix @@ -1,11 +1,67 @@ -[ +[ - { + + { name = ["networking" "hostname"]; default = "nixos"; description = "The name of the machine."; } + + { + name = ["boot" "autoDetectRootDevice"]; + default = false; + description = " + Whether to find the root device automatically by searching for a + device with the right label. If this option is off, then + must be set. + "; + } + + + { + name = ["boot" "rootDevice"]; + example = "/dev/hda1"; + description = " + The device to be mounted on / at system startup. + "; + } + + + { + name = ["boot" "readOnlyRoot"]; + default = false; + description = " + Whether the root device should be mounted writable. This should + be set when booting from CD-ROM. + "; + } + + + { + name = ["boot" "rootLabel"]; + description = " + When auto-detecting the root device (see + ), this option + specifies the label of the root device. Right now, this is + merely a file name that should exist in the root directory of + the file system. It is used to find the boot CD-ROM. + "; + } + + + { + name = ["boot" "grubDevice"]; + default = ""; + example = "/dev/hda"; + description = " + The device on which the boot loader, Grub, will be installed. + If empty, Grub won't be installed and it's your responsibility + to make the system bootable. + "; + } + + { name = ["networking" "useDHCP"]; default = true; @@ -16,6 +72,7 @@ "; } + { name = ["networking" "interfaces"]; default = []; @@ -33,6 +90,7 @@ "; } + { name = ["filesystems" "mountPoints"]; example = [ @@ -48,6 +106,7 @@ "; } + { name = ["services" "syslogd" "tty"]; default = 10; @@ -56,7 +115,8 @@ messages. "; } - + + { name = ["services" "mingetty" "ttys"]; default = [1 2 3 4 5 6]; @@ -65,7 +125,8 @@ login prompt. "; } - + + { name = ["services" "mingetty" "waitOnMounts"]; default = false; @@ -77,6 +138,7 @@ "; } + { name = ["services" "sshd" "enable"]; default = false; @@ -86,6 +148,7 @@ "; } + { name = ["services" "sshd" "forwardX11"]; default = false; @@ -94,4 +157,5 @@ "; } + ] diff --git a/configuration/system-configuration.nix b/configuration/system-configuration.nix index 39b4f961f16..6e6b6bc6e0f 100644 --- a/configuration/system-configuration.nix +++ b/configuration/system-configuration.nix @@ -1,18 +1,18 @@ let - # The root device. - rootDevice = "/dev/hda1"; - - # The device on which GRUB should be installed (leave empty if you - # don't want GRUB to be installed). - grubDevice = "/dev/hda"; + configuration = { + boot = { + autoDetectRootDevice = false; + rootDevice = "/dev/hda1"; + readOnlyRoot = false; + grubDevice = "/dev/hda"; + }; + }; # Build boot scripts. bootEnv = import ./boot-environment.nix { - autoDetectRootDevice = false; - inherit rootDevice; stage2Init = ""; # Passed on the command line via Grub. - readOnlyRoot = false; + inherit configuration; }; # Extra kernel command line arguments. @@ -34,12 +34,12 @@ rec { inherit upstartJobs; - systemConfiguration = pkgs.stdenvNew.mkDerivation { + system = pkgs.stdenvNew.mkDerivation { name = "system-configuration"; builder = ./system-configuration.sh; switchToConfiguration = ./switch-to-configuration.sh; inherit (pkgs) grub coreutils gnused gnugrep diffutils findutils; - inherit grubDevice; + grubDevice = "/dev/hda"; # !!! inherit bootStage2; inherit activateConfiguration; inherit grubMenuBuilder; diff --git a/test.sh b/test.sh index 6bb66bf742e..c50ebe907d1 100755 --- a/test.sh +++ b/test.sh @@ -1,4 +1,4 @@ #! /bin/sh set -e -nix-build configuration/system-configuration.nix -A systemConfiguration -K -k +nix-build configuration/system-configuration.nix -A system -K -k ./result/bin/switch-to-configuration test -- GitLab From 2d0f190f20b0aadae208e60b99828e01c27d7f02 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 Dec 2006 17:36:57 +0000 Subject: [PATCH 0299/5331] * More refactoring: renamed boot-environment.nix to system.nix (since it does a lot more than just booting), and merged system-configuration.nix into system.nix. svn path=/nixos/trunk/; revision=7318 --- configuration/options.nix | 31 +++++++++ configuration/system-configuration.nix | 63 ------------------- .../{boot-environment.nix => system.nix} | 46 ++++++++++++-- .../{system-configuration.sh => system.sh} | 4 +- installer/grub-menu-builder.sh | 4 ++ instances/examples/basic.nix | 8 +++ test.sh | 4 +- upgrade.sh | 4 +- 8 files changed, 92 insertions(+), 72 deletions(-) delete mode 100644 configuration/system-configuration.nix rename configuration/{boot-environment.nix => system.nix} (78%) rename configuration/{system-configuration.sh => system.sh} (80%) create mode 100644 instances/examples/basic.nix diff --git a/configuration/options.nix b/configuration/options.nix index 31842627bb5..c8a2f07df01 100644 --- a/configuration/options.nix +++ b/configuration/options.nix @@ -62,6 +62,37 @@ } + { + name = ["boot" "kernelParams"]; + default = [ + "selinux=0" + "apm=on" + "acpi=on" + "vga=0x317" + "console=tty1" + "splash=verbose" + ]; + description = " + The kernel parameters. If you want to add additional + parameters, it's best to set +