nushell-sdk
This module provides the runtime environment for executing Nushell-basedDagger 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@2d0c0023fa55ecfbecfb923408debf34851f056aEntrypoint
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 \
containerfunc (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-sourcefunc (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-dirfunc (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-pathfunc (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-pathfunc (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-namefunc (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 \
debugfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | No description provided |
| contents | String ! | - | No description provided |
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
add-new-file --name string --contents stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| modSource | ModuleSource ! | - | No description provided |
| introspectionJson | File ! | - | 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
| Name | Type | Default Value | Description |
|---|---|---|---|
| modSource | ModuleSource ! | - | No description provided |
| introspectionJson | File ! | - | No description provided |
| outputFilePath | String ! | - | 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
| Name | Type | Default Value | Description |
|---|---|---|---|
| modSource | ModuleSource ! | - | No description provided |
| introspectionJson | File ! | - | No description provided |
| outputFilePath | String ! | - | 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
| Name | Type | Default Value | Description |
|---|---|---|---|
| modSource | ModuleSource ! | - | No description provided |
| introspectionJson | File ! | - | 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
| Name | Type | Default Value | Description |
|---|---|---|---|
| modSource | ModuleSource ! | - | No description provided |
| introspectionJson | File ! | - | 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 \
loadfunc (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-basefunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| introspectionJson | File ! | - | No description provided |
Example
dagger -m github.com/dagger/dagger/sdk/nushell/runtime@2d0c0023fa55ecfbecfb923408debf34851f056a call \
with-sdk --introspection-json file:pathfunc (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-sourcefunc (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()
}