Merge branch 'master' of ssh://git.joshuabell.xyz:3032/ringofstorms/dotfiles

This commit is contained in:
RingOfStorms (Joshua Bell) 2026-01-04 22:59:50 -06:00
commit 39e99de976
6 changed files with 255 additions and 80 deletions

View file

@ -33,8 +33,10 @@ in
controlMaster = "no";
controlPath = "~/.ssh/master-%r@%n:%p";
controlPersist = "no";
extraOptions = {
StrictHostKeyChecking = "accept-new";
};
};
# EXTERNAL
"github.com" = lib.mkIf (hasSecret "nix2github") {

View file

@ -22,6 +22,7 @@ with lib;
bx = "branchdel";
b = "branch";
bs = "branching_setup";
gcp = "gcpropose";
};
environment.shellInit = lib.concatStringsSep "\n\n" [
@ -30,5 +31,6 @@ with lib;
(builtins.readFile ./branchd.func.sh)
(builtins.readFile ./link_ignored.func.sh)
(builtins.readFile ./branching_setup.func.sh)
(builtins.readFile ./gcpropose.func.sh)
];
}

View file

@ -0,0 +1,177 @@
gcpropose() {
local LITELLM_BASE_URL="http://h001.net.joshuabell.xyz:8094"
local LITELLM_MODEL="azure-gpt-5-mini-2025-08-07"
local mode="staged"
while [ $# -gt 0 ]; do
case "$1" in
-a) mode="all"; shift ;;
-h|--help)
cat <<EOF
Usage: gcpropose [-a]
Propose a short git commit subject line using a LiteLLM model.
Defaults:
- without -a: uses staged diff (git diff --staged)
- with -a : uses full diff vs HEAD (git diff HEAD)
EOF
return 0
;;
*)
echo "Unknown arg: $1" >&2
return 2
;;
esac
done
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "Not inside a git repository." >&2
return 1
fi
if ! command -v curl >/dev/null 2>&1; then
echo "Missing dependency: curl" >&2
return 1
fi
if ! command -v jq >/dev/null 2>&1; then
echo "Missing dependency: jq" >&2
return 1
fi
local diff
if [ "$mode" = "all" ]; then
diff=$(git diff HEAD)
else
diff=$(git diff --staged)
fi
if [ -z "$diff" ]; then
if [ "$mode" = "all" ]; then
echo "No changes vs HEAD." >&2
else
echo "No staged changes." >&2
fi
return 1
fi
local git_status
git_status=$(git status --porcelain=v1 2>/dev/null || true)
local max_chars=10000
diff=$(printf "%s" "$diff" | head -c "$max_chars")
local name_status
if [ "$mode" = "all" ]; then
name_status=$(git diff --name-status HEAD 2>/dev/null || true)
else
name_status=$(git diff --name-status --staged 2>/dev/null || true)
fi
local prompt
prompt=$(cat <<EOF
Propose a concise git commit subject line based on the changes.
Rules:
- Output ONLY the commit subject line.
- Imperative mood.
- Max 72 characters.
- No quotes, no backticks, no trailing period.
git status --porcelain:
${git_status}
files changed:
${name_status}
git diff (truncated):
${diff}
EOF
)
local payload_chat
payload_chat=$(jq -n \
--arg model "$LITELLM_MODEL" \
--arg content "$prompt" \
'{
model: $model,
messages: [
{
role: "system",
content: "You write excellent, conventional git commit subject lines."
},
{
role: "user",
content: $content
}
],
temperature: 0.2
}')
local curl_out http_code body
curl_out=$(curl -sS -w "\n%{http_code}" \
-X POST "${LITELLM_BASE_URL}/v1/chat/completions" \
-H "Content-Type: application/json" \
${LITELLM_API_KEY:+-H "Authorization: Bearer ${LITELLM_API_KEY}"} \
-d "$payload_chat") || return 1
http_code=$(printf "%s" "$curl_out" | tail -n 1)
body=$(printf "%s" "$curl_out" | sed '$d')
if [ "$http_code" -lt 200 ] || [ "$http_code" -ge 300 ]; then
echo "LiteLLM request failed (HTTP $http_code)." >&2
printf "%s\n" "$body" >&2
return 1
fi
local message
message=$(printf "%s" "$body" | jq -r '
.choices[0].message.content
| if type == "string" then .
elif type == "array" then (map(select(.type=="text") | .text) | join(""))
else ""
end
' 2>/dev/null || true)
message=$(printf "%s" "$message" | sed -n '1p' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
if [ -n "$message" ] && [ "$message" != "null" ]; then
printf "%s\n" "$message"
return 0
fi
local payload_responses
payload_responses=$(jq -n \
--arg model "$LITELLM_MODEL" \
--arg input "$prompt" \
'{
model: $model,
input: $input,
max_output_tokens: 64
}')
curl_out=$(curl -sS -w "\n%{http_code}" \
-X POST "${LITELLM_BASE_URL}/v1/responses" \
-H "Content-Type: application/json" \
${LITELLM_API_KEY:+-H "Authorization: Bearer ${LITELLM_API_KEY}"} \
-d "$payload_responses") || return 1
http_code=$(printf "%s" "$curl_out" | tail -n 1)
body=$(printf "%s" "$curl_out" | sed '$d')
if [ "$http_code" -lt 200 ] || [ "$http_code" -ge 300 ]; then
echo "LiteLLM request failed (HTTP $http_code)." >&2
printf "%s\n" "$body" >&2
return 1
fi
message=$(printf "%s" "$body" | jq -r '(.output_text // empty)' 2>/dev/null || true)
message=$(printf "%s" "$message" | sed -n '1p' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
if [ -z "$message" ] || [ "$message" = "null" ]; then
echo "Failed to parse model response." >&2
printf "%s\n" "$body" >&2
return 1
fi
printf "%s\n" "$message"
}

90
hosts/lio/flake.lock generated
View file

@ -31,11 +31,11 @@
},
"locked": {
"dir": "flakes/beszel",
"lastModified": 1767199996,
"narHash": "sha256-+QX8YguilhZBVvu80QZh/NDK18EWCiebo5MEgytncZQ=",
"lastModified": 1767587784,
"narHash": "sha256-xHZwNiDUshkQg1yUu+RFdkFAa8jj0XkAFpZjuUqi0wo=",
"ref": "refs/heads/master",
"rev": "23b9b9c00465c35baa19fe386c776df60fb10c0f",
"revCount": 1015,
"rev": "effa01310bfe91ef7a39a035f021a0dc4e345e58",
"revCount": 1042,
"type": "git",
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
},
@ -47,11 +47,11 @@
},
"beszel-nixpkgs": {
"locked": {
"lastModified": 1765472234,
"narHash": "sha256-9VvC20PJPsleGMewwcWYKGzDIyjckEz8uWmT0vCDYK0=",
"lastModified": 1767379071,
"narHash": "sha256-EgE0pxsrW9jp9YFMkHL9JMXxcqi/OoumPJYwf+Okucw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2fbfb1d73d239d2402a8fe03963e37aab15abe8b",
"rev": "fb7944c166a3b630f177938e478f0378e64ce108",
"type": "github"
},
"original": {
@ -64,11 +64,11 @@
"common": {
"locked": {
"dir": "flakes/common",
"lastModified": 1767201073,
"narHash": "sha256-UpY2rT7+j2t1K5Ed0wp/nKrSSA7WcZ1BpU1B3vPrbJA=",
"lastModified": 1767587784,
"narHash": "sha256-xHZwNiDUshkQg1yUu+RFdkFAa8jj0XkAFpZjuUqi0wo=",
"ref": "refs/heads/master",
"rev": "209443296fb1224938a20e7e82fc20d47e360f1c",
"revCount": 1016,
"rev": "effa01310bfe91ef7a39a035f021a0dc4e345e58",
"revCount": 1042,
"type": "git",
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
},
@ -123,11 +123,11 @@
},
"locked": {
"dir": "flakes/de_plasma",
"lastModified": 1767199996,
"narHash": "sha256-+QX8YguilhZBVvu80QZh/NDK18EWCiebo5MEgytncZQ=",
"lastModified": 1767587784,
"narHash": "sha256-xHZwNiDUshkQg1yUu+RFdkFAa8jj0XkAFpZjuUqi0wo=",
"ref": "refs/heads/master",
"rev": "23b9b9c00465c35baa19fe386c776df60fb10c0f",
"revCount": 1015,
"rev": "effa01310bfe91ef7a39a035f021a0dc4e345e58",
"revCount": 1042,
"type": "git",
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
},
@ -161,11 +161,11 @@
},
"locked": {
"dir": "flakes/flatpaks",
"lastModified": 1767199996,
"narHash": "sha256-+QX8YguilhZBVvu80QZh/NDK18EWCiebo5MEgytncZQ=",
"lastModified": 1767587784,
"narHash": "sha256-xHZwNiDUshkQg1yUu+RFdkFAa8jj0XkAFpZjuUqi0wo=",
"ref": "refs/heads/master",
"rev": "23b9b9c00465c35baa19fe386c776df60fb10c0f",
"revCount": 1015,
"rev": "effa01310bfe91ef7a39a035f021a0dc4e345e58",
"revCount": 1042,
"type": "git",
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
},
@ -202,11 +202,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1767024057,
"narHash": "sha256-B1aycRjMRvb6QOGbnqDhiDzZwMebj5jxZ5qyJzaKvpI=",
"lastModified": 1767514898,
"narHash": "sha256-ONYqnKrPzfKEEPChoJ9qPcfvBqW9ZgieDKD7UezWPg4=",
"owner": "rycee",
"repo": "home-manager",
"rev": "34578a2fdfce4257ce5f5baf6e7efbd4e4e252b1",
"rev": "7a06e8a2f844e128d3b210a000a62716b6040b7f",
"type": "github"
},
"original": {
@ -273,11 +273,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1766902085,
"narHash": "sha256-coBu0ONtFzlwwVBzmjacUQwj3G+lybcZ1oeNSQkgC0M=",
"lastModified": 1767379071,
"narHash": "sha256-EgE0pxsrW9jp9YFMkHL9JMXxcqi/OoumPJYwf+Okucw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c0b0e0fddf73fd517c3471e546c0df87a42d53f4",
"rev": "fb7944c166a3b630f177938e478f0378e64ce108",
"type": "github"
},
"original": {
@ -289,11 +289,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1766736597,
"narHash": "sha256-BASnpCLodmgiVn0M1MU2Pqyoz0aHwar/0qLkp7CjvSQ=",
"lastModified": 1767325753,
"narHash": "sha256-yA/CuWyqm+AQo2ivGy6PlYrjZBQm7jfbe461+4HF2fo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f560ccec6b1116b22e6ed15f4c510997d99d5852",
"rev": "64049ca74d63e971b627b5f3178d95642e61cedd",
"type": "github"
},
"original": {
@ -305,11 +305,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1767047869,
"narHash": "sha256-tzYsEzXEVa7op1LTnrLSiPGrcCY6948iD0EcNLWcmzo=",
"lastModified": 1767480499,
"narHash": "sha256-8IQQUorUGiSmFaPnLSo2+T+rjHtiNWc+OAzeHck7N48=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "89dbf01df72eb5ebe3b24a86334b12c27d68016a",
"rev": "30a3c519afcf3f99e2c6df3b359aec5692054d92",
"type": "github"
},
"original": {
@ -321,11 +321,11 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1767026758,
"narHash": "sha256-7fsac/f7nh/VaKJ/qm3I338+wAJa/3J57cOGpXi0Sbg=",
"lastModified": 1767364772,
"narHash": "sha256-fFUnEYMla8b7UKjijLnMe+oVFOz6HjijGGNS1l7dYaQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "346dd96ad74dc4457a9db9de4f4f57dab2e5731d",
"rev": "16c7794d0a28b5a37904d55bcca36003b9109aaa",
"type": "github"
},
"original": {
@ -1237,11 +1237,11 @@
},
"locked": {
"dir": "flakes/opencode",
"lastModified": 1767199996,
"narHash": "sha256-+QX8YguilhZBVvu80QZh/NDK18EWCiebo5MEgytncZQ=",
"lastModified": 1767587784,
"narHash": "sha256-xHZwNiDUshkQg1yUu+RFdkFAa8jj0XkAFpZjuUqi0wo=",
"ref": "refs/heads/master",
"rev": "23b9b9c00465c35baa19fe386c776df60fb10c0f",
"revCount": 1015,
"rev": "effa01310bfe91ef7a39a035f021a0dc4e345e58",
"revCount": 1042,
"type": "git",
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
},
@ -1256,11 +1256,11 @@
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1767126722,
"narHash": "sha256-bXBpPQ9altAzsuFKhIS83LKwuLIxKJ4gWMAG5xzk+fM=",
"lastModified": 1767556352,
"narHash": "sha256-iYP/fa9guprb2hn8ONJrJe6U076zbeKHdqyyL0gvH8s=",
"owner": "sst",
"repo": "opencode",
"rev": "3fe5d91372fdf859e09ed5a2aefe359e0648ed10",
"rev": "c545fa2a289518fda35be66d1c81936a54962702",
"type": "github"
},
"original": {
@ -1446,11 +1446,11 @@
},
"locked": {
"dir": "flakes/secrets",
"lastModified": 1767199996,
"narHash": "sha256-+QX8YguilhZBVvu80QZh/NDK18EWCiebo5MEgytncZQ=",
"lastModified": 1767587784,
"narHash": "sha256-xHZwNiDUshkQg1yUu+RFdkFAa8jj0XkAFpZjuUqi0wo=",
"ref": "refs/heads/master",
"rev": "23b9b9c00465c35baa19fe386c776df60fb10c0f",
"revCount": 1015,
"rev": "effa01310bfe91ef7a39a035f021a0dc4e345e58",
"revCount": 1042,
"type": "git",
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
},

58
hosts/oren/flake.lock generated
View file

@ -31,11 +31,11 @@
},
"locked": {
"dir": "flakes/beszel",
"lastModified": 1767572382,
"narHash": "sha256-oDoVrmMpww4uY3Ez1XzrHsxJTZmBMiOO/mNrU2njiWQ=",
"lastModified": 1767575724,
"narHash": "sha256-L+3hoO4t3RCXkp9RXyXpJlCkzj6AdTOsstUv7RphEBM=",
"ref": "refs/heads/master",
"rev": "165f87ebc19a48b56008738d01c5e2e5bebbbdfd",
"revCount": 1038,
"rev": "f86b8085c2ad39986c194b28d51260f8f402572a",
"revCount": 1041,
"type": "git",
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
},
@ -63,20 +63,14 @@
},
"common": {
"locked": {
"dir": "flakes/common",
"lastModified": 1767572382,
"narHash": "sha256-oDoVrmMpww4uY3Ez1XzrHsxJTZmBMiOO/mNrU2njiWQ=",
"ref": "refs/heads/master",
"rev": "165f87ebc19a48b56008738d01c5e2e5bebbbdfd",
"revCount": 1038,
"type": "git",
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
"path": "../../flakes/common",
"type": "path"
},
"original": {
"dir": "flakes/common",
"type": "git",
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
}
"path": "../../flakes/common",
"type": "path"
},
"parent": []
},
"crane": {
"locked": {
@ -123,11 +117,11 @@
},
"locked": {
"dir": "flakes/de_plasma",
"lastModified": 1767572382,
"narHash": "sha256-oDoVrmMpww4uY3Ez1XzrHsxJTZmBMiOO/mNrU2njiWQ=",
"lastModified": 1767575724,
"narHash": "sha256-L+3hoO4t3RCXkp9RXyXpJlCkzj6AdTOsstUv7RphEBM=",
"ref": "refs/heads/master",
"rev": "165f87ebc19a48b56008738d01c5e2e5bebbbdfd",
"revCount": 1038,
"rev": "f86b8085c2ad39986c194b28d51260f8f402572a",
"revCount": 1041,
"type": "git",
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
},
@ -161,11 +155,11 @@
},
"locked": {
"dir": "flakes/flatpaks",
"lastModified": 1767572382,
"narHash": "sha256-oDoVrmMpww4uY3Ez1XzrHsxJTZmBMiOO/mNrU2njiWQ=",
"lastModified": 1767575724,
"narHash": "sha256-L+3hoO4t3RCXkp9RXyXpJlCkzj6AdTOsstUv7RphEBM=",
"ref": "refs/heads/master",
"rev": "165f87ebc19a48b56008738d01c5e2e5bebbbdfd",
"revCount": 1038,
"rev": "f86b8085c2ad39986c194b28d51260f8f402572a",
"revCount": 1041,
"type": "git",
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
},
@ -1237,11 +1231,11 @@
},
"locked": {
"dir": "flakes/opencode",
"lastModified": 1767572382,
"narHash": "sha256-oDoVrmMpww4uY3Ez1XzrHsxJTZmBMiOO/mNrU2njiWQ=",
"lastModified": 1767575724,
"narHash": "sha256-L+3hoO4t3RCXkp9RXyXpJlCkzj6AdTOsstUv7RphEBM=",
"ref": "refs/heads/master",
"rev": "165f87ebc19a48b56008738d01c5e2e5bebbbdfd",
"revCount": 1038,
"rev": "f86b8085c2ad39986c194b28d51260f8f402572a",
"revCount": 1041,
"type": "git",
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
},
@ -1446,11 +1440,11 @@
},
"locked": {
"dir": "flakes/secrets",
"lastModified": 1767572382,
"narHash": "sha256-oDoVrmMpww4uY3Ez1XzrHsxJTZmBMiOO/mNrU2njiWQ=",
"lastModified": 1767575724,
"narHash": "sha256-L+3hoO4t3RCXkp9RXyXpJlCkzj6AdTOsstUv7RphEBM=",
"ref": "refs/heads/master",
"rev": "165f87ebc19a48b56008738d01c5e2e5bebbbdfd",
"revCount": 1038,
"rev": "f86b8085c2ad39986c194b28d51260f8f402572a",
"revCount": 1041,
"type": "git",
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
},

View file

@ -6,8 +6,8 @@
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# Use relative to get current version for testin
# common.url = "path:../../flakes/common";
common.url = "git+https://git.joshuabell.xyz/ringofstorms/dotfiles?dir=flakes/common";
common.url = "path:../../flakes/common";
# common.url = "git+https://git.joshuabell.xyz/ringofstorms/dotfiles?dir=flakes/common";
# secrets.url = "path:../../flakes/secrets";
secrets.url = "git+https://git.joshuabell.xyz/ringofstorms/dotfiles?dir=flakes/secrets";
# flatpaks.url = "path:../../flakes/flatpaks";