mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-15 10:12:58 +00:00
42f1b5c6db
machine # warning: error: unable to download 'https://ftpmirror.gnu.org/bash/bash-5.2.tar.gz': Couldn't resolve host name (6); retrying in 329 ms machine # warning: error: unable to download 'https://ftpmirror.gnu.org/bash/bash-5.2.tar.gz': Couldn't resolve host name (6); retrying in 530 ms machine # warning: error: unable to download 'https://ftpmirror.gnu.org/bash/bash-5.2.tar.gz': Couldn't resolve host name (6); retrying in 1066 ms machine # warning: error: unable to download 'https://ftpmirror.gnu.org/bash/bash-5.2.tar.gz': Couldn't resolve host name (6); retrying in 2544 ms machine # [ 1283.199545] GUEST-test1[1465]: [ 414.478221] stage-1-init: [Wed Aug 23 13:26:29 UTC 2023] + loadkmap machine # error: machine # … writing file '/nix/store/v28dv6l0qk3j382kp40bksa1v6h7dx9p-bash-5.2.tar.gz' machine # machine # error: unable to download 'https://ftpmirror.gnu.org/bash/bash-5.2.tar.gz': Couldn't resolve host name (6) machine # error: builder for '/nix/store/5jrd75v747s76s16zxk59384xfcjqn58-bash-5.2.tar.gz.drv' failed with exit code 1 machine # error: 1 dependencies of derivation '/nix/store/0cgj4m2h51hjhmz5h4440pd73kv5lm5v-bash-5.2-p15.drv' failed to build machine # error: 1 dependencies of derivation '/nix/store/d2x66i0dfv9w81gl1w3nbkn0nz7mawaz-bash-5.2-p15.drv' failed to build machine # error: 1 dependencies of derivation '/nix/store/lcz1v3h1nsbyz2fp7xkp113jvyjqq0sx-bash-5.2-p15.drv' failed to build machine # building '/nix/store/20d5pi1a5i9jj041i0gvr9zcs7bjbw46-binutils-2.40.tar.bz2.drv'... machine # error: 1 dependencies of derivation '/nix/store/zb0ykvcllgc8l9ki38fdv9n8xp3rnphb-gcc-12.3.0.drv' failed to build machine # error: 1 dependencies of derivation '/nix/store/7kxjnzmc79sickp7hiyp8v169idyw8f2-gettext-0.21.1.drv' failed to build machine # error: 1 dependencies of derivation '/nix/store/wp7hpglhgwljl3fsfyx8caaakh4a1r72-xgcc-12.3.0.drv' failed to build machine # error: 1 dependencies of derivation '/nix/store/f7glbcn7n59k22b911bx1vyy13g4bdxh-binutils-2.40.drv' failed to build machine # error: 1 dependencies of derivation '/nix/store/q7yvprjmnqprx743ikkcz4kqx2mjdas4-binutils-wrapper-2.40.drv' failed to build machine # building '/nix/store/vks3aqqal1rjvrsbj61nl1yh7r5shhdh-builder.pl.drv'... machine # error: 1 dependencies of derivation '/nix/store/qmdff14r0l31mzx8al7h1kp9h5pck5wr-extra-utils.drv' failed to build machine # error: 1 dependencies of derivation '/nix/store/rdlk4188b2jp4ac38w94qazdaxk6sga9-stage-1-init.sh.drv' failed to build machine # error: 1 dependencies of derivation '/nix/store/rq15acvd6hcr52a5dlmk1p7mlyzjack0-initrd-linux-6.1.46.drv' failed to build machine # error: 1 dependencies of derivation '/nix/store/h1rch2zqjacijnn0szq2hgwmd6v1r1ld-nixos-system-nixos-23.11pre-git.drv' failed to build
134 lines
3.8 KiB
Nix
134 lines
3.8 KiB
Nix
import ./make-test-python.nix ({pkgs, lib, ...}:
|
|
let
|
|
# A filesystem image with a (presumably) bootable debian
|
|
debianImage = pkgs.vmTools.diskImageFuns.debian11i386 {
|
|
# os-prober cannot detect systems installed on disks without a partition table
|
|
# so we create the disk ourselves
|
|
createRootFS = with pkgs; ''
|
|
${parted}/bin/parted --script /dev/vda mklabel msdos
|
|
${parted}/sbin/parted --script /dev/vda -- mkpart primary ext2 1M -1s
|
|
mkdir /mnt
|
|
${e2fsprogs}/bin/mkfs.ext4 -O '^metadata_csum_seed' /dev/vda1
|
|
${util-linux}/bin/mount -t ext4 /dev/vda1 /mnt
|
|
|
|
if test -e /mnt/.debug; then
|
|
exec ${bash}/bin/sh
|
|
fi
|
|
touch /mnt/.debug
|
|
|
|
mkdir /mnt/proc /mnt/dev /mnt/sys
|
|
'';
|
|
extraPackages = [
|
|
# /etc/os-release
|
|
"base-files"
|
|
# make the disk bootable-looking
|
|
"grub2" "linux-image-686"
|
|
];
|
|
# install grub
|
|
postInstall = ''
|
|
ln -sf /proc/self/mounts > /etc/mtab
|
|
PATH=/usr/bin:/bin:/usr/sbin:/sbin $chroot /mnt \
|
|
grub-install /dev/vda --force
|
|
PATH=/usr/bin:/bin:/usr/sbin:/sbin $chroot /mnt \
|
|
update-grub
|
|
'';
|
|
};
|
|
|
|
# a part of the configuration of the test vm
|
|
simpleConfig = {
|
|
boot.loader.grub = {
|
|
enable = true;
|
|
useOSProber = true;
|
|
device = "/dev/vda";
|
|
# vda is a filesystem without partition table
|
|
forceInstall = true;
|
|
};
|
|
nix.settings = {
|
|
substituters = lib.mkForce [];
|
|
hashed-mirrors = null;
|
|
connect-timeout = 1;
|
|
};
|
|
# save some memory
|
|
documentation.enable = false;
|
|
};
|
|
# /etc/nixos/configuration.nix for the vm
|
|
configFile = pkgs.writeText "configuration.nix" ''
|
|
{config, pkgs, lib, ...}: ({
|
|
imports =
|
|
[ ./hardware-configuration.nix
|
|
<nixpkgs/nixos/modules/testing/test-instrumentation.nix>
|
|
];
|
|
} // lib.importJSON ${
|
|
pkgs.writeText "simpleConfig.json" (builtins.toJSON simpleConfig)
|
|
})
|
|
'';
|
|
in {
|
|
name = "os-prober";
|
|
|
|
nodes.machine = { config, pkgs, ... }: (simpleConfig // {
|
|
imports = [ ../modules/profiles/installation-device.nix
|
|
../modules/profiles/base.nix ];
|
|
virtualisation.memorySize = 1300;
|
|
# To add the secondary disk:
|
|
virtualisation.qemu.options = [ "-drive index=2,file=${debianImage}/disk-image.qcow2,read-only,if=virtio" ];
|
|
|
|
# The test cannot access the network, so any packages
|
|
# nixos-rebuild needs must be included in the VM.
|
|
system.extraDependencies = with pkgs;
|
|
[
|
|
bintools
|
|
brotli
|
|
brotli.dev
|
|
brotli.lib
|
|
desktop-file-utils
|
|
docbook5
|
|
docbook_xsl_ns
|
|
grub2
|
|
kbd
|
|
kbd.dev
|
|
kmod.dev
|
|
libarchive
|
|
libarchive.dev
|
|
libxml2.bin
|
|
libxslt.bin
|
|
nixos-artwork.wallpapers.simple-dark-gray-bottom
|
|
ntp
|
|
perlPackages.ListCompare
|
|
perlPackages.XMLLibXML
|
|
python3Minimal
|
|
shared-mime-info
|
|
stdenv
|
|
sudo
|
|
texinfo
|
|
unionfs-fuse
|
|
xorg.lndir
|
|
|
|
# add curl so that rather than seeing the test attempt to download
|
|
# curl's tarball, we see what it's trying to download
|
|
curl
|
|
];
|
|
});
|
|
|
|
testScript = ''
|
|
machine.start()
|
|
machine.succeed("udevadm settle")
|
|
machine.wait_for_unit("multi-user.target")
|
|
print(machine.succeed("lsblk"))
|
|
|
|
# check that os-prober works standalone
|
|
machine.succeed(
|
|
"${pkgs.os-prober}/bin/os-prober | grep /dev/vdb1"
|
|
)
|
|
|
|
# rebuild and test that debian is available in the grub menu
|
|
machine.succeed("nixos-generate-config")
|
|
machine.copy_from_host(
|
|
"${configFile}",
|
|
"/etc/nixos/configuration.nix",
|
|
)
|
|
machine.succeed("nixos-rebuild boot --show-trace >&2")
|
|
|
|
machine.succeed("egrep 'menuentry.*debian' /boot/grub/grub.cfg")
|
|
'';
|
|
})
|