Skip to main content

LaunchPlan

Struct LaunchPlan 

Source
pub struct LaunchPlan {
    pub mounts: Vec<Mount>,
    pub env_literal: Vec<(String, String)>,
    pub env_passthrough: Vec<String>,
    pub args: Vec<String>,
    pub cap_add: Vec<String>,
}
Expand description

All caller-controlled variable parts of a container run invocation.

Session::start builds the fixed base flags and the workspace mount internally, then appends everything in this struct.

Assemble with LaunchPlan::default() and fill fields as needed, or collect them via run_package.

Fields§

§mounts: Vec<Mount>

Extra bind-mounts beyond the session workspace.

Each entry becomes a -v host:container:mode argument. Paths must already be canonical absolute host paths.

§env_literal: Vec<(String, String)>

Literal environment variables injected into the container.

Each (K, V) pair becomes a -e K=V argument.

§env_passthrough: Vec<String>

Environment variable names forwarded from npxc’s own process environment. Each name becomes a bare -e K argument; the container runtime inherits the value from npxc’s environment at launch time. Secrets never touch the npxc config file when this mechanism is used.

§args: Vec<String>

Arguments appended after the image tag.

These are forwarded verbatim to the container’s entrypoint.

§cap_add: Vec<String>

Linux capabilities to add back on top of --cap-drop ALL.

Each entry becomes a --cap-add <CAP> argument. Used by tunnel mode to grant NET_ADMIN so the entrypoint can configure wg0.

Implementations§

Source§

impl LaunchPlan

Source

pub fn build( pkg_name: &str, effective: &EffectiveConfig, cwd: &Path, args: Vec<String>, no_isolate: bool, ) -> Result<Self, NpxcError>

Assemble a LaunchPlan from the resolved package configuration.

Steps, in order:

  1. Populate env_literal and env_passthrough from effective.
  2. Store args verbatim.
  3. Validate and add each config-declared directory mount. Relative host paths are resolved against cwd; every path is checked to lie within the CWD scope via validate_path.
  4. When effective.storage.persist is set, create the per-package host directory under the platform data dir and add a read-write mount at /data.
  5. --no-isolate — when no_isolate is true, append a read-only bind-mount of the canonicalized CWD at its own absolute path so host paths resolve identically inside the guest.
§Errors

Returns NpxcError::PathOutOfScope or NpxcError::PathNotFound if a config-declared mount path fails CWD validation, or NpxcError::Io if the persistent storage directory cannot be created.

Trait Implementations§

Source§

impl Debug for LaunchPlan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LaunchPlan

Source§

fn default() -> LaunchPlan

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,