mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-20 01:16:57 +01:00
I have probably fixed the "separate /boot" problem. Tested in Qemu, it worked
svn path=/nixos/trunk/; revision=11789
This commit is contained in:
parent
f49efc1039
commit
98748a319a
2 changed files with 35 additions and 15 deletions
|
@ -147,8 +147,12 @@ rec {
|
|||
mkdir -p /etc/nixos/nixos
|
||||
tar xjf /install/nixos.tar.bz2 -C /etc/nixos/nixos
|
||||
tar xjf /install/nixpkgs.tar.bz2 -C /etc/nixos
|
||||
tar xjf /install/nixos-services.tar.bz2 -C /etc/nixos
|
||||
mv /etc/nixos/nixpkgs-* /etc/nixos/nixpkgs || true
|
||||
mv /etc/nixos/*-nixpkgs /etc/nixos/nixpkgs || true
|
||||
mv /etc/nixos/*-services /etc/nixos/services || true
|
||||
ln -sfn ../nixpkgs/pkgs /etc/nixos/nixos/pkgs
|
||||
ln -sfn ../services /etc/nixos/services
|
||||
chown -R root.root /etc/nixos
|
||||
touch /etc/resolv.conf
|
||||
end script
|
||||
|
@ -301,7 +305,7 @@ rec {
|
|||
|
||||
makeNixPkgsTarball = tarName: input: ((pkgs.runCommand "tarball-nixpkgs" {inherit tarName;} ''
|
||||
ensureDir $out
|
||||
(cd ${input}/.. && tar cvfj $out/${tarName} nixpkgs \
|
||||
(cd ${input}/.. && tar cvfj $out/${tarName} $(basename ${input}) \
|
||||
--exclude '*~' \
|
||||
--exclude 'result')
|
||||
'')+"/${tarName}");
|
||||
|
@ -322,8 +326,9 @@ rec {
|
|||
nixpkgsTarball = if networkNixpkgs != "" then pkgs.fetchurl {
|
||||
url = configuration.installer.nixpkgsURL + "/" + nixpkgsRel + ".tar.bz2";
|
||||
md5 = "6a793b877e2a4fa79827515902e1dfd8";
|
||||
} else makeNixPkgsTarball "nixpkgs.tar.bz2" "/etc/nixos/nixpkgs";
|
||||
|
||||
} else makeNixPkgsTarball "nixpkgs.tar.bz2" ("" + ./../../nixpkgs);
|
||||
|
||||
nixosServicesTarball = makeNixPkgsTarball "nixos-services.tar.bz2" ("" + ./../../services);
|
||||
|
||||
# The configuration file for Grub.
|
||||
grubCfg = pkgs.writeText "menu.lst" (''
|
||||
|
@ -374,6 +379,10 @@ rec {
|
|||
source = nixpkgsTarball;
|
||||
target = "/install/nixpkgs.tar.bz2";
|
||||
}
|
||||
{
|
||||
source = nixosServicesTarball;
|
||||
target = "/install/nixos-services.tar.bz2";
|
||||
}
|
||||
{
|
||||
source = pkgs.writeText "label" "";
|
||||
target = "/${configuration.boot.rootLabel}";
|
||||
|
|
|
@ -48,13 +48,27 @@ fi
|
|||
NIXOS=$(readlink -f "$NIXOS")
|
||||
|
||||
|
||||
# Enable networking in the chroot.
|
||||
mkdir -m 0755 -p $mountPoint/etc
|
||||
touch /etc/resolv.conf
|
||||
cp /etc/resolv.conf $mountPoint/etc/
|
||||
|
||||
# Mount some stuff in the target root directory.
|
||||
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
|
||||
|
||||
# Grub needs a mtab. Make a proper one..
|
||||
chroot $mountPoint \
|
||||
/nix/var/nix/profiles/system/sw/bin/cat /proc/mounts > /etc/mtab
|
||||
|
||||
echo "/etc/mtab: "
|
||||
cat /mnt/etc/mtab
|
||||
|
||||
# That could spoil mtab with litter.
|
||||
mount --rbind / $mountPoint/mnt
|
||||
|
||||
cleanup() {
|
||||
# !!! don't umount anything we didn't mount ourselves
|
||||
for i in $(grep -F "$mountPoint" /proc/mounts \
|
||||
|
@ -114,11 +128,6 @@ mkdir -m 0755 -p $mountPoint/bin
|
|||
ln -sf @shell@ $mountPoint/bin/sh
|
||||
|
||||
|
||||
# Enable networking in the chroot.
|
||||
mkdir -m 0755 -p $mountPoint/etc
|
||||
cp /etc/resolv.conf $mountPoint/etc/
|
||||
|
||||
|
||||
# Pull the manifest on the CD so that everything in the Nix store on
|
||||
# the CD can be copied directly.
|
||||
echo "registering substitutes to speed up builds..."
|
||||
|
@ -161,24 +170,26 @@ if test -e $targetNixpkgs; then
|
|||
mv $targetNixpkgs $targetNixpkgs.backup-$backupTimestamp
|
||||
fi
|
||||
|
||||
targetServices=$mountPoint/etc/nixos/services
|
||||
if test -e $targetServices; then
|
||||
mv $targetServices $targetServices.backup-$backupTimestamp
|
||||
fi
|
||||
|
||||
|
||||
# Copy the NixOS/Nixpkgs sources to the target.
|
||||
cp -prd $NIXOS $targetNixos
|
||||
if test -e /etc/nixos/nixpkgs; then
|
||||
cp -prd /etc/nixos/nixpkgs $targetNixpkgs
|
||||
fi
|
||||
|
||||
|
||||
# Grub needs a mtab.
|
||||
rootDevice=$(df $mountPoint | grep '^/' | sed 's^ .*^^')
|
||||
echo "$rootDevice / somefs rw 0 0" > $mountPoint/etc/mtab
|
||||
if test -e /etc/nixos/services; then
|
||||
cp -prd /etc/nixos/services $targetServices
|
||||
fi
|
||||
|
||||
|
||||
# Mark the target as a NixOS installation, otherwise
|
||||
# switch-to-configuration will chicken out.
|
||||
touch $mountPoint/etc/NIXOS
|
||||
|
||||
|
||||
# Switch to the new system configuration. This will install Grub with
|
||||
# a menu default pointing at the kernel/initrd/etc of the new
|
||||
# configuration.
|
||||
|
|
Loading…
Reference in a new issue