clan-core/checks/borgbackup/default.nix

37 lines
1.1 KiB
Nix
Raw Normal View History

(import ../lib/container-test.nix) ({ ... }: {
name = "borgbackup";
nodes.machine = { self, ... }: {
imports = [
self.clanModules.borgbackup
self.nixosModules.clanCore
{
services.openssh.enable = true;
services.borgbackup.repos.testrepo = {
authorizedKeys = [
2023-12-16 21:52:01 +00:00
(builtins.readFile ../lib/ssh/pubkey)
];
};
}
{
clanCore.machineName = "machine";
clanCore.clanDir = ./.;
2023-12-04 16:05:37 +00:00
clanCore.state.testState.folders = [ "/etc/state" ];
environment.etc.state.text = "hello world";
clan.borgbackup = {
enable = true;
destinations.test = {
repo = "borg@localhost:.";
2023-12-16 21:52:01 +00:00
rsh = "ssh -i ${../lib/ssh/privkey} -o StrictHostKeyChecking=no";
};
};
}
];
};
testScript = ''
start_all()
machine.systemctl("start --wait borgbackup-job-test.service")
assert "machine-test" in machine.succeed("BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes /run/current-system/sw/bin/borg-job-test list")
'';
})