nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 gibberish-detector,
6 mock,
7 pkgs,
8 pyahocorasick,
9 pytestCheckHook,
10 pyyaml,
11 requests,
12 responses,
13 setuptools,
14 unidiff,
15 writableTmpDirAsHomeHook,
16}:
17
18buildPythonPackage rec {
19 pname = "bc-detect-secrets";
20 version = "1.5.45";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "bridgecrewio";
25 repo = "detect-secrets";
26 tag = version;
27 hash = "sha256-/0VHhKcYcXYXosInjsgBf6eR7kcfLiLSyxFuaIqTbiQ=";
28 };
29
30 build-system = [ setuptools ];
31
32 dependencies = [
33 pyyaml
34 requests
35 unidiff
36 ];
37
38 optional-dependencies = {
39 word_list = [ pyahocorasick ];
40 gibberish = [ gibberish-detector ];
41 };
42
43 nativeCheckInputs = [
44 mock
45 pkgs.gitMinimal
46 pytestCheckHook
47 responses
48 writableTmpDirAsHomeHook
49 ]
50 ++ lib.concatAttrValues optional-dependencies;
51
52 disabledTests = [
53 # Tests are failing for various reasons (missing git repo, missing test data, etc.)
54 "test_baseline_filters_out_known_secrets"
55 "test_make_decisions"
56 "test_saves_to_baseline"
57 "test_start_halfway"
58 "TestCreate"
59 "TestDiff"
60 "TestGetFilesToScan"
61 "TestLineNumberChanges"
62 "TestModifiesBaselineFromVersionChange"
63 ];
64
65 pythonImportsCheck = [ "detect_secrets" ];
66
67 meta = {
68 description = "Tool to detect secrets in the code";
69 homepage = "https://github.com/bridgecrewio/detect-secrets";
70 license = lib.licenses.asl20;
71 maintainers = with lib.maintainers; [ fab ];
72 };
73}