* Moving stuff around.
svn path=/nixos/trunk/; revision=7155
This commit is contained in:
parent
1a0fcfdf1a
commit
0817c307dc
43
boot/boot.sh
43
boot/boot.sh
@ -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."
|
|
@ -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
|
|
@ -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;
|
|
||||||
}
|
|
@ -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
|
|
12
boot/halt.sh
12
boot/halt.sh
@ -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
|
|
@ -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
|
|
16
doc/X-howto
16
doc/X-howto
@ -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.
|
|
@ -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.
|
|
117
doc/howto
117
doc/howto
@ -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 <ip address> netmask <netmask>
|
|
||||||
# route add default gw <gateway ip address>
|
|
||||||
# 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
|
|
374
fill-disk.sh
374
fill-disk.sh
@ -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
|
|
79
init.sh
79
init.sh
@ -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
|
|
@ -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
|
|
@ -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;
|
|
||||||
}
|
|
@ -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.
|
|
||||||
###
|
|
@ -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)
|
|
@ -1,3 +0,0 @@
|
|||||||
#! @bash@/bin/sh -e
|
|
||||||
|
|
||||||
exec ./fill-disk.sh | @busybox@/bin/tee /tmp/install-log
|
|
2
isolinux.cfg
Executable file → Normal file
2
isolinux.cfg
Executable file → Normal file
@ -3,4 +3,4 @@ prompt 1
|
|||||||
timeout 60
|
timeout 60
|
||||||
label linux
|
label linux
|
||||||
kernel vmlinuz
|
kernel vmlinuz
|
||||||
append initrd=initram.img init=/bin/sh
|
append initrd=initrd selinux=0 apm=on acpi=on
|
||||||
|
27
login.sh
27
login.sh
@ -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
|
|
329
make-disk.sh
329
make-disk.sh
@ -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}/*
|
|
44
pkgs.nix
44
pkgs.nix
@ -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];
|
|
||||||
|
|
||||||
}
|
|
@ -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 = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
]
|
|
@ -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"];
|
|
||||||
};
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
@ -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 = {
|
|
||||||
# ...
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
@ -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 ...];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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
|
|
7
run.sh
7
run.sh
@ -1,7 +0,0 @@
|
|||||||
#! /bin/sh -e
|
|
||||||
|
|
||||||
image=/tmp/disk.img
|
|
||||||
|
|
||||||
linux ubd0="$image" mem=256M \
|
|
||||||
eth0=tuntap,tap1 \
|
|
||||||
init="/init"
|
|
@ -1,13 +0,0 @@
|
|||||||
/nix/store/abcd-<package>
|
|
||||||
deriver
|
|
||||||
2
|
|
||||||
/nix/store/1234-<package-1>
|
|
||||||
/nix/store/5678-<package-2>
|
|
||||||
|
|
||||||
Amount of dependencies determined by:
|
|
||||||
|
|
||||||
nix-store -q --references p
|
|
||||||
|
|
||||||
or better (for a large expression)
|
|
||||||
|
|
||||||
nix-store -q --requisites p
|
|
@ -1,6 +0,0 @@
|
|||||||
default linux
|
|
||||||
prompt 1
|
|
||||||
timeout 60
|
|
||||||
label linux
|
|
||||||
kernel vmlinuz
|
|
||||||
append initrd=initrd selinux=0 apm=on acpi=on
|
|
Loading…
x
Reference in New Issue
Block a user