Skip to content

pkgManager

pkgManager(opts?): Extension

Defined in: packages/core/src/presets/pkg-manager.ts:79

Install the pkg package manager and optional HTTP registry mounts.

PkgManagerOpts

Optional sources, fetcher, and ESM loader.

Extension

An Extension registering the pkg bin plus optional mounts.

Registers 1 bin (pkg) and 1 file (/etc/pkg/sources.list, newline-joined from opts.sources). When opts.fetcher is supplied, also mounts httpFS at /net/http and /net/https.

Trust contract. Every URL in sources is a trusted code origin. Packages fetched from these registries are evaluated in the host JavaScript context via new Function() — the same trust model as npm install. Trust is established at configuration time by the caller; only pass sources you trust.

The importEsm capability is optional at build time — the pkg bin is overridden at boot with the platform-specific implementation from PlatformCapabilities. Supply it here only for tests or other out-of-runtime composition.

import { Unix, pkgManager } from '@fishnet/core'
const image = await Unix()
.use(pkgManager({ sources: ['https://pkg.example.com/'], fetcher: globalThis.fetch }))
.build()

stdSystem