Add opencode

This commit is contained in:
muon 2026-02-26 09:53:50 +00:00
parent c8b7dc1ec7
commit 7af65a0c9b
4 changed files with 78 additions and 0 deletions

View file

@ -13,6 +13,7 @@
./helix
./nvim
./zellij
./opencode
];
config = lib.mkIf osConfig.mods.desktop.enable {

View file

@ -0,0 +1,38 @@
{
lib,
fetchFromGitHub,
rustPlatform,
openssl,
pkg-config,
git,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "dcg";
version = "v0.4.0";
src = fetchFromGitHub {
owner = "Dicklesworthstone";
repo = "destructive_command_guard";
tag = finalAttrs.version;
hash = "sha256-tkjHhSMoLRV56AwUa0DkoDMoEj6gUZx/ih0VTC9C+4o=";
};
cargoHash = "sha256-G6cOjl5tLdjBg7A+Itnk/t6tLzoU7gKYOTYlZm3HSlA=";
doCheck = false;
nativeBuildInputs = [
pkg-config
openssl
openssl.dev
git
];
PKG_CONFIG_PATH = "${openssl.dev}/lib/pkgconfig";
meta = {
description = "A high-performance hook for AI coding agents that blocks destructive commands before they execute, protecting your work from accidental deletion";
homepage = "https://github.com/Dicklesworthstone/destructive_command_guard";
license = lib.licenses.mit;
maintainers = [];
};
})

View file

@ -0,0 +1,38 @@
{
lib,
config,
pkgs,
...
}: {
options.mods.opencode.enable = lib.mkEnableOption "enables opencode";
# imports = [
# ./package.nix
# ./dcg.nix
# ];
config = lib.mkIf config.mods.opencode.enable {
home.packages = with pkgs; [
(callPackage ./dcg.nix {})
];
programs.opencode = {
enable = true;
settings = {
"plugin" = ["opencode-gemini-auth"];
"permission" = {
"bash" = {
"*" = "ask";
"rm *" = "deny";
"rmdir *" = "deny";
"unlink *" = "deny";
"*rm *" = "ask";
"*rmdir *" = "ask";
"*unlink *" = "ask";
};
};
};
};
};
}