nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 166 lines 3.4 kB view raw
1{ 2 lib, 3 stdenv, 4 acl, 5 e2fsprogs, 6 fetchFromGitHub, 7 libb2, 8 lz4, 9 openssh, 10 openssl, 11 python3, 12 xxHash, 13 zstd, 14 installShellFiles, 15 nixosTests, 16 nix-update-script, 17 versionCheckHook, 18}: 19 20let 21 python = python3; 22in 23python.pkgs.buildPythonApplication rec { 24 pname = "borgbackup"; 25 version = "1.4.3"; 26 pyproject = true; 27 28 src = fetchFromGitHub { 29 owner = "borgbackup"; 30 repo = "borg"; 31 tag = version; 32 hash = "sha256-v42Mv2wz34w2VYu2mPT/K7VtGSYsUDr+NUM99AzpSB0="; 33 }; 34 35 postPatch = '' 36 # sandbox does not support setuid/setgid/sticky bits 37 substituteInPlace src/borg/testsuite/archiver.py \ 38 --replace-fail "0o4755" "0o0755" 39 ''; 40 41 build-system = with python.pkgs; [ 42 cython 43 setuptools-scm 44 pkgconfig 45 ]; 46 47 nativeBuildInputs = with python.pkgs; [ 48 # docs 49 sphinxHook 50 sphinxcontrib-jquery 51 guzzle-sphinx-theme 52 53 # shell completions 54 installShellFiles 55 ]; 56 57 sphinxBuilders = [ 58 "singlehtml" 59 "man" 60 ]; 61 62 buildInputs = [ 63 libb2 64 lz4 65 xxHash 66 zstd 67 openssl 68 ] 69 ++ lib.optionals stdenv.hostPlatform.isLinux [ 70 acl 71 ]; 72 73 dependencies = with python.pkgs; [ 74 msgpack 75 packaging 76 (if stdenv.hostPlatform.isLinux then pyfuse3 else llfuse) 77 ]; 78 79 makeWrapperArgs = [ 80 ''--prefix PATH ':' "${openssh}/bin"'' 81 ]; 82 83 preInstallSphinx = '' 84 # remove invalid outputs for manpages 85 rm .sphinx/man/man/_static/jquery.js 86 rm .sphinx/man/man/_static/_sphinx_javascript_frameworks_compat.js 87 rmdir .sphinx/man/man/_static/ 88 ''; 89 90 postInstall = '' 91 installShellCompletion --cmd borg \ 92 --bash scripts/shell_completions/bash/borg \ 93 --fish scripts/shell_completions/fish/borg.fish \ 94 --zsh scripts/shell_completions/zsh/_borg 95 ''; 96 97 nativeCheckInputs = with python.pkgs; [ 98 e2fsprogs 99 py 100 pytest-benchmark 101 pytest-xdist 102 pytestCheckHook 103 versionCheckHook 104 ]; 105 106 pytestFlags = [ 107 "--benchmark-skip" 108 "--pyargs" 109 "borg.testsuite" 110 ]; 111 112 disabledTests = [ 113 # fuse: device not found, try 'modprobe fuse' first 114 "test_fuse" 115 "test_fuse_allow_damaged_files" 116 "test_fuse_mount_hardlinks" 117 "test_fuse_mount_options" 118 "test_fuse_versions_view" 119 "test_migrate_lock_alive" 120 "test_readonly_mount" 121 # Error: Permission denied while trying to write to /var/{,tmp} 122 "test_get_cache_dir" 123 "test_get_keys_dir" 124 "test_get_security_dir" 125 "test_get_config_dir" 126 ] 127 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 128 # Tests create files with append-only flags that cause cleanup issues on macOS 129 "test_extract_restores_append_flag" 130 "test_file_status_excluded" 131 ]; 132 133 preCheck = '' 134 export HOME=$TEMP 135 ''; 136 137 passthru.tests = { 138 inherit (nixosTests) borgbackup; 139 }; 140 141 outputs = [ 142 "out" 143 "doc" 144 "man" 145 ]; 146 147 passthru.updateScript = nix-update-script { 148 # Only match tags formatted as x.y.z (e.g., 1.2.3) 149 extraArgs = [ 150 "--version-regex" 151 "^([0-9]+\\.[0-9]+\\.[0-9]+)$" 152 ]; 153 }; 154 155 meta = { 156 changelog = "https://github.com/borgbackup/borg/blob/${src.rev}/docs/changes.rst"; 157 description = "Deduplicating archiver with compression and encryption"; 158 homepage = "https://www.borgbackup.org"; 159 license = lib.licenses.bsd3; 160 platforms = lib.platforms.unix; # Darwin and FreeBSD mentioned on homepage 161 mainProgram = "borg"; 162 maintainers = with lib.maintainers; [ 163 dotlambda 164 ]; 165 }; 166}