1{ borgbackup, coreutils, lib, python3Packages, systemd, installShellFiles, borgmatic, testers }:
2
3python3Packages.buildPythonApplication rec {
4 pname = "borgmatic";
5 version = "1.7.2";
6
7 src = python3Packages.fetchPypi {
8 inherit pname version;
9 sha256 = "sha256-0o2tKg7BfhkNt/k8XdZ1agaSJxKO5OxB5aaRgV9IPeU=";
10 };
11
12 checkInputs = with python3Packages; [ flexmock pytestCheckHook pytest-cov ];
13
14 # - test_borgmatic_version_matches_news_version
15 # The file NEWS not available on the pypi source, and this test is useless
16 disabledTests = [
17 "test_borgmatic_version_matches_news_version"
18 ];
19
20 nativeBuildInputs = [ installShellFiles ];
21
22 propagatedBuildInputs = with python3Packages; [
23 borgbackup
24 colorama
25 jsonschema
26 ruamel-yaml
27 requests
28 setuptools
29 ];
30
31 postInstall = ''
32 installShellCompletion --cmd borgmatic \
33 --bash <($out/bin/borgmatic --bash-completion)
34
35 mkdir -p $out/lib/systemd/system
36 cp sample/systemd/borgmatic.timer $out/lib/systemd/system/
37 substitute sample/systemd/borgmatic.service \
38 $out/lib/systemd/system/borgmatic.service \
39 --replace /root/.local/bin/borgmatic $out/bin/borgmatic \
40 --replace systemd-inhibit ${systemd}/bin/systemd-inhibit \
41 --replace sleep ${coreutils}/bin/sleep
42 '';
43
44 passthru.tests.version = testers.testVersion { package = borgmatic; };
45
46 meta = with lib; {
47 description = "Simple, configuration-driven backup software for servers and workstations";
48 homepage = "https://torsion.org/borgmatic/";
49 license = licenses.gpl3Plus;
50 platforms = platforms.linux;
51 maintainers = with maintainers; [ imlonghao ];
52 };
53}