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
This commit is contained in:
parent
2c87da322d
commit
493661f880
54
fill-disk.sh
54
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 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
|
||||
|
||||
|
30
make-disk.sh
30
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user