Dagger
Search

nushell-sdk

This module provides the runtime environment for executing Nushell-based
Dagger modules. It implements the ModuleRuntime and Codegen functions
required by Dagger to discover and execute functions in Nushell modules.

Installation

dagger install github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a

Entrypoint

Return Type
NushellSdk
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
func (m *MyModule) Example() *dagger.NushellSdk  {
	return dag.
			NushellSdk()
}
@function
def example() -> dagger.NushellSdk:
	return (
		dag.nushell_sdk()
	)
@func()
example(): NushellSdk {
	return dag
		.nushellSdk()
}

Types

NushellSdk 🔗

NushellSdk provides the runtime for Nushell-based Dagger modules

container() 🔗

Container is the active container instance

Return Type
Container !
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
 container
func (m *MyModule) Example() *dagger.Container  {
	return dag.
			NushellSdk().
			Container()
}
@function
def example() -> dagger.Container:
	return (
		dag.nushell_sdk()
		.container()
	)
@func()
example(): Container {
	return dag
		.nushellSdk()
		.container()
}

modSource() 🔗

ModSource contains the module source information

Return Type
ModuleSource !
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
 mod-source
func (m *MyModule) Example() *dagger.ModuleSource  {
	return dag.
			NushellSdk().
			ModSource()
}
@function
def example() -> dagger.ModuleSource:
	return (
		dag.nushell_sdk()
		.mod_source()
	)
@func()
example(): ModuleSource {
	return dag
		.nushellSdk()
		.modSource()
}

contextDir() 🔗

ContextDir is the module’s context directory

Return Type
Directory !
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
 context-dir
func (m *MyModule) Example() *dagger.Directory  {
	return dag.
			NushellSdk().
			ContextDir()
}
@function
def example() -> dagger.Directory:
	return (
		dag.nushell_sdk()
		.context_dir()
	)
@func()
example(): Directory {
	return dag
		.nushellSdk()
		.contextDir()
}

contextDirPath() 🔗

ContextDirPath is the filesystem path to the context directory

Return Type
String !
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
 context-dir-path
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			NushellSdk().
			ContextDirPath(ctx)
}
@function
async def example() -> str:
	return await (
		dag.nushell_sdk()
		.context_dir_path()
	)
@func()
async example(): Promise<string> {
	return dag
		.nushellSdk()
		.contextDirPath()
}

subPath() 🔗

SubPath is the subpath within the context directory

Return Type
String !
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
 sub-path
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			NushellSdk().
			SubPath(ctx)
}
@function
async def example() -> str:
	return await (
		dag.nushell_sdk()
		.sub_path()
	)
@func()
async example(): Promise<string> {
	return dag
		.nushellSdk()
		.subPath()
}

modName() 🔗

ModName is the module name

Return Type
String !
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
 mod-name
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			NushellSdk().
			ModName(ctx)
}
@function
async def example() -> str:
	return await (
		dag.nushell_sdk()
		.mod_name()
	)
@func()
async example(): Promise<string> {
	return dag
		.nushellSdk()
		.modName()
}

debug() 🔗

Debug enables debug mode with terminal access

Return Type
Boolean !
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
 debug
func (m *MyModule) Example(ctx context.Context) bool  {
	return dag.
			NushellSdk().
			Debug(ctx)
}
@function
async def example() -> bool:
	return await (
		dag.nushell_sdk()
		.debug()
	)
@func()
async example(): Promise<boolean> {
	return dag
		.nushellSdk()
		.debug()
}

addNewFile() 🔗

Helper method to add a new file with contents to the module’s source

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
nameString !-No description provided
contentsString !-No description provided
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
 add-new-file --name string --contents string
func (m *MyModule) Example(ctx context.Context, name string, contents string)   {
	return dag.
			NushellSdk().
			AddNewFile(ctx, name, contents)
}
@function
async def example(name: str, contents: str) -> None:
	return await (
		dag.nushell_sdk()
		.add_new_file(name, contents)
	)
@func()
async example(name: string, contents: string): Promise<void> {
	return dag
		.nushellSdk()
		.addNewFile(name, contents)
}

moduleRuntime() 🔗

ModuleRuntime returns a container configured to execute the Nushell module

This is the primary function called by Dagger to get an execution environment for user modules. It sets up a container with Nushell, mounts the user’s code, and configures the connection back to the Dagger Engine.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
modSourceModuleSource !-No description provided
introspectionJsonFile !-No description provided
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example(modSource *dagger.ModuleSource, introspectionJson *dagger.File) *dagger.Container  {
	return dag.
			NushellSdk().
			ModuleRuntime(modSource, introspectionJson)
}
@function
def example(mod_source: dagger.ModuleSource, introspection_json: dagger.File) -> dagger.Container:
	return (
		dag.nushell_sdk()
		.module_runtime(mod_source, introspection_json)
	)
@func()
example(modSource: ModuleSource, introspectionJson: File): Container {
	return dag
		.nushellSdk()
		.moduleRuntime(modSource, introspectionJson)
}

moduleTypes() 🔗

ModuleTypes discovers and returns the types defined in the Nushell module

This function parses the user’s Nushell code to extract exported functions and their signatures, then builds a Dagger Module with appropriate type definitions. The runtime.nu Nushell script handles the actual parsing.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
modSourceModuleSource !-No description provided
introspectionJsonFile !-No description provided
outputFilePathString !-No description provided
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example(modSource *dagger.ModuleSource, introspectionJson *dagger.File, outputFilePath string) *dagger.Container  {
	return dag.
			NushellSdk().
			ModuleTypes(modSource, introspectionJson, outputFilePath)
}
@function
def example(mod_source: dagger.ModuleSource, introspection_json: dagger.File, output_file_path: str) -> dagger.Container:
	return (
		dag.nushell_sdk()
		.module_types(mod_source, introspection_json, output_file_path)
	)
@func()
example(modSource: ModuleSource, introspectionJson: File, outputFilePath: string): Container {
	return dag
		.nushellSdk()
		.moduleTypes(modSource, introspectionJson, outputFilePath)
}

moduleTypesExp() 🔗

ModuleTypesExp is an alias for ModuleTypes for compatibility

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
modSourceModuleSource !-No description provided
introspectionJsonFile !-No description provided
outputFilePathString !-No description provided
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example(modSource *dagger.ModuleSource, introspectionJson *dagger.File, outputFilePath string) *dagger.Container  {
	return dag.
			NushellSdk().
			ModuleTypesExp(modSource, introspectionJson, outputFilePath)
}
@function
def example(mod_source: dagger.ModuleSource, introspection_json: dagger.File, output_file_path: str) -> dagger.Container:
	return (
		dag.nushell_sdk()
		.module_types_exp(mod_source, introspection_json, output_file_path)
	)
@func()
example(modSource: ModuleSource, introspectionJson: File, outputFilePath: string): Container {
	return dag
		.nushellSdk()
		.moduleTypesExp(modSource, introspectionJson, outputFilePath)
}

codegen() 🔗

Codegen generates code for the module (creates initial template)

During initialization, this function creates the template main.nu file For existing modules, it can generate Nushell bindings for Dagger types

Return Type
GeneratedCode !
Arguments
NameTypeDefault ValueDescription
modSourceModuleSource !-No description provided
introspectionJsonFile !-No description provided
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example(modSource *dagger.ModuleSource, introspectionJson *dagger.File) *dagger.GeneratedCode  {
	return dag.
			NushellSdk().
			Codegen(modSource, introspectionJson)
}
@function
def example(mod_source: dagger.ModuleSource, introspection_json: dagger.File) -> dagger.GeneratedCode:
	return (
		dag.nushell_sdk()
		.codegen(mod_source, introspection_json)
	)
@func()
example(modSource: ModuleSource, introspectionJson: File): GeneratedCode {
	return dag
		.nushellSdk()
		.codegen(modSource, introspectionJson)
}

common() 🔗

Common performs the shared setup steps for both ModuleRuntime and Codegen

This function orchestrates the setup pipeline: 1. Load module metadata 2. Create base Nushell container 3. Mount user module source 4. Set up Dagger Engine connection

Return Type
NushellSdk !
Arguments
NameTypeDefault ValueDescription
modSourceModuleSource !-No description provided
introspectionJsonFile !-No description provided
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example(modSource *dagger.ModuleSource, introspectionJson *dagger.File) *dagger.NushellSdk  {
	return dag.
			NushellSdk().
			Common(modSource, introspectionJson)
}
@function
def example(mod_source: dagger.ModuleSource, introspection_json: dagger.File) -> dagger.NushellSdk:
	return (
		dag.nushell_sdk()
		.common(mod_source, introspection_json)
	)
@func()
example(modSource: ModuleSource, introspectionJson: File): NushellSdk {
	return dag
		.nushellSdk()
		.common(modSource, introspectionJson)
}

load() 🔗

Load extracts module metadata and configuration

Return Type
NushellSdk !
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
 load
func (m *MyModule) Example() *dagger.NushellSdk  {
	return dag.
			NushellSdk().
			Load()
}
@function
def example() -> dagger.NushellSdk:
	return (
		dag.nushell_sdk()
		.load()
	)
@func()
example(): NushellSdk {
	return dag
		.nushellSdk()
		.load()
}

withBase() 🔗

WithBase creates the base Nushell container

Return Type
NushellSdk !
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
 with-base
func (m *MyModule) Example() *dagger.NushellSdk  {
	return dag.
			NushellSdk().
			WithBase()
}
@function
def example() -> dagger.NushellSdk:
	return (
		dag.nushell_sdk()
		.with_base()
	)
@func()
example(): NushellSdk {
	return dag
		.nushellSdk()
		.withBase()
}

withSdk() 🔗

WithSDK installs the Dagger SDK and sets up the introspection schema

Return Type
NushellSdk !
Arguments
NameTypeDefault ValueDescription
introspectionJsonFile !-No description provided
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
 with-sdk --introspection-json file:path
func (m *MyModule) Example(introspectionJson *dagger.File) *dagger.NushellSdk  {
	return dag.
			NushellSdk().
			WithSdk(introspectionJson)
}
@function
def example(introspection_json: dagger.File) -> dagger.NushellSdk:
	return (
		dag.nushell_sdk()
		.with_sdk(introspection_json)
	)
@func()
example(introspectionJson: File): NushellSdk {
	return dag
		.nushellSdk()
		.withSdk(introspectionJson)
}

withSource() 🔗

WithSource mounts the user’s module source code

Return Type
NushellSdk !
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
 with-source
func (m *MyModule) Example() *dagger.NushellSdk  {
	return dag.
			NushellSdk().
			WithSource()
}
@function
def example() -> dagger.NushellSdk:
	return (
		dag.nushell_sdk()
		.with_source()
	)
@func()
example(): NushellSdk {
	return dag
		.nushellSdk()
		.withSource()
}