Set up initial structure for the nix builder.

This commit is contained in:
Tom Alexander
2026-02-14 13:31:21 -05:00
commit 9344e5708f
19 changed files with 2267 additions and 0 deletions

1
src/cli/mod.rs Normal file
View File

@@ -0,0 +1 @@
pub(crate) mod parameters;

52
src/cli/parameters.rs Normal file
View File

@@ -0,0 +1,52 @@
use clap::Args;
use clap::Parser;
use clap::Subcommand;
use std::path::PathBuf;
#[derive(Parser, Debug)]
#[command(name = "nix_builder")]
#[command(version = env!("CARGO_PKG_VERSION"))]
#[command(about = "Build nix packages.", long_about = None)]
#[command(propagate_version = true)]
pub(crate) struct Cli {
#[command(subcommand)]
pub(crate) command: Commands,
}
#[derive(Subcommand, Debug)]
pub(crate) enum Commands {
/// Run a single build.
Build(BuildArgs),
/// Launch a daemon to run builds.
Daemon(DaemonArgs),
}
#[derive(Args, Debug)]
pub(crate) struct BuildArgs {
/// Path to the nix_builder config file.
#[arg(short, long)]
pub(crate) config: PathBuf,
/// The target to build.
#[arg(short, long)]
pub(crate) target: Vec<String>,
}
#[derive(Args, Debug)]
pub(crate) struct DaemonArgs {
/// Path to the nix_builder config file.
#[arg(short, long)]
pub(crate) path: PathBuf,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn verify_cli() {
use clap::CommandFactory;
Cli::command().debug_assert()
}
}