Home

gen @main - refs - log -
-
https://git.jolheiser.com/gen.git
Generate Go flags and Nix module
gen / testdata / ugit.cue
- raw -
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Schema for ugitd configuration.
//
// This is the single source of truth: ffjsonnet validates config files
// against it, and gen (see go:generate in args.go) produces args_gen.go and
// nix/options.nix from it. The @go and @nix attributes are read by gen and
// ignored by CUE.
package ugit

// Fields using a definition inherit its attributes.
#Port: int & >0 & <65536 @nix(type=types.port)
#Path: string & !=""
#URL:  string & =~"^[a-z][a-z0-9+.-]*://"

// A profile link on the wire: "name,url". In Nix it's a { name, url }
// submodule, mapped back to the wire form by apply.
#ProfileLink: string & =~"^[^,]+,.+$" @go(type=profileLink, parse=parseProfileLink) @nix(type=profileLink.type, apply=profileLink.apply, import=profileLink)

// Path to directory containing repositories
"repo-dir": #Path | *".ugit" @nix(default="/var/lib/ugit/repos")

ssh: {
	// Enable SSH server
	enable: bool | *true

	// Path to authorized_keys
	"authorized-keys": #Path | *".ssh/authorized_keys" @nix(default="/var/lib/ugit/authorized_keys")

	// SSH clone URL base
	"clone-url": #URL | *"ssh://localhost:8448"

	// SSH port
	port: #Port | *8448

	// SSH host key (created if it doesn't exist)
	"host-key": #Path | *".ssh/ugit_ed25519" @nix(default="/var/lib/ugit/ugit_ed25519")
}

http: {
	// Enable HTTP server
	enable: bool | *true

	// HTTP clone URL base
	"clone-url": #URL | *"http://localhost:8449"

	// HTTP port
	port: #Port | *8449
}

meta: {
	// App title
	title: string | *"ugit"

	// App description
	description: string | *"Minimal git server"
}

profile: {
	// Username for index page
	username: string | *""

	// Email for index page
	email: string | *""

	// Link(s) for index page
	links: [...#ProfileLink]
}

log: {
	// Logging level
	level: "debug" | "info" | "warn" | "warning" | *"error" @go(type=slog.Level, parse=parseLogLevel, import="log/slog")

	// Print logs in JSON(L) format
	json: bool | *false
}

// Show private repos in web interface
"show-private": bool | *false