nixpkgs/pkgs/tools/backup/borgmatic/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

74 lines
2.1 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, borgbackup
, coreutils
, python3Packages
, fetchPypi
, systemd
, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, installShellFiles
, borgmatic
, testers
}:
2021-02-17 05:49:52 +01:00
python3Packages.buildPythonApplication rec {
pname = "borgmatic";
2024-04-18 09:02:49 +02:00
version = "1.8.10";
2021-02-17 05:49:52 +01:00
src = fetchPypi {
2021-02-17 05:49:52 +01:00
inherit pname version;
2024-04-18 09:02:49 +02:00
sha256 = "sha256-hR2q49gCD9BZsk+jQ90EfKkkq7mX9qAO+gRsvdnuDec=";
2021-02-17 05:49:52 +01:00
};
2023-10-29 02:24:40 +01:00
nativeCheckInputs = with python3Packages; [ flexmock pytestCheckHook pytest-cov ] ++ passthru.optional-dependencies.apprise;
2021-02-17 05:49:52 +01:00
# - test_borgmatic_version_matches_news_version
# The file NEWS not available on the pypi source, and this test is useless
disabledTests = [
"test_borgmatic_version_matches_news_version"
];
nativeBuildInputs = [ installShellFiles ];
2021-02-17 05:49:52 +01:00
propagatedBuildInputs = with python3Packages; [
borgbackup
colorama
2021-09-10 17:34:56 +02:00
jsonschema
2023-07-11 16:27:48 +02:00
packaging
ruamel-yaml
2021-02-17 05:49:52 +01:00
requests
setuptools
];
2023-10-29 02:24:40 +01:00
passthru.optional-dependencies = {
apprise = with python3Packages; [ apprise ];
};
2021-02-17 05:49:52 +01:00
postInstall = ''
installShellCompletion --cmd borgmatic \
--bash <($out/bin/borgmatic --bash-completion)
'' + lib.optionalString enableSystemd ''
2021-02-17 05:49:52 +01:00
mkdir -p $out/lib/systemd/system
cp sample/systemd/borgmatic.timer $out/lib/systemd/system/
# there is another "sleep", so choose the one with the space after it
# due to https://github.com/borgmatic-collective/borgmatic/commit/2e9f70d49647d47fb4ca05f428c592b0e4319544
2021-02-17 05:49:52 +01:00
substitute sample/systemd/borgmatic.service \
$out/lib/systemd/system/borgmatic.service \
--replace /root/.local/bin/borgmatic $out/bin/borgmatic \
--replace systemd-inhibit ${systemd}/bin/systemd-inhibit \
--replace "sleep " "${coreutils}/bin/sleep "
2021-02-17 05:49:52 +01:00
'';
2022-09-11 20:16:48 +02:00
passthru.tests.version = testers.testVersion { package = borgmatic; };
2023-07-14 18:12:14 +02:00
__darwinAllowLocalNetworking = true;
2021-02-17 05:49:52 +01:00
meta = with lib; {
description = "Simple, configuration-driven backup software for servers and workstations";
homepage = "https://torsion.org/borgmatic/";
license = licenses.gpl3Plus;
2023-07-14 18:12:14 +02:00
platforms = platforms.all;
2021-02-17 05:49:52 +01:00
maintainers = with maintainers; [ imlonghao ];
};
}