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
@ -147,8 +147,12 @@ rec {
|
|||||||
mkdir -p /etc/nixos/nixos
|
mkdir -p /etc/nixos/nixos
|
||||||
tar xjf /install/nixos.tar.bz2 -C /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/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/*-nixpkgs /etc/nixos/nixpkgs || true
|
||||||
|
mv /etc/nixos/*-services /etc/nixos/services || true
|
||||||
ln -sfn ../nixpkgs/pkgs /etc/nixos/nixos/pkgs
|
ln -sfn ../nixpkgs/pkgs /etc/nixos/nixos/pkgs
|
||||||
|
ln -sfn ../services /etc/nixos/services
|
||||||
chown -R root.root /etc/nixos
|
chown -R root.root /etc/nixos
|
||||||
touch /etc/resolv.conf
|
touch /etc/resolv.conf
|
||||||
end script
|
end script
|
||||||
@ -301,7 +305,7 @@ rec {
|
|||||||
|
|
||||||
makeNixPkgsTarball = tarName: input: ((pkgs.runCommand "tarball-nixpkgs" {inherit tarName;} ''
|
makeNixPkgsTarball = tarName: input: ((pkgs.runCommand "tarball-nixpkgs" {inherit tarName;} ''
|
||||||
ensureDir $out
|
ensureDir $out
|
||||||
(cd ${input}/.. && tar cvfj $out/${tarName} nixpkgs \
|
(cd ${input}/.. && tar cvfj $out/${tarName} $(basename ${input}) \
|
||||||
--exclude '*~' \
|
--exclude '*~' \
|
||||||
--exclude 'result')
|
--exclude 'result')
|
||||||
'')+"/${tarName}");
|
'')+"/${tarName}");
|
||||||
@ -322,8 +326,9 @@ rec {
|
|||||||
nixpkgsTarball = if networkNixpkgs != "" then pkgs.fetchurl {
|
nixpkgsTarball = if networkNixpkgs != "" then pkgs.fetchurl {
|
||||||
url = configuration.installer.nixpkgsURL + "/" + nixpkgsRel + ".tar.bz2";
|
url = configuration.installer.nixpkgsURL + "/" + nixpkgsRel + ".tar.bz2";
|
||||||
md5 = "6a793b877e2a4fa79827515902e1dfd8";
|
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.
|
# The configuration file for Grub.
|
||||||
grubCfg = pkgs.writeText "menu.lst" (''
|
grubCfg = pkgs.writeText "menu.lst" (''
|
||||||
@ -374,6 +379,10 @@ rec {
|
|||||||
source = nixpkgsTarball;
|
source = nixpkgsTarball;
|
||||||
target = "/install/nixpkgs.tar.bz2";
|
target = "/install/nixpkgs.tar.bz2";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
source = nixosServicesTarball;
|
||||||
|
target = "/install/nixos-services.tar.bz2";
|
||||||
|
}
|
||||||
{
|
{
|
||||||
source = pkgs.writeText "label" "";
|
source = pkgs.writeText "label" "";
|
||||||
target = "/${configuration.boot.rootLabel}";
|
target = "/${configuration.boot.rootLabel}";
|
||||||
|
@ -48,13 +48,27 @@ fi
|
|||||||
NIXOS=$(readlink -f "$NIXOS")
|
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.
|
# Mount some stuff in the target root directory.
|
||||||
mkdir -m 0755 -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 /dev $mountPoint/dev
|
||||||
mount --bind /proc $mountPoint/proc
|
mount --bind /proc $mountPoint/proc
|
||||||
mount --bind /sys $mountPoint/sys
|
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() {
|
cleanup() {
|
||||||
# !!! don't umount anything we didn't mount ourselves
|
# !!! don't umount anything we didn't mount ourselves
|
||||||
for i in $(grep -F "$mountPoint" /proc/mounts \
|
for i in $(grep -F "$mountPoint" /proc/mounts \
|
||||||
@ -114,11 +128,6 @@ mkdir -m 0755 -p $mountPoint/bin
|
|||||||
ln -sf @shell@ $mountPoint/bin/sh
|
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
|
# Pull the manifest on the CD so that everything in the Nix store on
|
||||||
# the CD can be copied directly.
|
# the CD can be copied directly.
|
||||||
echo "registering substitutes to speed up builds..."
|
echo "registering substitutes to speed up builds..."
|
||||||
@ -161,24 +170,26 @@ if test -e $targetNixpkgs; then
|
|||||||
mv $targetNixpkgs $targetNixpkgs.backup-$backupTimestamp
|
mv $targetNixpkgs $targetNixpkgs.backup-$backupTimestamp
|
||||||
fi
|
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.
|
# Copy the NixOS/Nixpkgs sources to the target.
|
||||||
cp -prd $NIXOS $targetNixos
|
cp -prd $NIXOS $targetNixos
|
||||||
if test -e /etc/nixos/nixpkgs; then
|
if test -e /etc/nixos/nixpkgs; then
|
||||||
cp -prd /etc/nixos/nixpkgs $targetNixpkgs
|
cp -prd /etc/nixos/nixpkgs $targetNixpkgs
|
||||||
fi
|
fi
|
||||||
|
if test -e /etc/nixos/services; then
|
||||||
|
cp -prd /etc/nixos/services $targetServices
|
||||||
# Grub needs a mtab.
|
fi
|
||||||
rootDevice=$(df $mountPoint | grep '^/' | sed 's^ .*^^')
|
|
||||||
echo "$rootDevice / somefs rw 0 0" > $mountPoint/etc/mtab
|
|
||||||
|
|
||||||
|
|
||||||
# Mark the target as a NixOS installation, otherwise
|
# Mark the target as a NixOS installation, otherwise
|
||||||
# switch-to-configuration will chicken out.
|
# switch-to-configuration will chicken out.
|
||||||
touch $mountPoint/etc/NIXOS
|
touch $mountPoint/etc/NIXOS
|
||||||
|
|
||||||
|
|
||||||
# Switch to the new system configuration. This will install Grub with
|
# Switch to the new system configuration. This will install Grub with
|
||||||
# a menu default pointing at the kernel/initrd/etc of the new
|
# a menu default pointing at the kernel/initrd/etc of the new
|
||||||
# configuration.
|
# configuration.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user