1 import ./make-test-python.nix ({ ... }:
5 nodes.machine = { pkgs, lib, ... }: {
6 boot.initrd.postDeviceCommands = ''
7 ${pkgs.btrfs-progs}/bin/mkfs.btrfs -f -L aux /dev/vdb
10 virtualisation.emptyDiskImages = [ 4096 ];
12 virtualisation.fileSystems = {
14 device = "/dev/disk/by-label/aux";
18 services.snapper.configs.home.SUBVOLUME = "/home";
19 services.snapper.filters = "/nix";
22 testScript = { nodes, ... }: let
23 inherit (nodes.machine.services.snapper) snapshotRootOnBoot;
25 machine.succeed("btrfs subvolume create /home/.snapshots")
26 machine.succeed("snapper -c home list")
27 machine.succeed("snapper -c home create --description empty")
28 machine.succeed("echo test > /home/file")
29 machine.succeed("snapper -c home create --description file")
30 machine.succeed("snapper -c home status 1..2")
31 machine.succeed("snapper -c home undochange 1..2")
32 machine.fail("ls /home/file")
33 machine.succeed("snapper -c home delete 2")
34 machine.succeed("systemctl --wait start snapper-timeline.service")
35 machine.succeed("systemctl --wait start snapper-cleanup.service")
36 machine.${if snapshotRootOnBoot then "succeed" else "fail"}("systemctl cat snapper-boot.service")