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
}
+12 -2
View File
@@ -4,6 +4,7 @@ let
user = "gitea";
group = "gitea";
stateDir = "/var/lib/sosnovsky/gitea";
sshDir = "/var/lib/sosnovsky/gitea-ssh";
httpPort = 3000;
sshPort = 22;
};
@@ -37,6 +38,11 @@ in
systemd.tmpfiles.rules = lib.mkIf containerMode [
"d ${gitea.stateDir} 0750 ${gitea.user} ${gitea.group} -"
"d ${gitea.sshDir} 0750 ${gitea.user} ${gitea.group} -"
# Pre-created so the read-only template mount lands in gitea-owned dirs
# instead of root-owned ones docker would create on demand.
"d ${gitea.stateDir}/custom 0755 ${gitea.user} ${gitea.group} -"
"d ${gitea.stateDir}/custom/templates 0755 ${gitea.user} ${gitea.group} -"
];
skyg.nixos.common.container-services.gitea = {
@@ -54,8 +60,9 @@ in
# The image renames its `git` user to $USER, so this makes RUN_USER,
# sshd AllowUsers and the container's runtime user all `gitea`.
USER = gitea.user;
HOME = "/data/git";
GITEA__server__APP_DATA_PATH = "${gitea.stateDir}/data";
GITEA__server__SSH_ROOT_PATH = "${gitea.stateDir}/.ssh";
GITEA__server__SSH_ROOT_PATH = "/data/git/.ssh";
GITEA__repository__ROOT = "${gitea.stateDir}/repositories";
GITEA__database__PATH = "${gitea.stateDir}/data/gitea.db";
GITEA__log__ROOT_PATH = "${gitea.stateDir}/log";
@@ -69,8 +76,11 @@ in
};
volumes = [
"${gitea.stateDir}:${gitea.stateDir}"
"${gitea.stateDir}/.ssh:/data/git/.ssh"
"${gitea.sshDir}:/data"
];
# Custom landing page, mounted read-only over GITEA_CUSTOM/templates.
files."${gitea.stateDir}/custom/templates/home.tmpl" =
builtins.readFile ./gitea-home.tmpl;
};
};
}
+371
View File
@@ -0,0 +1,371 @@
{{template "base/head" .}}
<div class="page-content home">
<div class="ui container">
<div class="snv-hero">
<h1 class="snv-title">Sosnovsky Gitea</h1>
<p class="snv-subtitle">Ariel's Sosnovsky personal project hub</p>
</div>
<div class="snv-scene" aria-hidden="true">
<span class="snv-comet"></span>
<div class="snv-stars">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="snv-glow"></div>
<div class="snv-robot">
<div class="snv-antenna"><span class="snv-antenna-tip"></span></div>
<div class="snv-head">
<span class="snv-ear snv-ear-l"></span>
<span class="snv-ear snv-ear-r"></span>
<span class="snv-eye snv-eye-l"></span>
<span class="snv-eye snv-eye-r"></span>
<span class="snv-mouth"></span>
</div>
<div class="snv-neck"></div>
<div class="snv-torso"><span class="snv-core"></span></div>
<div class="snv-arm snv-arm-l"></div>
<div class="snv-arm snv-arm-r"></div>
<div class="snv-legs">
<span class="snv-leg"></span>
<span class="snv-leg"></span>
</div>
</div>
<div class="snv-shadow"></div>
</div>
<style>
/* Sosnovsky Gitea landing page — pure CSS, no JS, theme-independent. */
.snv-hero {
text-align: center;
padding: 48px 12px 4px;
}
.snv-title {
margin: 0 0 10px;
font-size: 3rem;
font-weight: 800;
line-height: 1.1;
letter-spacing: .01em;
background: linear-gradient(90deg, #2563eb, #7c3aed, #db2777, #7c3aed, #2563eb);
background-size: 200% auto;
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
color: #2563eb;
animation: snv-shimmer 7s linear infinite, snv-rise .7s ease both;
}
.snv-subtitle {
margin: 0;
font-size: 1.2rem;
opacity: .7;
animation: snv-rise .7s .12s ease both;
}
.snv-scene {
position: relative;
overflow: hidden;
max-width: 640px;
height: 340px;
margin: 20px auto 60px;
border-radius: 24px;
border: 1px solid rgba(125, 165, 255, .16);
background:
radial-gradient(120% 90% at 50% 115%, rgba(56, 130, 246, .2), transparent 60%),
linear-gradient(180deg, #0b1224, #111c37 55%, #0b1224);
box-shadow: 0 24px 60px -32px rgba(37, 99, 235, .5);
}
.snv-stars span {
position: absolute;
width: 3px;
height: 3px;
border-radius: 50%;
background: #cfe3ff;
opacity: .2;
animation: snv-twinkle 3.2s ease-in-out infinite;
}
.snv-stars span:nth-child(1) { top: 12%; left: 10%; }
.snv-stars span:nth-child(2) { top: 22%; left: 80%; animation-delay: .5s; }
.snv-stars span:nth-child(3) { top: 7%; left: 52%; animation-delay: 1s; }
.snv-stars span:nth-child(4) { top: 34%; left: 16%; animation-delay: 1.5s; }
.snv-stars span:nth-child(5) { top: 16%; left: 90%; animation-delay: .9s; }
.snv-stars span:nth-child(6) { top: 44%; left: 6%; animation-delay: 2s; }
.snv-stars span:nth-child(7) { top: 48%; left: 92%; animation-delay: .3s; }
.snv-stars span:nth-child(8) { top: 6%; left: 30%; animation-delay: 1.8s; }
.snv-stars span:nth-child(9) { top: 62%; left: 12%; animation-delay: 2.4s; }
.snv-stars span:nth-child(10) { top: 58%; left: 86%; animation-delay: 1.2s; }
.snv-comet {
position: absolute;
top: 14%;
left: -12%;
width: 90px;
height: 2px;
border-radius: 2px;
background: linear-gradient(90deg, transparent, #bfdbfe);
filter: drop-shadow(0 0 4px rgba(191, 219, 254, .9));
opacity: 0;
animation: snv-comet 11s linear infinite;
}
.snv-glow {
position: absolute;
left: 50%;
top: 56%;
width: 320px;
height: 320px;
transform: translate(-50%, -50%);
background: radial-gradient(circle, rgba(59, 130, 246, .3), rgba(124, 58, 237, .14) 45%, transparent 70%);
opacity: .8;
transition: opacity .4s ease;
}
.snv-scene:hover .snv-glow { opacity: 1; }
.snv-robot {
position: absolute;
left: 50%;
bottom: 58px;
width: 200px;
height: 246px;
margin-left: -100px;
animation: snv-float 4.5s ease-in-out infinite;
}
.snv-antenna {
position: absolute;
top: 0;
left: 50%;
width: 4px;
height: 34px;
margin-left: -2px;
border-radius: 2px;
background: linear-gradient(180deg, #93c5fd, #3b82f6);
}
.snv-antenna-tip {
position: absolute;
top: -9px;
left: 50%;
width: 16px;
height: 16px;
margin-left: -8px;
border-radius: 50%;
background: radial-gradient(circle at 35% 35%, #bfdbfe, #60a5fa 60%, #2563eb);
animation: snv-beacon 2.4s ease-in-out infinite;
}
.snv-head {
position: absolute;
top: 32px;
left: 50%;
width: 108px;
height: 82px;
margin-left: -54px;
border-radius: 20px 20px 26px 26px;
background: linear-gradient(180deg, #eaf1ff, #bccbee 68%, #96abd2);
border: 1px solid rgba(255, 255, 255, .4);
box-shadow: inset 0 -8px 14px rgba(30, 58, 138, .18), 0 10px 24px -12px rgba(15, 23, 42, .6);
}
.snv-ear {
position: absolute;
top: 27px;
width: 10px;
height: 28px;
border-radius: 5px;
background: linear-gradient(180deg, #60a5fa, #2563eb);
box-shadow: 0 0 8px rgba(59, 130, 246, .55);
}
.snv-ear-l { left: -9px; }
.snv-ear-r { right: -9px; }
.snv-eye {
position: absolute;
top: 24px;
width: 18px;
height: 18px;
border-radius: 50%;
background: radial-gradient(circle at 35% 35%, #e0f2fe, #22d3ee 55%, #0891b2);
box-shadow: 0 0 10px 2px rgba(34, 211, 238, .6);
animation: snv-blink 5.5s ease-in-out infinite;
}
.snv-eye-l { left: 23px; }
.snv-eye-r { right: 23px; }
.snv-mouth {
position: absolute;
left: 50%;
bottom: 13px;
width: 30px;
height: 8px;
margin-left: -15px;
border-radius: 4px;
background: linear-gradient(90deg, #334155, #475569);
animation: snv-talk 4.5s ease-in-out infinite;
}
.snv-neck {
position: absolute;
top: 104px;
left: 50%;
width: 26px;
height: 18px;
margin-left: -13px;
border-radius: 5px;
background: linear-gradient(180deg, #94a3b8, #64748b);
}
.snv-torso {
position: absolute;
top: 120px;
left: 50%;
width: 124px;
height: 92px;
margin-left: -62px;
border-radius: 22px;
background: linear-gradient(180deg, #dfe9fc, #b2c3e4 65%, #8fa5cb);
border: 1px solid rgba(255, 255, 255, .4);
box-shadow: inset 0 -10px 16px rgba(30, 58, 138, .2), 0 14px 28px -14px rgba(15, 23, 42, .65);
}
.snv-core {
position: absolute;
top: 50%;
left: 50%;
width: 36px;
height: 36px;
margin: -18px 0 0 -18px;
border-radius: 50%;
background: radial-gradient(circle at 35% 35%, #fef9c3, #fbbf24 55%, #d97706);
animation: snv-core 2.2s ease-in-out infinite;
}
.snv-arm {
position: absolute;
top: 126px;
width: 16px;
height: 62px;
border-radius: 8px;
background: linear-gradient(180deg, #cbd5e1, #8fa0b6);
border: 1px solid rgba(255, 255, 255, .28);
transform-origin: 50% 9px;
}
.snv-arm-l { left: 24px; animation: snv-sway 4.5s ease-in-out infinite; }
.snv-arm-r { right: 24px; animation: snv-wave 2.6s ease-in-out infinite; }
.snv-legs {
position: absolute;
top: 206px;
left: 50%;
width: 64px;
height: 36px;
margin-left: -32px;
display: flex;
justify-content: space-between;
}
.snv-leg {
width: 18px;
height: 36px;
border-radius: 7px 7px 9px 9px;
background: linear-gradient(180deg, #9fb0c6, #64748b);
border: 1px solid rgba(255, 255, 255, .22);
animation: snv-kick 4.5s ease-in-out infinite;
}
.snv-leg:first-child { animation-delay: .12s; }
.snv-shadow {
position: absolute;
left: 50%;
bottom: 20px;
width: 160px;
height: 20px;
margin-left: -80px;
border-radius: 50%;
background: radial-gradient(ellipse, rgba(59, 130, 246, .45), transparent 70%);
animation: snv-shadow 4.5s ease-in-out infinite;
}
@keyframes snv-rise {
from { opacity: 0; transform: translateY(14px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes snv-shimmer {
from { background-position: 0% 50%; }
to { background-position: 200% 50%; }
}
@keyframes snv-twinkle {
0%, 100% { opacity: .15; transform: scale(1); }
50% { opacity: .9; transform: scale(1.35); }
}
@keyframes snv-comet {
0% { transform: translate(0, 0) rotate(9deg); opacity: 0; }
3% { opacity: 1; }
16% { transform: translate(460px, 74px) rotate(9deg); opacity: 0; }
100% { transform: translate(460px, 74px) rotate(9deg); opacity: 0; }
}
@keyframes snv-float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-16px); }
}
@keyframes snv-beacon {
0%, 100% { box-shadow: 0 0 6px 1px rgba(96, 165, 250, .45); transform: scale(1); }
50% { box-shadow: 0 0 18px 6px rgba(96, 165, 250, .95); transform: scale(1.18); }
}
@keyframes snv-blink {
0%, 90%, 100% { transform: scaleY(1); }
93% { transform: scaleY(.08); }
96% { transform: scaleY(1); }
}
@keyframes snv-talk {
0%, 86%, 100% { height: 8px; }
89% { height: 4px; }
92% { height: 11px; }
95% { height: 5px; }
}
@keyframes snv-core {
0%, 100% { transform: scale(1); box-shadow: 0 0 10px 3px rgba(251, 191, 36, .45); }
50% { transform: scale(1.12); box-shadow: 0 0 22px 8px rgba(251, 191, 36, .8); }
}
@keyframes snv-sway {
0%, 100% { transform: rotate(4deg); }
50% { transform: rotate(-4deg); }
}
@keyframes snv-wave {
0%, 100% { transform: rotate(10deg); }
20% { transform: rotate(-62deg); }
40% { transform: rotate(-24deg); }
60% { transform: rotate(-56deg); }
80% { transform: rotate(-18deg); }
}
@keyframes snv-kick {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(3px); }
}
@keyframes snv-shadow {
0%, 100% { transform: scale(1); opacity: .85; }
50% { transform: scale(.85); opacity: .5; }
}
@media (max-width: 480px) {
.snv-title { font-size: 2.2rem; }
.snv-scene { height: 300px; }
}
@media (prefers-reduced-motion: reduce) {
.snv-title,
.snv-subtitle,
.snv-scene,
.snv-scene * {
animation: none !important;
}
}
</style>
</div>
</div>
{{template "base/footer" .}}