* refactoring kvm test and bootstrapping image.
expose makeInfo (used by test now) expose config hack * Adding tests to release.nix * fixes * removing dependency on perl refactoring details: Move all configuration modules used by the NixOS installation test script into one directory. svn path=/nixos/trunk/; revision=18982
This commit is contained in:
parent
79bcc7618e
commit
4b5864666e
@ -15,7 +15,10 @@ usage(){
|
|||||||
|
|
||||||
--debug: set -x
|
--debug: set -x
|
||||||
|
|
||||||
-j n : will be passed to nix-env = number of build tasks done simultaniously
|
options which will be passed to nix-env:
|
||||||
|
|
||||||
|
-j n : number of build tasks done simultaniously
|
||||||
|
--keep-going: Build as much as possible.
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
This scripts installs NixOS and should be run within the target chroot.
|
This scripts installs NixOS and should be run within the target chroot.
|
||||||
@ -46,7 +49,7 @@ NIXOS_CONFIG=${NIXOS_CONFIG:-/etc/nixos/configuration.nix}
|
|||||||
NIXOS_PULL=${NIXOS_PULL:-1}
|
NIXOS_PULL=${NIXOS_PULL:-1}
|
||||||
NIXOS_INSTALL_GRUB=${NIXOS_INSTALL_GRUB:-1}
|
NIXOS_INSTALL_GRUB=${NIXOS_INSTALL_GRUB:-1}
|
||||||
|
|
||||||
ps="with-prepared-chroot.sh"
|
ps="run-in-chroot"
|
||||||
|
|
||||||
check "$NIXOS_CONFIG"
|
check "$NIXOS_CONFIG"
|
||||||
check "$NIXOS/modules" "nixos repo not found"
|
check "$NIXOS/modules" "nixos repo not found"
|
||||||
@ -70,12 +73,13 @@ INSTALL=
|
|||||||
|
|
||||||
for arg in $@; do
|
for arg in $@; do
|
||||||
case $arg in
|
case $arg in
|
||||||
--no-pull) NIXOS_PULL=0;;
|
--no-pull) NIXOS_PULL=0;;
|
||||||
--install) INSTALL=1;;
|
--install) INSTALL=1;;
|
||||||
--no-grub) NIXOS_INSTALL_GRUB=;;
|
--no-grub) NIXOS_INSTALL_GRUB=;;
|
||||||
--debug) set -x;;
|
--debug) set -x;;
|
||||||
-j*) NIX_ENV_ARGS="$NIX_ENV_ARGS $arg";;
|
-j*) NIX_ENV_ARGS="$NIX_ENV_ARGS $arg";;
|
||||||
*) usage;
|
--keep-going) NIX_ENV_ARGS="$NIX_ENV_ARGS $arg";;
|
||||||
|
*) usage;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -100,8 +100,6 @@ if ! grep -F -q " $mountPoint " /proc/mounts && [ "$MUST_BE_MOUNTPOINT" = 1 ]; t
|
|||||||
die "$mountPoint doesn't appear to be a mount point"
|
die "$mountPoint doesn't appear to be a mount point"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the store paths to copy from the references graph.
|
|
||||||
storePaths=$(@perl@/bin/perl @pathsFromGraph@ @nixClosure@)
|
|
||||||
# = utils =
|
# = utils =
|
||||||
|
|
||||||
backup(){
|
backup(){
|
||||||
@ -151,6 +149,19 @@ realise_repo(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# only keep /nix/store/* lines
|
||||||
|
# print them only once
|
||||||
|
pathsFromGraph(){
|
||||||
|
declare -A a
|
||||||
|
local prefix=/nix/store/
|
||||||
|
while read l; do
|
||||||
|
if [ "${l/#$prefix/}" != "$l" ] && [ -z "${a["$l"]}" ]; then
|
||||||
|
echo "$l";
|
||||||
|
a["$l"]=1;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# = run actions: =
|
# = run actions: =
|
||||||
for a in $ACTIONS; do
|
for a in $ACTIONS; do
|
||||||
case "$a" in
|
case "$a" in
|
||||||
@ -173,13 +184,14 @@ for a in $ACTIONS; do
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
copy-nix)
|
copy-nix)
|
||||||
if [ -n "$FROM_ARCHIVE" ]; then
|
if [ "$FROM_ARCHIVE" = 1 ]; then
|
||||||
NIX_CLOSURE=${mountPoint}@nixClosure@
|
NIX_CLOSURE=${mountPoint}@nixClosure@
|
||||||
else
|
else
|
||||||
INFO "Copy Nix to the Nix store on the target device."
|
INFO "Copy Nix to the Nix store on the target device."
|
||||||
createDirs
|
createDirs
|
||||||
echo "copying Nix to $mountPoint...."
|
echo "copying Nix to $mountPoint...."
|
||||||
for i in $storePaths; do
|
|
||||||
|
for i in `cat $NIX_CLOSURE | pathsFromGraph`; do
|
||||||
echo " $i"
|
echo " $i"
|
||||||
rsync -a $i $mountPoint/nix/store/
|
rsync -a $i $mountPoint/nix/store/
|
||||||
done
|
done
|
||||||
@ -218,7 +230,7 @@ if [ -e "$T/nixos" ] && [ -e "$T/nixpkgs" ] && [ -e "$T/configuration.nix" ]; th
|
|||||||
cat << EOF
|
cat << EOF
|
||||||
To realise your NixOS installtion execute:
|
To realise your NixOS installtion execute:
|
||||||
|
|
||||||
run-in-chroot "/nix/store/nixos-bootstrap --install"
|
run-in-chroot "/nix/store/nixos-bootstrap --install -j2 --keep-going"
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
for t in "$T/configuration.nix" "$T/nixpkgs" "$T/configuration.nix"; do
|
for t in "$T/configuration.nix" "$T/nixpkgs" "$T/configuration.nix"; do
|
||||||
|
@ -11,8 +11,6 @@ usage(){
|
|||||||
--unprepare : only unmount
|
--unprepare : only unmount
|
||||||
--debug : set -x
|
--debug : set -x
|
||||||
|
|
||||||
requisites: perl
|
|
||||||
|
|
||||||
$SCRIPT --prepare: prepare chroot only
|
$SCRIPT --prepare: prepare chroot only
|
||||||
$SCRIPT --unprepare: unprepare chroot only
|
$SCRIPT --unprepare: unprepare chroot only
|
||||||
$SCRIPT command: run /bin/sh command in chroot
|
$SCRIPT command: run /bin/sh command in chroot
|
||||||
@ -27,18 +25,6 @@ EOF
|
|||||||
die(){ echo "!>> " $@; exit 1; }
|
die(){ echo "!>> " $@; exit 1; }
|
||||||
INFO(){ echo "INFO: " $@; }
|
INFO(){ echo "INFO: " $@; }
|
||||||
|
|
||||||
# this is no longer needed because umount -l unmounts rescursive --rbound mounts as well
|
|
||||||
#umountUnder() {
|
|
||||||
# local dir="$1"
|
|
||||||
# for i in $(grep -F " $dir" /proc/mounts \
|
|
||||||
# | perl -e 'while (<>) { /^\S+\s+(\S+)\s+/; print "$1\n"; }' \
|
|
||||||
# | sort -r);
|
|
||||||
# do
|
|
||||||
# echo umount $i || true
|
|
||||||
# done
|
|
||||||
#}
|
|
||||||
|
|
||||||
|
|
||||||
prepare(){
|
prepare(){
|
||||||
INFO "Enable networking: copying /etc/resolv.conf"
|
INFO "Enable networking: copying /etc/resolv.conf"
|
||||||
mkdir -m 0755 -p $mountPoint/etc
|
mkdir -m 0755 -p $mountPoint/etc
|
||||||
|
@ -10,7 +10,3 @@ $EDITOR $mountPoint/etc/nixos/configuration.nix
|
|||||||
|
|
||||||
# you can replace --install by --help to get more info
|
# you can replace --install by --help to get more info
|
||||||
bash $mountPoint/nix/store/run-in-chroot "/nix/store/nixos-bootstrap --install"
|
bash $mountPoint/nix/store/run-in-chroot "/nix/store/nixos-bootstrap --install"
|
||||||
|
|
||||||
|
|
||||||
This archive is create by
|
|
||||||
nix-build $NIXOS -A config.system.build.minimalInstaller
|
|
||||||
|
@ -67,7 +67,6 @@ let
|
|||||||
name = "nixos-prepare-install";
|
name = "nixos-prepare-install";
|
||||||
src = ./installer2/nixos-prepare-install.sh;
|
src = ./installer2/nixos-prepare-install.sh;
|
||||||
|
|
||||||
inherit (pkgs) perl pathsFromGraph;
|
|
||||||
inherit nix nixClosure nixosBootstrap;
|
inherit nix nixClosure nixosBootstrap;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -87,8 +86,10 @@ let
|
|||||||
nixpkgsURL = config.installer.nixpkgsURL;
|
nixpkgsURL = config.installer.nixpkgsURL;
|
||||||
};
|
};
|
||||||
|
|
||||||
# see ./nixos-bootstrap-archive/README
|
# see ./nixos-bootstrap-archive/README-BOOTSTRAP-NIXOS
|
||||||
minimalInstaller = import ./nixos-bootstrap-archive {
|
# TODO refactor: It should *not* depend on configuration.nix
|
||||||
|
# maybe even move this in nixpkgs?
|
||||||
|
minimalInstallArchive = import ./nixos-bootstrap-archive {
|
||||||
inherit (pkgs) stdenv runCommand perl pathsFromGraph gnutar coreutils bzip2;
|
inherit (pkgs) stdenv runCommand perl pathsFromGraph gnutar coreutils bzip2;
|
||||||
inherit nixosPrepareInstall runInChroot nixosBootstrap nixClosure;
|
inherit nixosPrepareInstall runInChroot nixosBootstrap nixClosure;
|
||||||
};
|
};
|
||||||
@ -129,6 +130,6 @@ in
|
|||||||
inherit nixosInstall;
|
inherit nixosInstall;
|
||||||
|
|
||||||
# expose scripts
|
# expose scripts
|
||||||
inherit (installer2) nixosPrepareInstall runInChroot nixosBootstrap minimalInstaller;
|
inherit (installer2) nixosPrepareInstall runInChroot nixosBootstrap minimalInstallArchive;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
31
release.nix
31
release.nix
@ -17,11 +17,13 @@ let
|
|||||||
version = builtins.readFile ./VERSION + (if officialRelease then "" else "pre${toString nixosSrc.rev}");
|
version = builtins.readFile ./VERSION + (if officialRelease then "" else "pre${toString nixosSrc.rev}");
|
||||||
|
|
||||||
versionModule = { system.nixosVersion = version; };
|
versionModule = { system.nixosVersion = version; };
|
||||||
|
|
||||||
iso = (import lib/eval-config.nix {
|
config = (import lib/eval-config.nix {
|
||||||
inherit system nixpkgs;
|
inherit system nixpkgs;
|
||||||
modules = [ module versionModule ];
|
modules = [ module versionModule ];
|
||||||
}).config.system.build.isoImage;
|
}).config;
|
||||||
|
|
||||||
|
iso = config.system.build.isoImage;
|
||||||
|
|
||||||
in
|
in
|
||||||
# Declare the ISO as a build product so that it shows up in Hydra.
|
# Declare the ISO as a build product so that it shows up in Hydra.
|
||||||
@ -31,6 +33,7 @@ let
|
|||||||
maintainers = map (x: lib.getAttr x lib.maintainers) maintainers;
|
maintainers = map (x: lib.getAttr x lib.maintainers) maintainers;
|
||||||
};
|
};
|
||||||
inherit iso;
|
inherit iso;
|
||||||
|
passthru = { inherit config; };
|
||||||
}
|
}
|
||||||
''
|
''
|
||||||
ensureDir $out/nix-support
|
ensureDir $out/nix-support
|
||||||
@ -40,6 +43,8 @@ let
|
|||||||
|
|
||||||
jobs = rec {
|
jobs = rec {
|
||||||
|
|
||||||
|
inherit makeIso; # used by tests/test-nixos-install-from-cd/
|
||||||
|
|
||||||
|
|
||||||
tarball =
|
tarball =
|
||||||
{ nixosSrc ? {outPath = ./.; rev = 1234;}
|
{ nixosSrc ? {outPath = ./.; rev = 1234;}
|
||||||
@ -90,11 +95,6 @@ let
|
|||||||
description = "minimal";
|
description = "minimal";
|
||||||
};
|
};
|
||||||
|
|
||||||
iso_minimal_test_insecure = makeIso {
|
|
||||||
module = ./modules/installer/cd-dvd/installation-cd-minimal-test-insecure.nix;
|
|
||||||
description = "minimal-testing-only";
|
|
||||||
};
|
|
||||||
|
|
||||||
iso_minimal_fresh_kernel = makeIso {
|
iso_minimal_fresh_kernel = makeIso {
|
||||||
module = ./modules/installer/cd-dvd/installation-cd-minimal-fresh-kernel.nix;
|
module = ./modules/installer/cd-dvd/installation-cd-minimal-fresh-kernel.nix;
|
||||||
description = "minimal with 2.6.31-zen-branch";
|
description = "minimal with 2.6.31-zen-branch";
|
||||||
@ -113,6 +113,9 @@ let
|
|||||||
description = "graphical";
|
description = "graphical";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Hacky: doesn't depend on configuration. Yet configuration is evaluated (TODO)
|
||||||
|
minimal_install_archive = {system ? "i686-linux"}: (iso_minimal {inherit system;})
|
||||||
|
.config.system.build.minimalInstallArchive;
|
||||||
|
|
||||||
tests.subversion =
|
tests.subversion =
|
||||||
{ services ? ../services }:
|
{ services ? ../services }:
|
||||||
@ -138,6 +141,18 @@ let
|
|||||||
system = "i686-linux";
|
system = "i686-linux";
|
||||||
}).test;
|
}).test;
|
||||||
|
|
||||||
|
### tests about installing NixOS
|
||||||
|
|
||||||
|
# installs NixOs in a qemu_kvm instance using a tweaked iso.
|
||||||
|
tests.nixosInstallation =
|
||||||
|
(import ./tests/test-nixos-install-from-cd/test.nix {
|
||||||
|
inherit nixpkgs;
|
||||||
|
}).test;
|
||||||
|
|
||||||
|
# the archive installer can't be tested without chroot which requires being root
|
||||||
|
# options: run in kvm or uml ?
|
||||||
|
# TODO
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
26
tests/test-nixos-install-from-cd/configuration-iso.nix
Normal file
26
tests/test-nixos-install-from-cd/configuration-iso.nix
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# configuration used to build ISO used to install NixOS when running NixOS kvm installation test
|
||||||
|
|
||||||
|
# The configuration is prebuild before starting the vm because starting the vm
|
||||||
|
# causes some overhead.
|
||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
doOverride = pkgs.lib.mkOverride 0 {};
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
# make system boot and accessible:
|
||||||
|
require = [ ./module-insecure.nix
|
||||||
|
../../modules/installer/cd-dvd/installation-cd-minimal.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
fonts = {
|
||||||
|
enableFontConfig = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.loader.grub.timeout = doOverride 0;
|
||||||
|
boot.loader.grub.default = 2;
|
||||||
|
boot.loader.grub.version = doOverride 2;
|
||||||
|
|
||||||
|
}
|
@ -1,10 +1,10 @@
|
|||||||
# this is the configuration which will be installed.
|
# configuration being installed by NixOS kvm installation test
|
||||||
# The configuration is prebuild before starting the vm because starting the vm
|
|
||||||
# causes some overhead.
|
|
||||||
{pkgs, config, ...}: {
|
{pkgs, config, ...}: {
|
||||||
|
|
||||||
# make system boot and accessible:
|
# make system boot and accessible:
|
||||||
require = [ ./installation-cd-minimal-test-insecure.nix ];
|
require = [
|
||||||
|
./module-insecure.nix
|
||||||
|
];
|
||||||
|
|
||||||
boot.loader.grub = {
|
boot.loader.grub = {
|
||||||
device = "/dev/sda";
|
device = "/dev/sda";
|
||||||
@ -19,6 +19,8 @@
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
swapDevices = [ { device = "/dev/sda2"; } ];
|
||||||
|
|
||||||
fonts = {
|
fonts = {
|
||||||
enableFontConfig = false;
|
enableFontConfig = false;
|
||||||
};
|
};
|
@ -1,33 +1,29 @@
|
|||||||
# See installation-cd-minimal.nix
|
# this allows logging in as root without password.
|
||||||
# it's called insecure because it allows logging in as root without password
|
|
||||||
# So don't boot this cdrom to install your system :-)
|
|
||||||
|
|
||||||
{config, pkgs, ...}:
|
# This module is shared by the iso configuration and the system configuration
|
||||||
|
# which is build by the test
|
||||||
|
|
||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
let
|
let
|
||||||
doOverride = pkgs.lib.mkOverride 0 {};
|
doOverride = pkgs.lib.mkOverride 0 {};
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
require = [ ./installation-cd-minimal.nix ];
|
|
||||||
|
|
||||||
installer.configModule = "./nixos/modules/installer/cd-dvd/installation-cd-minimal-test-insecure";
|
services.sshd = {
|
||||||
|
enable = true;
|
||||||
services.sshd.permitRootLogin = "yes";
|
permitRootLogin = "yes";
|
||||||
|
};
|
||||||
jobs.sshd = {
|
jobs.sshd = {
|
||||||
startOn = doOverride "started network-interfaces";
|
startOn = doOverride "started network-interfaces";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
boot.initrd.kernelModules =
|
boot.initrd.kernelModules =
|
||||||
["cifs" "virtio_net" "virtio_pci" "virtio_blk" "virtio_balloon" "nls_utf8"];
|
["cifs" "virtio_net" "virtio_pci" "virtio_blk" "virtio_balloon" "nls_utf8"];
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.vim_configurable ];
|
environment.systemPackages = [ pkgs.vim_configurable ];
|
||||||
|
|
||||||
boot.loader.grub.timeout = doOverride 0;
|
|
||||||
boot.loader.grub.default = 2;
|
|
||||||
boot.loader.grub.version = doOverride 2;
|
|
||||||
|
|
||||||
# FIXME: rewrite pam.services the to be an attr list
|
# FIXME: rewrite pam.services the to be an attr list
|
||||||
# I only want to override sshd
|
# I only want to override sshd
|
||||||
security.pam.services = doOverride
|
security.pam.services = doOverride
|
||||||
@ -52,4 +48,3 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,8 +1,7 @@
|
|||||||
{ nixos ? ./..
|
{ nixos ? ../..
|
||||||
, nixpkgs ? ../../nixpkgs
|
, nixpkgs ? ../../../nixpkgs
|
||||||
, services ? ../../nixos/services
|
, services ? ../../../nixos/services
|
||||||
, system ? builtins.currentSystem
|
, system ? builtins.currentSystem
|
||||||
, configPath ? ./test-nixos-install-from-cd.nix
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -21,22 +20,30 @@ let
|
|||||||
nixosTarball = makeTarball "nixos.tar.bz2" (cleanSource ../../..);
|
nixosTarball = makeTarball "nixos.tar.bz2" (cleanSource ../../..);
|
||||||
nixpkgsTarball = makeTarball "nixpkgs.tar.bz2" (cleanSource pkgs.path);
|
nixpkgsTarball = makeTarball "nixpkgs.tar.bz2" (cleanSource pkgs.path);
|
||||||
|
|
||||||
|
If test fails at "waiting for socket" rerun the test
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
isos = (import ../release.nix) { inherit nixpkgs; };
|
configuration_iso = ./configuration-iso.nix;
|
||||||
|
configuration_install = ./configuration.nix;
|
||||||
|
|
||||||
isoFile =
|
release = (import ../../release.nix) { inherit nixpkgs; };
|
||||||
# passed system = systom of iso
|
|
||||||
(isos.iso_minimal_test_insecure { inherit system; }).iso;
|
|
||||||
|
|
||||||
configuration = ../modules/installer/cd-dvd/test-nixos-install-from-cd-config.nix;
|
isoFile = (
|
||||||
|
release.makeIso
|
||||||
|
{
|
||||||
|
module = configuration_iso;
|
||||||
|
description = "minimal-testing-only";
|
||||||
|
maintainers = ["MarcWeber"];
|
||||||
|
}
|
||||||
|
{ inherit system; }
|
||||||
|
).iso;
|
||||||
|
|
||||||
eval = import ../lib/eval-config.nix {
|
eval = import ../../lib/eval-config.nix {
|
||||||
inherit system nixpkgs;
|
inherit system nixpkgs;
|
||||||
modules = [ configuration ];
|
modules = [ configuration_install ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
inherit (eval) pkgs config;
|
inherit (eval) pkgs config;
|
||||||
|
|
||||||
inherit (pkgs) qemu_kvm;
|
inherit (pkgs) qemu_kvm;
|
||||||
@ -57,9 +64,13 @@ rec {
|
|||||||
# FIXME: X shouldn't be required
|
# FIXME: X shouldn't be required
|
||||||
# Is there a way to use kvm when not running as root?
|
# Is there a way to use kvm when not running as root?
|
||||||
# Would using uml provide any advantages?
|
# Would using uml provide any advantages?
|
||||||
|
|
||||||
|
# TODO add nix-env -i command and verify that root can install additional
|
||||||
|
# tools such as git or sshfs-fuse!
|
||||||
|
# run this test when booting both: the iso and the installed system
|
||||||
pkgs.runCommand "nixos-installation-test" { inherit systemDerivation; } ''
|
pkgs.runCommand "nixos-installation-test" { inherit systemDerivation; } ''
|
||||||
|
|
||||||
INFO(){ echo $@; }
|
INFO(){ echo "INFO: " $@; }
|
||||||
|
|
||||||
die(){ echo $@; exit 1; }
|
die(){ echo $@; exit 1; }
|
||||||
|
|
||||||
@ -86,7 +97,7 @@ rec {
|
|||||||
cat >> run-kvm.sh << EOF
|
cat >> run-kvm.sh << EOF
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
# maybe swap should be used ?
|
# maybe swap should be used ?
|
||||||
exec qemu-system-x86_64 -m 2048 \
|
exec qemu-system-x86_64 -m 512 \
|
||||||
-no-kvm-irqchip \
|
-no-kvm-irqchip \
|
||||||
-net nic,model=virtio -net user -smb /nix \
|
-net nic,model=virtio -net user -smb /nix \
|
||||||
-hda image \
|
-hda image \
|
||||||
@ -135,7 +146,10 @@ rec {
|
|||||||
|
|
||||||
|
|
||||||
INFO "creating image file"
|
INFO "creating image file"
|
||||||
qemu-img create -f qcow2 image 2G
|
# 2GB = data; 1GB=swap
|
||||||
|
# Maybe using 1GB swap is much. But qcow2 doesn't fill holes so it only
|
||||||
|
# used when required (?)
|
||||||
|
qemu-img create -f qcow2 image 3G
|
||||||
|
|
||||||
RUN_KVM -boot d -cdrom $(echo ${isoFile}/iso/*.iso)
|
RUN_KVM -boot d -cdrom $(echo ${isoFile}/iso/*.iso)
|
||||||
|
|
||||||
@ -144,13 +158,22 @@ rec {
|
|||||||
# INSTALLATION
|
# INSTALLATION
|
||||||
INFO "creating filesystem .."
|
INFO "creating filesystem .."
|
||||||
SSH_STDIN_E << EOF
|
SSH_STDIN_E << EOF
|
||||||
|
set -x
|
||||||
parted /dev/sda mklabel msdos
|
parted /dev/sda mklabel msdos
|
||||||
parted /dev/sda mkpart primary 0 2G
|
parted /dev/sda mkpart primary 0 2G
|
||||||
while [ ! -e /dev/sda1 ]; do
|
parted /dev/sda mkpart primary 1G 3G
|
||||||
echo "waiting for /dev/sda1 to appear"
|
waitFor(){
|
||||||
sleep 1;
|
while [ ! -e "\$1" ]; do
|
||||||
done
|
echo "waiting for \$1 to appear"; sleep 1;
|
||||||
|
done
|
||||||
|
}
|
||||||
|
waitFor /dev/sda2
|
||||||
|
mkswap /dev/sda2
|
||||||
|
swapon /dev/sda2
|
||||||
|
|
||||||
|
waitFor /dev/sda1
|
||||||
mkfs.ext3 /dev/sda1
|
mkfs.ext3 /dev/sda1
|
||||||
|
|
||||||
mount /dev/sda1 /mnt
|
mount /dev/sda1 /mnt
|
||||||
mkdir -p /mnt/nix-on-host
|
mkdir -p /mnt/nix-on-host
|
||||||
mount //10.0.2.4/qemu -oguest,username=nobody,noperm -tcifs /mnt/nix-on-host
|
mount //10.0.2.4/qemu -oguest,username=nobody,noperm -tcifs /mnt/nix-on-host
|
||||||
@ -162,7 +185,7 @@ rec {
|
|||||||
nixos-hardware-scan > /tmp/test.nix
|
nixos-hardware-scan > /tmp/test.nix
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
INFO "copying sources and Nix, preparing configuration, starting installation"
|
INFO "copying sources and Nix, starting installation"
|
||||||
SSH_STDIN_E << EOF
|
SSH_STDIN_E << EOF
|
||||||
|
|
||||||
nixos-prepare-install
|
nixos-prepare-install
|
||||||
@ -170,12 +193,11 @@ rec {
|
|||||||
# has the generated configuration.nix file syntax errors?
|
# has the generated configuration.nix file syntax errors?
|
||||||
nix-instantiate --eval-only /tmp/test.nix
|
nix-instantiate --eval-only /tmp/test.nix
|
||||||
|
|
||||||
# NixOS sources are in /etc/nixos, copy those configuration files.
|
echo 'export NIXOS_CONFIG=/etc/nixos/nixos/tests/test-nixos-install-from-cd/configuration.nix' >> /root/.bashrc
|
||||||
cp /etc/nixos/nixos/modules/installer/cd-dvd/test-nixos-install-from-cd-config.nix /mnt/etc/nixos/configuration.nix
|
. ~/.bashrc
|
||||||
# the configuration file is referencing additional files:
|
|
||||||
cp -r /etc/nixos/nixos/modules/installer/cd-dvd/*.nix /mnt/etc/nixos/
|
|
||||||
export NIX_OTHER_STORES=/nix-on-host
|
export NIX_OTHER_STORES=/nix-on-host
|
||||||
run-in-chroot "/nix/store/nixos-bootstrap --install"
|
|
||||||
|
run-in-chroot "/nix/store/nixos-bootstrap --install --no-pull"
|
||||||
#nixos-install
|
#nixos-install
|
||||||
EOF
|
EOF
|
||||||
|
|
@ -18,8 +18,8 @@ let
|
|||||||
|
|
||||||
isos = (import ../release.nix) { inherit nixpkgs; };
|
isos = (import ../release.nix) { inherit nixpkgs; };
|
||||||
|
|
||||||
# using same configuration as ased by kvm test.
|
# using same configuration as used by kvm test.
|
||||||
configuration = ../modules/installer/cd-dvd/test-nixos-install-from-cd-config.nix;
|
configuration = ./test-nixos-install-from-cd/configuration.nix;
|
||||||
|
|
||||||
eval = import ../lib/eval-config.nix {
|
eval = import ../lib/eval-config.nix {
|
||||||
inherit system nixpkgs;
|
inherit system nixpkgs;
|
||||||
|
Loading…
Reference in New Issue
Block a user