about summary refs log tree commit diff
path: root/pkgs/tools/misc/pre-commit-hook-ensure-sops
diff options
context:
space:
mode:
authornialov <nikolasovaskainen@gmail.com>2023-07-08 11:08:12 +0300
committernialov <nikolasovaskainen@gmail.com>2023-07-08 11:08:12 +0300
commitb86b4c191ffb52afd66ce6edde7a62e40014e341 (patch)
tree4ae8e5c86f973f3f08e7012600619d11c2ac4da9 /pkgs/tools/misc/pre-commit-hook-ensure-sops
parente46ab54b68e4fdc4d179669729ad5978901992d8 (diff)
python3Packages.pre-commit-hook-ensure-sops: init at 1.1.0
Diffstat (limited to 'pkgs/tools/misc/pre-commit-hook-ensure-sops')
-rw-r--r--pkgs/tools/misc/pre-commit-hook-ensure-sops/default.nix50
1 files changed, 50 insertions, 0 deletions
diff --git a/pkgs/tools/misc/pre-commit-hook-ensure-sops/default.nix b/pkgs/tools/misc/pre-commit-hook-ensure-sops/default.nix
new file mode 100644
index 0000000000000..ebe41abb8e333
--- /dev/null
+++ b/pkgs/tools/misc/pre-commit-hook-ensure-sops/default.nix
@@ -0,0 +1,50 @@
+{ lib
+, python3Packages
+, fetchFromGitHub
+, fetchpatch
+}:
+
+python3Packages.buildPythonApplication rec {
+  pname = "pre-commit-hook-ensure-sops";
+  version = "1.1";
+  format = "setuptools";
+
+  src = fetchFromGitHub {
+    owner = "yuvipanda";
+    repo = pname;
+    rev = "refs/tags/v${version}";
+    hash = "sha256-8sMmHNzmYwOmHYSWoZ4rKb/2lKziFmT6ux+s+chd/Do=";
+  };
+
+  patches = [
+    # Add the command-line entrypoint to pyproject.toml
+    # Can be removed after v1.2 release that includes changes
+    (fetchpatch {
+      url =
+        "https://github.com/yuvipanda/pre-commit-hook-ensure-sops/commit/ed88126afa253df6009af7cbe5aa2369f963be1c.patch";
+      hash = "sha256-mMxAoC3WEciO799Rq8gZ2PJ6FT/GbeSpxlr1EPj7r4s=";
+    })
+  ];
+
+  propagatedBuildInputs = [
+    python3Packages.ruamel-yaml
+  ];
+
+  pythonImportsCheck = [
+    "pre_commit_hook_ensure_sops"
+  ];
+
+  # Test entrypoint
+  checkPhase = ''
+    runHook preCheck
+    $out/bin/pre-commit-hook-ensure-sops --help
+    runHook postCheck
+  '';
+
+  meta = with lib; {
+    description = "pre-commit hook to ensure that files that should be encrypted with sops are";
+    homepage = "https://github.com/yuvipanda/pre-commit-hook-ensure-sops";
+    maintainers = with maintainers; [ nialov ];
+    license = licenses.bsd3;
+  };
+}