1{
2 lib,
3 aws-sam-cli,
4 boto3,
5 buildPythonPackage,
6 cfn-lint,
7 fetchFromGitHub,
8 mock,
9 moto,
10 mypy-boto3-ebs,
11 poetry-core,
12 pytestCheckHook,
13 pythonOlder,
14 typer,
15 urllib3,
16}:
17
18buildPythonPackage rec {
19 pname = "dsnap";
20 version = "1.0.0";
21 pyproject = true;
22
23 disabled = pythonOlder "3.7";
24
25 src = fetchFromGitHub {
26 owner = "RhinoSecurityLabs";
27 repo = "dsnap";
28 rev = "refs/tags/v${version}";
29 hash = "sha256-yKch+tKjFhvZfzloazMH378dkERF8gnZEX1Som+d670=";
30 };
31
32 postPatch = ''
33 # Is no direct dependency
34 substituteInPlace pyproject.toml \
35 --replace-fail 'urllib3 = "^1.26.4"' 'urllib3 = "*"'
36 '';
37
38 build-system = [ poetry-core ];
39
40 dependencies = [
41 boto3
42 urllib3
43 ];
44
45 passthru.optional-dependencies = {
46 cli = [ typer ];
47 scannerd = [
48 aws-sam-cli
49 cfn-lint
50 ];
51 };
52
53 nativeCheckInputs = [
54 mock
55 moto
56 mypy-boto3-ebs
57 pytestCheckHook
58 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
59
60 # https://github.com/RhinoSecurityLabs/dsnap/issues/26
61 # ImportError: cannot import name 'mock_iam' from 'moto'
62 doCheck = false;
63
64 pythonImportsCheck = [ "dsnap" ];
65
66 meta = with lib; {
67 description = "Utility for downloading and mounting EBS snapshots using the EBS Direct API's";
68 homepage = "https://github.com/RhinoSecurityLabs/dsnap";
69 changelog = "https://github.com/RhinoSecurityLabs/dsnap/releases/tag/v${version}";
70 license = licenses.bsd3;
71 maintainers = with maintainers; [ fab ];
72 mainProgram = "dsnap";
73 };
74}