base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / bo / borgbackup / package.nix
blobe0c148108362a2d0e9f0f5107dc81c278ba191e9
1 { lib
2 , stdenv
3 , acl
4 , e2fsprogs
5 , fetchFromGitHub
6 , libb2
7 , lz4
8 , openssh
9 , openssl
10 , python3
11 , xxHash
12 , zstd
13 , installShellFiles
14 , nixosTests
17 let
18   python = python3;
20 python.pkgs.buildPythonApplication rec {
21   pname = "borgbackup";
22   version = "1.4.0";
23   pyproject = true;
25   src = fetchFromGitHub {
26     owner = "borgbackup";
27     repo = "borg";
28     rev = "refs/tags/${version}";
29     hash = "sha256-n1hCM7Sp0t2bOJEzErEd1PS/Xc7c+KDmJ4PjQuuF140=";
30   };
32   postPatch = ''
33     # sandbox does not support setuid/setgid/sticky bits
34     substituteInPlace src/borg/testsuite/archiver.py \
35       --replace-fail "0o4755" "0o0755"
36   '';
38   build-system = with python.pkgs; [
39     cython
40     setuptools-scm
41     pkgconfig
42   ];
44   nativeBuildInputs = with python.pkgs; [
45     # docs
46     sphinxHook
47     guzzle-sphinx-theme
49     # shell completions
50     installShellFiles
51   ];
53   sphinxBuilders = [ "singlehtml" "man" ];
55   buildInputs = [
56     libb2
57     lz4
58     xxHash
59     zstd
60     openssl
61   ] ++ lib.optionals stdenv.hostPlatform.isLinux [
62     acl
63   ];
65   dependencies = with python.pkgs; [
66     msgpack
67     packaging
68     (if stdenv.hostPlatform.isLinux then pyfuse3 else llfuse)
69   ];
71   makeWrapperArgs = [
72     ''--prefix PATH ':' "${openssh}/bin"''
73   ];
75   postInstall = ''
76     installShellCompletion --cmd borg \
77       --bash scripts/shell_completions/bash/borg \
78       --fish scripts/shell_completions/fish/borg.fish \
79       --zsh scripts/shell_completions/zsh/_borg
80   '';
82   nativeCheckInputs = with python.pkgs; [
83     e2fsprogs
84     py
85     pytest-benchmark
86     pytest-xdist
87     pytestCheckHook
88   ];
90   pytestFlagsArray = [
91     "--benchmark-skip"
92     "--pyargs" "borg.testsuite"
93   ];
95   disabledTests = [
96     # fuse: device not found, try 'modprobe fuse' first
97     "test_fuse"
98     "test_fuse_allow_damaged_files"
99     "test_fuse_mount_hardlinks"
100     "test_fuse_mount_options"
101     "test_fuse_versions_view"
102     "test_migrate_lock_alive"
103     "test_readonly_mount"
104     # Error: Permission denied while trying to write to /var/{,tmp}
105     "test_get_cache_dir"
106     "test_get_keys_dir"
107     "test_get_security_dir"
108     "test_get_config_dir"
109     # https://github.com/borgbackup/borg/issues/6573
110     "test_basic_functionality"
111   ];
113   preCheck = ''
114     export HOME=$TEMP
115   '';
117   passthru.tests = {
118     inherit (nixosTests) borgbackup;
119   };
121   outputs = [ "out" "doc" "man" ];
123   disabled = python.pythonOlder "3.9";
125   meta = with lib; {
126     changelog = "https://github.com/borgbackup/borg/blob/${src.rev}/docs/changes.rst";
127     description = "Deduplicating archiver with compression and encryption";
128     homepage = "https://www.borgbackup.org";
129     license = licenses.bsd3;
130     platforms = platforms.unix; # Darwin and FreeBSD mentioned on homepage
131     mainProgram = "borg";
132     maintainers = with maintainers; [ dotlambda globin ];
133   };