Documentation
¶
Index ¶
- Constants
- Variables
- func CopyDir(src, dst string) error
- func GenerateDockerfile(baseImage string) string
- func GenerateDockerfileWithNixhome(baseImage string, withNixhome bool, stack string, modules []string) string
- func GenerateFlakeNix(stack string, modules []string, ver string, withNixhome bool) string
- func IsGitURL(source string) bool
- func IsInitialized(dir string) bool
- func NixhomeSource(configDir string) string
- func RegenerateBuildContext(configDir string, cellCfg cfg.CellConfig) error
- func ResolveNixhome(source, buildDir, ver string, force bool) error
- func Scaffold(dir string, modelsSnippet string, nixhomePath string, force bool, ...) error
- func ScaffoldLinuxVagrantfile(...) error
- func ScaffoldVagrantLinuxStack(nixhomeDir, stack string, modules []string) error
- func ScaffoldVagrantfile(dir, vagrantBox, nixhomePath string) error
- func ScaffoldWithModules(dir string, modelsSnippet string, nixhomePath string, force bool, stack string, ...) error
- func SyncNixhome(srcPath, configDir string) error
Constants ¶
const NixhomeSourceFile = ".devcell-source"
NixhomeSourceFile is the metadata file that tracks which source was used to populate .devcell/nixhome/. Used to detect when a different source would overwrite an existing nixhome.
Variables ¶
var LinuxVagrantfileContent []byte
Functions ¶
func GenerateDockerfile ¶ added in v0.4.0
GenerateDockerfile produces a Dockerfile string for the .devcell/ build context. baseImage overrides the FROM line; empty uses runner.BaseImageTag().
func GenerateDockerfileWithNixhome ¶ added in v0.4.0
func GenerateDockerfileWithNixhome(baseImage string, withNixhome bool, stack string, modules []string) string
GenerateDockerfileWithNixhome produces a Dockerfile with optional nixhome COPY. stack and modules are embedded as ARG defaults for /etc/devcell/metadata.json.
func GenerateFlakeNix ¶ added in v0.4.0
GenerateFlakeNix produces a flake.nix string that imports the given stack and modules from the upstream devcell nixhome flake. stack is a stack name (e.g. "go"), modules is a list of module names, ver is the version tag, nixhomePath overrides the input URL to path:./nixhome.
func IsGitURL ¶ added in v0.4.0
IsGitURL returns true if source looks like a git URL or GitHub shorthand.
func IsInitialized ¶
IsInitialized returns true when .devcell.toml exists in dir.
func NixhomeSource ¶ added in v0.4.0
NixhomeSource reads the source origin from .devcell/nixhome/.devcell-source. Returns "" if the file doesn't exist.
func RegenerateBuildContext ¶ added in v0.4.0
func RegenerateBuildContext(configDir string, cellCfg cfg.CellConfig) error
RegenerateBuildContext regenerates all build artifacts (flake.nix, Dockerfile, package.json, pyproject.toml) from the merged config. Call before every build so that changes to stack/modules in devcell.toml take effect without re-running cell init.
Cache optimization: when the user picks a known stack, we try to use the pre-built stack image (ghcr.io/dimmkirr/devcell:latest-<stack>) as the FROM line. This lets Docker/nix reuse the existing /nix/store paths from that image — only the delta is downloaded. If the pre-built image isn't available (not yet pushed, network error), we fall back to the core image.
func ResolveNixhome ¶ added in v0.4.0
ResolveNixhome pulls nixhome into buildDir/nixhome/ from the given source.
- Local path: copy directly (rsync-like)
- Git URL: shallow sparse clone, extract nixhome/ subdir
- Empty source: clone from upstream repo at the given version tag
Skips if buildDir/nixhome/ already exists and force is false.
func ScaffoldLinuxVagrantfile ¶ added in v0.5.0
func ScaffoldLinuxVagrantfile(dir, vagrantBox, provider, stack, projectDir, nixhomeDir, vncPort, rdpPort, hostHome, configDir string) error
ScaffoldLinuxVagrantfile writes a Linux Vagrantfile (Debian ARM64 + Nix) to dir, substituting all template placeholders from the provided arguments. hostHome is the host user's home directory (e.g. /home/dmitry) used to locate ~/.claude/ directories. configDir is the devcell config directory (e.g. ~/.config/devcell) shared into /etc/devcell/config inside the VM. Skips writing if a Vagrantfile already exists (idempotent).
func ScaffoldVagrantLinuxStack ¶ added in v0.5.0
ScaffoldVagrantLinuxStack generates hosts/linux/stack.nix inside nixhomeDir to reflect the current stack + extra modules from .devcell.toml. Always overwrites — this file is generated before each nixhome upload. No-op when nixhomeDir is empty (GitHub fallback: default stack.nix from repo).
func ScaffoldVagrantfile ¶
ScaffoldVagrantfile writes a Vagrantfile to dir substituting:
- {{VAGRANT_BOX}} with vagrantBox (empty → falls back to MACOS_BOX env var at runtime)
- {{NIXHOME_PATH}} with nixhomePath (empty → falls back to NIXHOME_PATH env var at runtime)
Skips writing if a Vagrantfile already exists (idempotent).
func ScaffoldWithModules ¶ added in v0.4.0
func ScaffoldWithModules(dir string, modelsSnippet string, nixhomePath string, force bool, stack string, modules []string) error
Scaffold writes .devcell.toml to dir (project root) and build artifacts (Dockerfile, flake.nix, package.json, pyproject.toml, starship.toml) to dir/.devcell/ (build context, gitignored). ScaffoldWithModules is like Scaffold but also writes the selected modules list.
func SyncNixhome ¶ added in v0.3.0
SyncNixhome copies the nixhome directory from srcPath into configDir/nixhome/. It replaces any existing nixhome copy to ensure fresh content each build. Also removes the outer flake.lock so nix regenerates it from the inner nixhome's inputs — prevents stale lock from pinning different nixpkgs than the base image, which would cause a full re-download. Writes .devcell-source to track the origin.
Types ¶
This section is empty.