gitea container

This commit is contained in:
ari committed 2026-09-30 14:40:26 -04:00
1 parent eb213e56e5
commit 2f281b354a
6 files changed
+433 -3

No files matched your search

+2 -1
View File
@@ -14,7 +14,7 @@ bin/
├── cmds.nu # All subcommand implementations (NuShell — source of truth); commands only
├── helpers.nu # Shared helpers: REPO_ROOT const + internal functions used by commands
├── profile.nu # Profile helpers and tab-completion data
└── types.nu # Type definitions
└── types.nu # Type definitions + tab-completion data
```
## Key Commands
@@ -40,6 +40,7 @@ bin/
| `skyg compare-secret <secret>` | Diff the working copy against the stored secret |
| `skyg ca init` | Generate the lab root CA: key → `secrets/lab-ca-key.age`, cert → `configs/pki/lab-ca.crt` (see `configs/pki/ABOUTME.md`) |
| `skyg ca issue <domain> --for <host>` | Mint a TLS leaf cert signed by the lab CA: cert → `configs/pki/<domain>.crt`, key → `secrets/<name>-tls-key.age`. Auto-registers missing `secrets.nix` entries. |
| `skyg render html-tpl <file>` | Render a Gitea `.tmpl` (swaps `base/head`/`base/footer` for a minimal shell, strips `{{ … }}`) and serve it on `127.0.0.1` for preview. Foreground — Ctrl+C to stop. `<file>` tab-completes from `**/*.tmpl`. |
## Agent Note
+25
View File
@@ -607,3 +607,28 @@ export def "skyg pkgs update" [
git --no-pager diff pkgs/ | print
}
}
# Render a Gitea HTML template and serve it locally for preview.
# Runs in the foreground — Ctrl+C to stop. Wrap it in nohup yourself to detach.
export def "skyg render html-tpl" [
file: string@html-tpl-files # Template to render (e.g. hosts/hl-minipc1/services/gitea-home.tmpl)
--port: int = 8787 # Port for the local preview server
] {
cd $REPO_ROOT
let src = ($file | path expand)
if not ($src | path exists) {
error make {msg: $"Template not found: ($file)"}
}
let out_dir = ".tmp/render-html-tpl"
mkdir $out_dir
let name = ($src | path basename | str replace -r '\.tmpl$' '')
let out = $"($out_dir)/($name).html"
render-html-tpl $src $out
print $"Rendered ($file) -> ($out)"
print $"Preview: http://127.0.0.1:($port)/($name).html"
print "Press Ctrl+C to stop."
^python3 -m http.server $port --bind 127.0.0.1 --directory $out_dir
}
+15
View File
@@ -19,3 +19,18 @@ export def ensure-secret-entry [secret_path: string, recipients: list<string>] {
($new_lines | str join "\n") + "\n" | save -f $file
print $"📝 Registered ($secret_path) in secrets.nix — review with git diff"
}
# Render a Gitea-style Go template to a standalone HTML file for local preview.
# Swaps the base/head + base/footer includes for a minimal shell and drops any
# remaining {{ ... }} directives so the page opens in a plain browser.
export def render-html-tpl [src: string, out: string] {
let head = '<!DOCTYPE html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Template preview</title><style>html,body{margin:0;background:#f6f8fa;font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;color:#1f2328;}</style></head><body>'
let foot = '</body></html>'
# Read via external cat — `open` is aliased to xdg-open in some Nu configs.
^cat $src
| str replace -a '{{template "base/head" .}}' $head
| str replace -a '{{template "base/footer" .}}' $foot
| str replace -a -r '\{\{[^}]*\}\}' ''
| save -f $out
}
+8
View File
@@ -29,3 +29,11 @@ export def updatable-pkgs [] {
glob "pkgs/*/update.sh"
| each {|f| $f | path dirname | path basename }
}
# Gitea HTML templates, for `skyg render html-tpl` tab-completion.
export def html-tpl-files [] {
cd $REPO_ROOT
glob "**/*.tmpl"
| each {|f| $f | path relative-to $REPO_ROOT }
| sort
}