1 { system ? builtins.currentSystem,
3 pkgs ? import ../.. { inherit system config; }
6 with import ../lib/testing-python.nix { inherit system pkgs; };
10 # Hostname can also be set through "hostname" in user-data.
11 # This is how proxmox configures hostname through cloud-init.
12 metadataDrive = pkgs.stdenv.mkDerivation {
17 cat << EOF > $out/iso/user-data
19 hostname: testhostname
22 cat << EOF > $out/iso/meta-data
23 instance-id: iid-local02
26 ${pkgs.cdrkit}/bin/genisoimage -volid cidata -joliet -rock -o $out/metadata.iso $out/iso
31 name = "cloud-init-hostname";
32 meta = with pkgs.lib.maintainers; {
33 maintainers = [ lewo illustris ];
36 nodes.machine2 = { ... }: {
37 virtualisation.qemu.options = [ "-cdrom" "${metadataDrive}/metadata.iso" ];
38 services.cloud-init.enable = true;
39 networking.hostName = "";
43 unnamed.wait_for_unit("cloud-final.service")
44 assert "testhostname" in unnamed.succeed("hostname")