feat(github): add auto-conventional-commit hook with opencode integration
- Add prepare-commit-msg git hook that generates conventional commit messages - Modularize fish configuration with separate conf.d files - Convert configuration files from .text to .source format for structured data - Add sops-nix SOPS configuration with explicit secret definitions - Upgrade age identity to single key file management approach - Add system activation script for age key management - Generate .sops.yaml for SOPS creation rules - Restructure README.md with improved table and cleaner formatting - Refactor config files to use pkgs.formats.json/toml generators - Implement YAML format for ashell and walker service configurations - Update SSH config source to use sops secrets - Convert zed and other config files to use structured .source format
This commit is contained in:
@@ -5,7 +5,40 @@
|
||||
}: let
|
||||
configFile = "git/config";
|
||||
ignoreFile = "git/ignore";
|
||||
hooksDir = "git/hooks";
|
||||
toINI = (pkgs.formats.ini {}).generate;
|
||||
|
||||
# Hook that auto-generates a Conventional Commit message from staged diff
|
||||
prepareCommitMsg = pkgs.writeShellScript "prepare-commit-msg" ''
|
||||
# Only run if there are staged changes
|
||||
if git diff --cached --quiet 2>/dev/null; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Generating commit message from staged changes..." >&2
|
||||
|
||||
# Generate Conventional Commit message using opencode run
|
||||
git diff --cached | timeout 30 ${pkgs.opencode}/bin/opencode run \
|
||||
-m opencode/north-mini-code-free \
|
||||
"You are an expert software engineer writing professional Git commit messages.
|
||||
|
||||
Create a clean Conventional Commit for the provided diff.
|
||||
|
||||
Rules:
|
||||
- Format: type(optional scope): imperative description
|
||||
- Allowed types: feat, fix, docs, style, refactor, perf, test, build, ci, chore
|
||||
- First line: maximum 72 characters, starts with capital letter, imperative present tense
|
||||
- If relevant, add a blank line followed by a short body explaining the motivation and key changes
|
||||
- Be concise and professional. No emojis, no markdown.
|
||||
|
||||
Output ONLY the commit message. Do not add any extra text, quotes, or explanations." \
|
||||
2>/dev/null > "$1"
|
||||
|
||||
# Fallback if generation failed or timed out
|
||||
if [ ! -s "$1" ]; then
|
||||
echo "chore: auto-generated commit message" > "$1"
|
||||
fi
|
||||
'';
|
||||
in {
|
||||
users.users.someone.packages = with pkgs; [
|
||||
git
|
||||
@@ -36,6 +69,7 @@ in {
|
||||
};
|
||||
core = {
|
||||
editor = "nvim";
|
||||
hooksPath = "${config.xdg.configHome}/git/hooks";
|
||||
pager = "${pkgs.delta}/bin/delta";
|
||||
whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol";
|
||||
excludesFile = "${config.xdg.configHome}/${ignoreFile}";
|
||||
@@ -124,4 +158,6 @@ in {
|
||||
AGENTS.md
|
||||
.sisyphus
|
||||
'';
|
||||
|
||||
xdg.configFile."${hooksDir}/prepare-commit-msg".source = prepareCommitMsg;
|
||||
}
|
||||
|
||||
@@ -31,12 +31,13 @@
|
||||
'';
|
||||
configFile = "opencode/config.json";
|
||||
tuiFile = "opencode/tui.json";
|
||||
toJSON = (pkgs.formats.json {}).generate;
|
||||
in {
|
||||
users.users.someone.packages = [
|
||||
opencodeWrapped
|
||||
];
|
||||
xdg.configFile = {
|
||||
"${configFile}".text = builtins.toJSON {
|
||||
"${configFile}".source = toJSON "config.json" {
|
||||
"$schema" = "https://opencode.ai/config.json";
|
||||
plugin = [
|
||||
"opencode-antigravity-auth@latest"
|
||||
@@ -118,7 +119,7 @@ in {
|
||||
provider = providers.config;
|
||||
};
|
||||
|
||||
"opencode/oh-my-openagent.json".text = builtins.toJSON {
|
||||
"opencode/oh-my-openagent.json".source = toJSON "oh-my-openagent.json" {
|
||||
"$schema" = "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/master/assets/oh-my-opencode.schema.json";
|
||||
agents = {
|
||||
"sisyphus-junior" = {model = "opencode/nemotron-3-super-free";};
|
||||
@@ -134,7 +135,7 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
"${tuiFile}".text = builtins.toJSON {
|
||||
"${tuiFile}".source = toJSON "tui.json" {
|
||||
"$schema" = "https://opencode.ai/tui.json";
|
||||
theme = "gruvbox";
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
];
|
||||
|
||||
xdg.configFile."ssh/config" = {
|
||||
source = config.age.secrets.ssh_config.path;
|
||||
source = config.sops.secrets.ssh_config.path;
|
||||
};
|
||||
|
||||
home.file.".ssh/config" = {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
{pkgs, ...}: {
|
||||
{pkgs, ...}: let
|
||||
toJSON = (pkgs.formats.json {}).generate;
|
||||
in {
|
||||
users.users.someone.packages = with pkgs; [
|
||||
television
|
||||
nix-search-tv
|
||||
];
|
||||
|
||||
xdg.configFile = {
|
||||
"nix-search-tv/config.json".text = builtins.toJSON {
|
||||
"nix-search-tv/config.json".source = toJSON "config.json" {
|
||||
indexes = ["nixos" "nixpkgs" "nur"];
|
||||
};
|
||||
"fish/completions/tv.fish".source = "${pkgs.television}/share/fish/vendor_completions.d/tv.fish";
|
||||
|
||||
Reference in New Issue
Block a user