diff --git a/internal/config/config.go b/internal/config/config.go index 1ff0a1f..42d2274 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -45,6 +45,22 @@ type ShellConfigSection struct { Blocks []ShellConfigBlock `yaml:"blocks"` } +type NeovimConfig struct { + NvChadStarterRepo string `yaml:"nvchad_starter_repo"` +} + +type RenodePlatform struct { + Name string `yaml:"name"` + ReplPath string `yaml:"repl_path"` + Machine string `yaml:"machine"` +} + +type RenodeConfig struct { + WokwiVersion string `yaml:"wokwi_version"` + WokwiURL string `yaml:"wokwi_url"` + Platforms []RenodePlatform `yaml:"platforms"` +} + // Config is the fully-resolved runtime configuration. type Config struct { Version int `yaml:"version"` @@ -58,6 +74,8 @@ type Config struct { Zellij ZellijConfig `yaml:"zellij"` Themes ThemesConfig `yaml:"themes"` ShellConfig ShellConfigSection `yaml:"shell_config"` + Neovim NeovimConfig `yaml:"neovim"` + Renode RenodeConfig `yaml:"renode"` } const currentVersion = 1 @@ -137,5 +155,11 @@ func merge(base, over Config) Config { if len(over.ShellConfig.Blocks) > 0 { out.ShellConfig = over.ShellConfig } + if over.Neovim.NvChadStarterRepo != "" { + out.Neovim = over.Neovim + } + if over.Renode.WokwiVersion != "" || len(over.Renode.Platforms) > 0 { + out.Renode = over.Renode + } return out } diff --git a/internal/config/config_test.go b/internal/config/config_test.go index db6cf95..4becd3c 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -73,6 +73,31 @@ func TestDefaultsCarryModuleInputs(t *testing.T) { } } +func TestDefaultsCarryPlan3bInputs(t *testing.T) { + cfg, err := Load("/nonexistent/overlay.yaml") + if err != nil { + t.Fatal(err) + } + if cfg.Neovim.NvChadStarterRepo == "" { + t.Error("Neovim.NvChadStarterRepo empty") + } + if cfg.Renode.WokwiVersion == "" { + t.Error("Renode.WokwiVersion empty") + } + if cfg.Renode.WokwiURL == "" { + t.Error("Renode.WokwiURL empty") + } + if len(cfg.Renode.Platforms) == 0 { + t.Error("Renode.Platforms empty") + } + want := map[string]string{"stm32f4": "STM32F4_Discovery", "rp2040": "RP2040", "nrf52840": "nRF52840"} + for _, p := range cfg.Renode.Platforms { + if want[p.Name] != p.Machine { + t.Errorf("platform %q: machine=%q want %q", p.Name, p.Machine, want[p.Name]) + } + } +} + func TestLoadRejectsUnknownVersion(t *testing.T) { dir := t.TempDir() path := filepath.Join(dir, "overlay.yaml") diff --git a/internal/config/defaults.yaml b/internal/config/defaults.yaml index ff2bc1f..f609072 100644 --- a/internal/config/defaults.yaml +++ b/internal/config/defaults.yaml @@ -80,3 +80,20 @@ shell_config: alias v="nvim" alias y="yazi" alias theme="archduino-theme" + +neovim: + nvchad_starter_repo: "https://github.com/NvChad/starter" + +renode: + wokwi_version: "0.28.1" + wokwi_url: "https://github.com/wokwi/wokwi-cli/releases/download/v0.28.1/wokwi-cli-linuxstatic-x64" + platforms: + - name: stm32f4 + repl_path: "platforms/boards/stm32f4_discovery.repl" + machine: "STM32F4_Discovery" + - name: rp2040 + repl_path: "platforms/cpus/rp2040.repl" + machine: "RP2040" + - name: nrf52840 + repl_path: "platforms/cpus/nrf52840.repl" + machine: "nRF52840"