mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 00:43:20 +00:00
* 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
This commit is contained in:
parent
3514c5658b
commit
91a5fe9eb0
14
boot/boot.sh
14
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."
|
||||
|
@ -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
|
||||
done
|
||||
|
@ -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;
|
||||
}
|
||||
|
1
boot/env.sh
Normal file
1
boot/env.sh
Normal file
@ -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:
|
@ -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
|
||||
|
@ -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! ==="
|
||||
|
||||
|
11
fill-disk.sh
11
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
|
||||
|
7
pkgs.nix
7
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];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user