mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 03:17:13 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
66 lines
2 KiB
Nix
66 lines
2 KiB
Nix
import ../make-test-python.nix (
|
|
{ pkgs, lib, ... }:
|
|
|
|
let
|
|
releases = import ../../release.nix {
|
|
configuration = {
|
|
# Building documentation makes the test unnecessarily take a longer time:
|
|
documentation.enable = lib.mkForce false;
|
|
|
|
# Our tests require `grep` & friends:
|
|
environment.systemPackages = with pkgs; [ busybox ];
|
|
};
|
|
};
|
|
|
|
lxd-image-metadata = releases.lxdVirtualMachineImageMeta.${pkgs.stdenv.hostPlatform.system};
|
|
lxd-image-disk = releases.lxdVirtualMachineImage.${pkgs.stdenv.hostPlatform.system};
|
|
|
|
instance-name = "instance1";
|
|
in
|
|
{
|
|
name = "lxd-virtual-machine";
|
|
|
|
nodes.machine =
|
|
{ lib, ... }:
|
|
{
|
|
virtualisation = {
|
|
diskSize = 4096;
|
|
|
|
cores = 2;
|
|
|
|
# Ensure we have enough memory for the nested virtual machine
|
|
memorySize = 1024;
|
|
|
|
lxc.lxcfs.enable = true;
|
|
lxd.enable = true;
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
def instance_is_up(_) -> bool:
|
|
status, _ = machine.execute("lxc exec ${instance-name} --disable-stdin --force-interactive /run/current-system/sw/bin/true")
|
|
return status == 0
|
|
|
|
machine.wait_for_unit("sockets.target")
|
|
machine.wait_for_unit("lxd.service")
|
|
machine.wait_for_file("/var/lib/lxd/unix.socket")
|
|
|
|
# Wait for lxd to settle
|
|
machine.succeed("lxd waitready")
|
|
|
|
machine.succeed("lxd init --minimal")
|
|
|
|
with subtest("virtual-machine image can be imported"):
|
|
machine.succeed("lxc image import ${lxd-image-metadata}/*/*.tar.xz ${lxd-image-disk}/nixos.qcow2 --alias nixos")
|
|
|
|
with subtest("virtual-machine can be launched and become available"):
|
|
machine.succeed("lxc launch nixos ${instance-name} --vm --config limits.memory=512MB --config security.secureboot=false")
|
|
with machine.nested("Waiting for instance to start and be usable"):
|
|
retry(instance_is_up)
|
|
|
|
with subtest("lxd-agent is started"):
|
|
machine.succeed("lxc exec ${instance-name} systemctl is-active lxd-agent")
|
|
'';
|
|
}
|
|
)
|