[package]
name = "microsandbox"
description = "`microsandbox` is the core library for the microsandbox project."
version.workspace = true
license.workspace = true
repository.workspace = true
authors.workspace = true
edition.workspace = true

[lib]
name = "microsandbox"
path = "lib/lib.rs"

[[bin]]
name = "microsandbox"
path = "bin/main.rs"

[features]
default = ["keyring", "net", "prebuilt"]
keyring = ["dep:dbus", "dep:keyring"]
ssh = ["dep:anyhow", "dep:russh", "dep:russh-sftp"]
prebuilt = [
    "microsandbox-filesystem/prebuilt",
    "microsandbox-runtime/prebuilt",
    "microsandbox-utils/http-client",
]
net = ["dep:microsandbox-network", "microsandbox-runtime/net"]

[dependencies]
anyhow = { workspace = true, optional = true }
astral-tokio-tar.workspace = true
async-compression = { workspace = true, features = ["tokio", "zstd", "gzip"] }
base64.workspace = true
bytes.workspace = true
chrono.workspace = true
ciborium.workspace = true
crossterm.workspace = true
dirs.workspace = true
docker_credential = "1.4.0"
flate2.workspace = true
futures.workspace = true
hex.workspace = true
libc.workspace = true
microsandbox-db.workspace = true
microsandbox-agent-client = { workspace = true, features = ["uds"] }
microsandbox-filesystem.workspace = true
microsandbox-image.workspace = true
microsandbox-metrics.workspace = true
microsandbox-migration.workspace = true
microsandbox-network = { workspace = true, optional = true }
microsandbox-protocol.workspace = true
microsandbox-runtime.workspace = true
microsandbox-types.workspace = true
microsandbox-utils.workspace = true
nix = { workspace = true, features = ["process", "signal", "term"] }
notify.workspace = true
rand.workspace = true
reqwest.workspace = true
russh = { workspace = true, optional = true }
russh-sftp = { workspace = true, optional = true }
scopeguard.workspace = true
sea-orm.workspace = true
serde.workspace = true
serde_json.workspace = true
sha2.workspace = true
tar.workspace = true
tempfile.workspace = true
thiserror.workspace = true
tokio.workspace = true
tokio-tungstenite.workspace = true
tracing.workspace = true
typed-builder.workspace = true
which.workspace = true

[build-dependencies]
flate2.workspace = true
microsandbox-utils.workspace = true
tar.workspace = true

[dev-dependencies]
ipnetwork.workspace = true
microsandbox-network.workspace = true
rcgen.workspace = true
rustls.workspace = true
tempfile.workspace = true
test-utils.workspace = true
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
tokio-rustls.workspace = true

[target.'cfg(target_os = "macos")'.dependencies]
keyring = { version = "3.6.3", features = ["apple-native"], optional = true }

[target.'cfg(target_os = "windows")'.dependencies]
keyring = { version = "3.6.3", features = ["windows-native"], optional = true }

[target.'cfg(target_os = "linux")'.dependencies]
# Transitive dep via keyring's Secret Service backend; declared here only to force the `vendored` feature
# so libdbus is built from source and statically linked (avoids needing libdbus-1-dev at build time).
dbus = { version = "0.9.11", features = ["vendored"], optional = true }
keyring = { version = "3.6.3", features = [
    "crypto-rust",
    "linux-native-sync-persistent",
], optional = true }
