veridian_kernel/pkg/ecosystem.rs
1//! Package Ecosystem Definitions
2//!
3//! Defines the VeridianOS package ecosystem: base system packages, essential
4//! applications, and architecture-specific driver packages. These are
5//! specifications describing what the ecosystem WILL contain, not compiled
6//! software.
7//!
8//! NOTE: Many types in this module are forward declarations for user-space
9//! APIs. They will be exercised when user-space process execution is
10//! functional. See TODO(user-space) markers for specific activation points.
11
12// User-space API forward declarations -- see NOTE above
13
14#[cfg(feature = "alloc")]
15extern crate alloc;
16
17#[cfg(feature = "alloc")]
18use alloc::{string::String, vec, vec::Vec};
19
20// ---------------------------------------------------------------------------
21// Types
22// ---------------------------------------------------------------------------
23
24/// A named set of related packages (e.g. "base-system", "dev-tools").
25#[cfg(feature = "alloc")]
26#[derive(Debug, Clone)]
27pub struct PackageSet {
28 /// Set name (e.g. "base-system")
29 pub name: String,
30 /// Human-readable description
31 pub description: String,
32 /// Packages belonging to this set
33 pub packages: Vec<PackageDefinition>,
34}
35
36/// Definition of a single package within a set.
37#[cfg(feature = "alloc")]
38#[derive(Debug, Clone)]
39pub struct PackageDefinition {
40 /// Package name
41 pub name: String,
42 /// Human-readable description
43 pub description: String,
44 /// Functional category
45 pub category: PackageCategory,
46 /// Whether this package is essential for a minimal installation
47 pub essential: bool,
48}
49
50/// Functional categories for packages in the ecosystem.
51#[derive(Debug, Clone, Copy, PartialEq, Eq)]
52pub enum PackageCategory {
53 /// Core base system packages (kernel, init, shell)
54 Base,
55 /// Core user-space utilities (ls, cat, cp, etc.)
56 CoreUtils,
57 /// Development tools (compilers, debuggers, build systems)
58 DevTools,
59 /// System libraries (libc, runtime support)
60 SystemLibs,
61 /// Text editors
62 TextEditor,
63 /// File management tools
64 FileManager,
65 /// Networking utilities
66 NetworkTools,
67 /// System monitoring tools
68 SystemMonitor,
69 /// Graphics/display drivers
70 GraphicsDriver,
71 /// Network interface drivers
72 NetworkDriver,
73 /// Storage device drivers
74 StorageDriver,
75 /// Input device drivers
76 InputDriver,
77}
78
79// ---------------------------------------------------------------------------
80// Helpers
81// ---------------------------------------------------------------------------
82
83/// Create a `PackageDefinition` with the given fields.
84#[cfg(feature = "alloc")]
85fn pkg(
86 name: &str,
87 description: &str,
88 category: PackageCategory,
89 essential: bool,
90) -> PackageDefinition {
91 PackageDefinition {
92 name: String::from(name),
93 description: String::from(description),
94 category,
95 essential,
96 }
97}
98
99/// Create a `PackageSet` with the given fields.
100#[cfg(feature = "alloc")]
101fn pkgset(name: &str, description: &str, packages: Vec<PackageDefinition>) -> PackageSet {
102 PackageSet {
103 name: String::from(name),
104 description: String::from(description),
105 packages,
106 }
107}
108
109// ---------------------------------------------------------------------------
110// Base System
111// ---------------------------------------------------------------------------
112
113/// Returns package sets for the minimal base system.
114///
115/// Sets:
116/// - `base-system`: kernel, init, shell, coreutils
117/// - `dev-tools`: compiler toolchain, build tools
118/// - `system-libs`: core libraries
119#[cfg(feature = "alloc")]
120pub fn get_base_system_packages() -> Vec<PackageSet> {
121 vec![
122 pkgset(
123 "base-system",
124 "Core operating system packages required for a minimal installation",
125 vec![
126 pkg(
127 "kernel",
128 "VeridianOS microkernel",
129 PackageCategory::Base,
130 true,
131 ),
132 pkg(
133 "init",
134 "System init process (PID 1)",
135 PackageCategory::Base,
136 true,
137 ),
138 pkg("vsh", "Veridian shell", PackageCategory::Base, true),
139 pkg(
140 "ls",
141 "List directory contents",
142 PackageCategory::CoreUtils,
143 true,
144 ),
145 pkg(
146 "cat",
147 "Concatenate and display files",
148 PackageCategory::CoreUtils,
149 true,
150 ),
151 pkg(
152 "cp",
153 "Copy files and directories",
154 PackageCategory::CoreUtils,
155 true,
156 ),
157 pkg(
158 "mv",
159 "Move or rename files",
160 PackageCategory::CoreUtils,
161 true,
162 ),
163 pkg(
164 "rm",
165 "Remove files and directories",
166 PackageCategory::CoreUtils,
167 true,
168 ),
169 pkg(
170 "mkdir",
171 "Create directories",
172 PackageCategory::CoreUtils,
173 true,
174 ),
175 pkg(
176 "chmod",
177 "Change file permissions",
178 PackageCategory::CoreUtils,
179 true,
180 ),
181 ],
182 ),
183 pkgset(
184 "dev-tools",
185 "Development toolchain and build utilities",
186 vec![
187 pkg(
188 "gcc-veridian",
189 "GCC cross-compiler targeting VeridianOS",
190 PackageCategory::DevTools,
191 false,
192 ),
193 pkg(
194 "binutils-veridian",
195 "GNU binutils for VeridianOS targets",
196 PackageCategory::DevTools,
197 false,
198 ),
199 pkg(
200 "make",
201 "GNU Make build system",
202 PackageCategory::DevTools,
203 false,
204 ),
205 pkg(
206 "pkg-config",
207 "Helper tool for compiling against libraries",
208 PackageCategory::DevTools,
209 false,
210 ),
211 pkg(
212 "cmake",
213 "Cross-platform build system generator",
214 PackageCategory::DevTools,
215 false,
216 ),
217 ],
218 ),
219 pkgset(
220 "system-libs",
221 "Core system libraries",
222 vec![
223 pkg(
224 "libc-veridian",
225 "C standard library for VeridianOS",
226 PackageCategory::SystemLibs,
227 true,
228 ),
229 pkg(
230 "libveridian",
231 "VeridianOS system call wrapper library",
232 PackageCategory::SystemLibs,
233 true,
234 ),
235 pkg(
236 "libcrypto-veridian",
237 "Cryptographic library with post-quantum support",
238 PackageCategory::SystemLibs,
239 false,
240 ),
241 ],
242 ),
243 ]
244}
245
246// ---------------------------------------------------------------------------
247// Essential Applications
248// ---------------------------------------------------------------------------
249
250/// Returns package sets for essential user-facing applications.
251///
252/// Sets:
253/// - `editors`: text editing
254/// - `file-management`: file management tools
255/// - `network-tools`: networking utilities
256/// - `system-monitor`: system monitoring
257#[cfg(feature = "alloc")]
258pub fn get_essential_apps() -> Vec<PackageSet> {
259 vec![
260 pkgset(
261 "editors",
262 "Text editors",
263 vec![pkg(
264 "ve",
265 "Veridian Editor -- terminal-based text editor",
266 PackageCategory::TextEditor,
267 false,
268 )],
269 ),
270 pkgset(
271 "file-management",
272 "File management utilities",
273 vec![pkg(
274 "vfm",
275 "Veridian File Manager -- TUI file browser",
276 PackageCategory::FileManager,
277 false,
278 )],
279 ),
280 pkgset(
281 "network-tools",
282 "Networking utilities",
283 vec![
284 pkg(
285 "vcurl",
286 "HTTP client for fetching URLs",
287 PackageCategory::NetworkTools,
288 false,
289 ),
290 pkg(
291 "vping",
292 "ICMP ping utility",
293 PackageCategory::NetworkTools,
294 false,
295 ),
296 pkg(
297 "vdns",
298 "DNS lookup utility",
299 PackageCategory::NetworkTools,
300 false,
301 ),
302 ],
303 ),
304 pkgset(
305 "system-monitor",
306 "System monitoring and process management",
307 vec![
308 pkg(
309 "vtop",
310 "Interactive process viewer",
311 PackageCategory::SystemMonitor,
312 false,
313 ),
314 pkg(
315 "vps",
316 "Process status listing",
317 PackageCategory::SystemMonitor,
318 false,
319 ),
320 ],
321 ),
322 ]
323}
324
325// ---------------------------------------------------------------------------
326// Driver Packages
327// ---------------------------------------------------------------------------
328
329/// Returns architecture-specific driver package sets.
330///
331/// Each driver set includes VirtIO drivers (available on all architectures)
332/// plus native hardware drivers specific to the given architecture.
333///
334/// Supported architecture strings: `"x86_64"`, `"aarch64"`, `"riscv64"`.
335#[cfg(feature = "alloc")]
336pub fn get_driver_packages(arch: &str) -> Vec<PackageSet> {
337 let mut sets = Vec::new();
338
339 // -- Graphics drivers ---------------------------------------------------
340 let mut graphics = vec![pkg(
341 "virtio-gpu",
342 "VirtIO GPU driver",
343 PackageCategory::GraphicsDriver,
344 false,
345 )];
346 if arch == "x86_64" {
347 graphics.push(pkg(
348 "i915",
349 "Intel integrated graphics driver",
350 PackageCategory::GraphicsDriver,
351 false,
352 ));
353 }
354 sets.push(pkgset(
355 "graphics-drv",
356 "Graphics and display drivers",
357 graphics,
358 ));
359
360 // -- Network drivers ----------------------------------------------------
361 let mut network = vec![pkg(
362 "virtio-net",
363 "VirtIO network driver",
364 PackageCategory::NetworkDriver,
365 false,
366 )];
367 if arch == "x86_64" {
368 network.push(pkg(
369 "e1000",
370 "Intel Gigabit Ethernet driver",
371 PackageCategory::NetworkDriver,
372 false,
373 ));
374 }
375 sets.push(pkgset("network-drv", "Network interface drivers", network));
376
377 // -- Storage drivers ----------------------------------------------------
378 let mut storage = vec![pkg(
379 "virtio-blk",
380 "VirtIO block storage driver",
381 PackageCategory::StorageDriver,
382 false,
383 )];
384 if arch == "x86_64" {
385 storage.push(pkg(
386 "nvme",
387 "NVMe solid-state drive driver",
388 PackageCategory::StorageDriver,
389 false,
390 ));
391 }
392 if arch == "aarch64" {
393 storage.push(pkg(
394 "sd-mmc",
395 "SD/MMC card driver",
396 PackageCategory::StorageDriver,
397 false,
398 ));
399 }
400 sets.push(pkgset("storage-drv", "Storage device drivers", storage));
401
402 // -- Input drivers ------------------------------------------------------
403 let mut input: Vec<PackageDefinition> = Vec::new();
404 if arch == "x86_64" {
405 input.push(pkg(
406 "ps2-keyboard",
407 "PS/2 keyboard driver",
408 PackageCategory::InputDriver,
409 false,
410 ));
411 }
412 input.push(pkg(
413 "usb-hid",
414 "USB Human Interface Device driver",
415 PackageCategory::InputDriver,
416 false,
417 ));
418 sets.push(pkgset("input-drv", "Input device drivers", input));
419
420 sets
421}