about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/backup/borgmatic/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-04-09 18:28:16 +0000
committerAlyssa Ross <hi@alyssa.is>2021-04-12 18:46:15 +0000
commitfd2e737e0678ee7d8081baef05b305146a2c0034 (patch)
treeac3e9b27576a0382335532d126f9a66d486bc638 /nixpkgs/pkgs/tools/backup/borgmatic/default.nix
parentcc207d720b6aa836e256c1ee9842bc739e630a8a (diff)
parent9e377a6ce42dccd9b624ae4ce8f978dc892ba0e2 (diff)
downloadnixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar
nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.gz
nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.bz2
nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.lz
nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.xz
nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.zst
nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.zip
Merge remote-tracking branch 'nixpkgs/nixos-unstable'
Diffstat (limited to 'nixpkgs/pkgs/tools/backup/borgmatic/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/backup/borgmatic/default.nix50
1 files changed, 50 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/backup/borgmatic/default.nix b/nixpkgs/pkgs/tools/backup/borgmatic/default.nix
new file mode 100644
index 000000000000..4913ca29cb84
--- /dev/null
+++ b/nixpkgs/pkgs/tools/backup/borgmatic/default.nix
@@ -0,0 +1,50 @@
+{ borgbackup, coreutils, lib, python3Packages, systemd }:
+
+python3Packages.buildPythonApplication rec {
+  pname = "borgmatic";
+  version = "1.5.12";
+
+  src = python3Packages.fetchPypi {
+    inherit pname version;
+    sha256 = "sha256-XLbBJvNRmH8W9SnOjF7zUbazRYFCMW6SEO2wKN/2VTY=";
+  };
+
+  checkInputs = with python3Packages; [ flexmock pytestCheckHook pytest-cov ];
+
+  # - test_borgmatic_version_matches_news_version
+  # The file NEWS not available on the pypi source, and this test is useless
+  # - test_collect_configuration_run_summary_logs_outputs_merged_json_results
+  # Upstream fixed in the next version, see
+  # https://github.com/witten/borgmatic/commit/ea6cd53067435365a96786b006aec391714501c4
+  disabledTests = [
+    "test_borgmatic_version_matches_news_version"
+    "test_collect_configuration_run_summary_logs_outputs_merged_json_results"
+  ];
+
+  propagatedBuildInputs = with python3Packages; [
+    borgbackup
+    colorama
+    pykwalify
+    ruamel_yaml
+    requests
+    setuptools
+  ];
+
+  postInstall = ''
+    mkdir -p $out/lib/systemd/system
+    cp sample/systemd/borgmatic.timer $out/lib/systemd/system/
+    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
+  '';
+
+  meta = with lib; {
+    description = "Simple, configuration-driven backup software for servers and workstations";
+    homepage = "https://torsion.org/borgmatic/";
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ imlonghao ];
+  };
+}