feat: system config DSL, services, CLI with rustc diagnostics
- System config parser (system/packages/services/boot/users blocks) - Boot block: kernel, init, efi, swap, bootloader, root partition - System-wide features, rollback config, swap partition - Service block: per-init variants (runit, s6, etc.), system init selection via boot.init - Feature-gated dependencies, config values accept numbers/bools/strings - CLI: parse-package, parse-config, validate subcommands - Rustc-style error diagnostics with source context, carets, help text - Diagnostic module with ANSI color output
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Kappa system configuration.
|
||||
* Lives at /kappa/system/config.kap
|
||||
*/
|
||||
system {
|
||||
hostname = "kappa.local"
|
||||
timezone = "America/New_York"
|
||||
|
||||
features {
|
||||
ssl = true
|
||||
wayland = false
|
||||
pulseaudio = false
|
||||
}
|
||||
|
||||
env {
|
||||
CFLAGS = "-O2 -march=native"
|
||||
LDFLAGS = "-Wl,--as-needed"
|
||||
MAKEFLAGS = "-j8"
|
||||
}
|
||||
|
||||
config {
|
||||
prefix = "/usr"
|
||||
log_dir = "/var/log"
|
||||
}
|
||||
|
||||
rollback {
|
||||
keep = 5
|
||||
}
|
||||
}
|
||||
|
||||
packages {
|
||||
foo {
|
||||
version = ">=1.2"
|
||||
features {
|
||||
gui = true
|
||||
}
|
||||
config {
|
||||
port = "9090"
|
||||
ssl = true
|
||||
}
|
||||
}
|
||||
bar {}
|
||||
baz {
|
||||
features {
|
||||
ssl = false
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// Per-package overrides can also live in
|
||||
// /kappa/system/builds/<name>.kap
|
||||
*/
|
||||
}
|
||||
|
||||
services {
|
||||
nginx {
|
||||
enable = true
|
||||
port = 80
|
||||
ssl = true
|
||||
}
|
||||
sshd {
|
||||
enable = true
|
||||
port = 22
|
||||
}
|
||||
cron {
|
||||
enable = false
|
||||
}
|
||||
}
|
||||
|
||||
boot {
|
||||
kernel = "linux"
|
||||
init = "s6"
|
||||
efi = "/dev/sda2"
|
||||
swap = "/dev/sda3"
|
||||
bootloader = "limine"
|
||||
root = "/dev/sda1"
|
||||
}
|
||||
|
||||
users {
|
||||
specter {
|
||||
shell = "/bin/zsh"
|
||||
groups = ["wheel", "audio", "docker"]
|
||||
}
|
||||
root {
|
||||
shell = "/bin/zsh"
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,20 @@ package "foo" {
|
||||
CFLAGS ?= "-g"
|
||||
}
|
||||
|
||||
service {
|
||||
runit {
|
||||
exec = "/usr/bin/foo --daemon"
|
||||
type = "forking"
|
||||
user = "foo"
|
||||
}
|
||||
s6 {
|
||||
exec = "/usr/bin/foo"
|
||||
type = "longrun"
|
||||
ports = [80, 443]
|
||||
user = "foo"
|
||||
}
|
||||
}
|
||||
|
||||
prepare {
|
||||
patch "fix-build.patch"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user