andi- | One of the examples in the gitignore manpage:
• If there is a separator at the end of the pattern then the pattern will only match
directories, otherwise the pattern can match both files and directories.
Compare that to this example from the GitHub docs:
# In this example, @octocat owns any file in an apps directory
# anywhere in your repository.
apps/ @octocat
| 15:38:14 |
David Arnold (blaggacao) | def assemble_qemu_flags():
flags = "-cpu max"
flags += " -m 1024"
return flags
qemu_flags = {"qemuFlags": assemble_qemu_flags()}
hd_flags = {
"hdaInterface": "virtio",
"hda": "vm-state-machine/machine.qcow2",
}
default_flags = {**hd_flags, **qemu_flags}
def create_machine_named(name):
return create_machine({**default_flags, "name": name})
machine.start()
with subtest("Assert readiness of login prompt"):
machine.succeed("echo hello")
with subtest("Wait for hard disks to appear in /dev"):
machine.succeed("udevadm settle")
machine.succeed(
"sgdisk -Z /dev/vda",
"sgdisk -n 1:0:+1M -n 2:0:+1G -N 3 -t 1:ef02 -t 2:8200 -t 3:8300 -c 3:root /dev/vda",
"mkswap /dev/vda2 -L swap",
"swapon -L swap",
"mkfs.btrfs -L root /dev/vda3",
"btrfs device scan",
"mount LABEL=root /mnt",
"btrfs subvol create /mnt/boot",
"btrfs subvol create /mnt/nixos",
"btrfs subvol create /mnt/nixos/default",
"umount /mnt",
"mount -o defaults,subvol=nixos/default LABEL=root /mnt",
"mkdir /mnt/boot",
"mount -o defaults,subvol=boot LABEL=root /mnt/boot",
)
with subtest("Create the NixOS configuration"):
machine.succeed("nixos-generate-config --root /mnt")
machine.succeed("cat /mnt/etc/nixos/hardware-configuration.nix >&2")
machine.copy_from_host(
"/nix/store/jmypyz7q2ffcqg0dfa9xydz4wap04wsp-configuration.nix",
"/mnt/etc/nixos/configuration.nix",
)
with subtest("Perform the installation"):
machine.succeed("nixos-install < /dev/null >&2")
with subtest("Do it again to make sure it's idempotent"):
machine.succeed("nixos-install < /dev/null >&2")
with subtest("Shutdown system after installation"):
machine.succeed("umount /mnt/boot || true")
machine.succeed("umount /mnt")
machine.succeed("sync")
machine.shutdown()
# Now see if we can boot the installation.
machine = create_machine_named("boot-after-install")
# For example to enter LUKS passphrase.
with subtest("Assert that /boot get mounted"):
machine.wait_for_unit("local-fs.target")
machine.succeed("test -e /boot/grub")
with subtest("Check whether /root has correct permissions"):
assert "700" in machine.succeed("stat -c '%a' /root")
with subtest("Assert swap device got activated"):
# uncomment once https://bugs.freedesktop.org/show_bug.cgi?id=86930 is resolved
machine.wait_for_unit("swap.target")
machine.succeed("cat /proc/swaps | grep -q /dev")
with subtest("Check that the store is in good shape"):
machine.succeed("nix-store --verify --check-contents >&2")
with subtest("Check whether the channel works"):
machine.succeed("nix-env -iA nixos.procps >&2")
assert ".nix-profile" in machine.succeed("type -tP ps | tee /dev/stderr")
with subtest(
"Check that the daemon works, and that non-root users can run builds "
"(this will build a new profile generation through the daemon)"
):
machine.succeed("su alice -l -c 'nix-env -iA nixos.procps' >&2")
with subtest("Configure system with writable Nix store on next boot"):
# we're not using copy_from_host here because the installer image
# doesn't know about the host-guest sharing mechanism.
machine.copy_from_host_via_shell(
"/nix/store/6jcfa0im2sjsyhzbqgz51w6hwqhgd7x4-configuration.nix",
"/etc/nixos/configuration.nix",
)
with subtest("Check whether nixos-rebuild works"):
machine.succeed("nixos-rebuild switch >&2")
with subtest("Test nixos-option"):
kernel_modules = machine.succeed("nixos-option boot.initrd.kernelModules")
assert "virtio_console" in kernel_modules
assert "List of modules" in kernel_modules
assert "qemu-guest.nix" in kernel_modules
machine.shutdown()
# Check whether a writable store build works
machine = create_machine_named("rebuild-switch")
machine.wait_for_unit("multi-user.target")
# we're not using copy_from_host here because the installer image
# doesn't know about the host-guest sharing mechanism.
machine.copy_from_host_via_shell(
"/nix/store/v25vc36mamldkz4f067nyfy1z15r12g1-configuration.nix",
"/etc/nixos/configuration.nix",
)
machine.succeed("nixos-rebuild boot >&2")
machine.shutdown()
# And just to be sure, check that the machine still boots after
# "nixos-rebuild switch".
machine = create_machine_named("boot-after-rebuild-switch")
machine.wait_for_unit("network.target")
machine.shutdown()
# Tests for validating clone configuration entries in grub menu
| 18:50:37 |