main
 1{
 2  lib,
 3  rustPlatform,
 4  fetchFromGitHub,
 5  nix-update-script,
 6}:
 7rustPlatform.buildRustPackage (finalAttrs: {
 8  pname = "dcg";
 9  version = "0.15.3";
10
11  src = fetchFromGitHub {
12    owner = "Dicklesworthstone";
13    repo = "destructive_command_guard";
14    tag = "v${finalAttrs.version}";
15    hash = "sha256-wBD3y1KH9u5h3G+236erESI5zy6bq3lD2RKYIVFDBps=";
16  };
17
18  cargoHash = "sha256-mrjvFx3ziKXEQD3gRTPVAHbW7oGvdHoR6jidicC8OPU=";
19
20  postPatch = ''
21    rm .cargo/config.toml
22  '';
23
24  doCheck = false;
25
26  passthru.updateScript = nix-update-script {};
27
28  meta = {
29    description = "PreToolUse hook that blocks destructive shell commands for AI coding agents";
30    homepage = "https://github.com/Dicklesworthstone/destructive_command_guard";
31    license = lib.licenses.unfree;
32    mainProgram = "dcg";
33    platforms = lib.platforms.unix;
34  };
35})