2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv
|
2021-07-11 12:00:00 +00:00
|
|
|
, fetchFromGitLab
|
|
|
|
, fetchpatch
|
2021-07-21 10:52:00 +00:00
|
|
|
, python3
|
2020-01-05 16:01:50 +00:00
|
|
|
, librsync
|
|
|
|
, ncftp
|
|
|
|
, gnupg
|
2019-05-04 00:16:54 +00:00
|
|
|
, gnutar
|
|
|
|
, par2cmdline
|
2020-11-24 15:29:28 +00:00
|
|
|
, util-linux
|
2019-09-19 20:27:06 +00:00
|
|
|
, rsync
|
2020-01-05 16:01:50 +00:00
|
|
|
, makeWrapper
|
2020-03-11 11:43:50 +00:00
|
|
|
, gettext
|
2020-01-05 16:01:50 +00:00
|
|
|
}:
|
2020-03-11 11:43:50 +00:00
|
|
|
let
|
2021-07-21 10:52:00 +00:00
|
|
|
pythonPackages = python3.pkgs;
|
2021-01-15 09:19:50 +00:00
|
|
|
inherit (lib.versions) majorMinor splitVersion;
|
|
|
|
majorMinorPatch = v: builtins.concatStringsSep "." (lib.take 3 (splitVersion v));
|
2020-03-11 11:43:50 +00:00
|
|
|
in
|
2020-01-05 16:01:50 +00:00
|
|
|
pythonPackages.buildPythonApplication rec {
|
2019-08-31 11:41:23 +00:00
|
|
|
pname = "duplicity";
|
2022-07-18 22:57:32 +00:00
|
|
|
version = "0.8.23";
|
2010-02-04 13:42:41 +00:00
|
|
|
|
2021-07-11 12:00:00 +00:00
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "duplicity";
|
|
|
|
repo = "duplicity";
|
|
|
|
rev = "rel.${version}";
|
2022-07-18 22:57:32 +00:00
|
|
|
sha256 = "0my015zc8751smjgbsysmca7hvdm96cjw5zilqn3zq971nmmrksb";
|
2010-02-04 13:42:41 +00:00
|
|
|
};
|
2020-01-05 16:01:50 +00:00
|
|
|
|
2019-05-04 00:16:54 +00:00
|
|
|
patches = [
|
2020-01-05 16:01:50 +00:00
|
|
|
# We use the tar binary on all platforms.
|
2019-05-04 00:16:54 +00:00
|
|
|
./gnutar-in-test.patch
|
2019-06-03 06:13:21 +00:00
|
|
|
|
2020-01-05 16:01:50 +00:00
|
|
|
# Our Python infrastructure runs test in installCheckPhase so we need
|
|
|
|
# to make the testing code stop assuming it is run from the source directory.
|
|
|
|
./use-installed-scripts-in-test.patch
|
2021-01-15 09:19:50 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2021-04-02 15:10:40 +00:00
|
|
|
# Broken on Linux in Nix' build environment
|
2019-05-04 00:16:54 +00:00
|
|
|
./linux-disable-timezone-test.patch
|
|
|
|
];
|
2010-02-04 13:42:41 +00:00
|
|
|
|
2021-04-02 15:10:40 +00:00
|
|
|
SETUPTOOLS_SCM_PRETEND_VERSION = version;
|
|
|
|
|
2021-07-11 12:00:00 +00:00
|
|
|
preConfigure = ''
|
|
|
|
# fix version displayed by duplicity --version
|
|
|
|
# see SourceCopy in setup.py
|
|
|
|
ls
|
|
|
|
for i in bin/*.1 duplicity/__init__.py; do
|
|
|
|
substituteInPlace "$i" --replace '$version' "${version}"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2020-03-11 11:43:50 +00:00
|
|
|
nativeBuildInputs = [
|
2020-01-05 16:01:50 +00:00
|
|
|
makeWrapper
|
2020-03-11 11:43:50 +00:00
|
|
|
gettext
|
2020-01-05 16:01:50 +00:00
|
|
|
pythonPackages.wrapPython
|
2021-04-02 15:10:40 +00:00
|
|
|
pythonPackages.setuptools-scm
|
2020-01-05 16:01:50 +00:00
|
|
|
];
|
2020-03-11 11:43:50 +00:00
|
|
|
buildInputs = [
|
|
|
|
librsync
|
|
|
|
];
|
2020-01-05 16:01:50 +00:00
|
|
|
|
2021-04-04 12:49:39 +00:00
|
|
|
pythonPath = with pythonPackages; [
|
2020-08-17 19:56:47 +00:00
|
|
|
b2sdk
|
2020-11-17 19:05:44 +00:00
|
|
|
boto3
|
2020-01-05 16:01:50 +00:00
|
|
|
cffi
|
|
|
|
cryptography
|
|
|
|
ecdsa
|
|
|
|
idna
|
|
|
|
pygobject3
|
|
|
|
fasteners
|
|
|
|
lockfile
|
|
|
|
paramiko
|
|
|
|
pyasn1
|
|
|
|
pycrypto
|
2022-05-31 21:47:34 +00:00
|
|
|
pydrive2
|
2020-01-05 16:01:50 +00:00
|
|
|
future
|
2020-08-17 19:56:47 +00:00
|
|
|
];
|
2020-01-05 16:01:50 +00:00
|
|
|
|
2019-05-04 00:16:54 +00:00
|
|
|
checkInputs = [
|
2020-01-05 16:01:50 +00:00
|
|
|
gnupg # Add 'gpg' to PATH.
|
|
|
|
gnutar # Add 'tar' to PATH.
|
|
|
|
librsync # Add 'rdiff' to PATH.
|
|
|
|
par2cmdline # Add 'par2' to PATH.
|
2021-01-15 09:19:50 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2020-11-24 15:29:28 +00:00
|
|
|
util-linux # Add 'setsid' to PATH.
|
2020-01-05 16:01:50 +00:00
|
|
|
] ++ (with pythonPackages; [
|
|
|
|
lockfile
|
|
|
|
mock
|
|
|
|
pexpect
|
|
|
|
pytest
|
2021-07-20 21:07:53 +00:00
|
|
|
pytest-runner
|
2020-01-05 16:01:50 +00:00
|
|
|
]);
|
2017-03-24 09:48:00 +00:00
|
|
|
|
2016-10-27 15:15:18 +00:00
|
|
|
postInstall = ''
|
2010-02-10 16:51:01 +00:00
|
|
|
wrapProgram $out/bin/duplicity \
|
2021-01-15 09:19:50 +00:00
|
|
|
--prefix PATH : "${lib.makeBinPath [ gnupg ncftp rsync ]}"
|
2017-03-24 09:48:00 +00:00
|
|
|
'';
|
2016-10-27 15:15:18 +00:00
|
|
|
|
2017-03-24 09:48:00 +00:00
|
|
|
preCheck = ''
|
2019-05-04 00:16:54 +00:00
|
|
|
wrapPythonProgramsIn "$PWD/testing/overrides/bin" "$pythonPath"
|
2016-10-27 15:15:18 +00:00
|
|
|
|
2019-05-04 00:16:54 +00:00
|
|
|
# Add 'duplicity' to PATH for tests.
|
|
|
|
# Normally, 'setup.py test' adds 'build/scripts-2.7/' to PATH before running
|
|
|
|
# tests. However, 'build/scripts-2.7/duplicity' is not wrapped, so its
|
|
|
|
# shebang is incorrect and it fails to run inside Nix' sandbox.
|
|
|
|
# In combination with use-installed-scripts-in-test.patch, make 'setup.py
|
|
|
|
# test' use the installed 'duplicity' instead.
|
|
|
|
PATH="$out/bin:$PATH"
|
|
|
|
|
|
|
|
# Don't run developer-only checks (pep8, etc.).
|
|
|
|
export RUN_CODE_TESTS=0
|
2021-07-11 12:00:00 +00:00
|
|
|
|
|
|
|
# check version string
|
|
|
|
duplicity --version | grep ${version}
|
2021-01-15 09:19:50 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2019-05-04 00:16:54 +00:00
|
|
|
# Work around the following error when running tests:
|
|
|
|
# > Max open files of 256 is too low, should be >= 1024.
|
|
|
|
# > Use 'ulimit -n 1024' or higher to correct.
|
|
|
|
ulimit -n 1024
|
2017-03-24 09:48:00 +00:00
|
|
|
'';
|
2010-02-04 13:42:41 +00:00
|
|
|
|
2019-05-04 00:16:54 +00:00
|
|
|
# TODO: Fix test failures on macOS 10.13:
|
|
|
|
#
|
|
|
|
# > OSError: out of pty devices
|
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2010-02-04 13:42:41 +00:00
|
|
|
description = "Encrypted bandwidth-efficient backup using the rsync algorithm";
|
2021-10-29 09:03:23 +00:00
|
|
|
homepage = "https://duplicity.gitlab.io/duplicity-web/";
|
2017-03-24 09:48:00 +00:00
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
platforms = platforms.unix;
|
2010-02-04 13:42:41 +00:00
|
|
|
};
|
|
|
|
}
|