Build

Build tool usage and dependency management. Use when building, adding dependencies, or fixing build errors.

Process

  1. Identify the namespace or file you need to build.
  2. Run bild <namespace> and review errors.
  3. If dependencies are missing, add dep comments or whitelist packages.
  4. Re-run bild until the build succeeds.
  5. Run bild --test <namespace> when tests exist.

Examples

bild Omni/Task.hs
bild --test Omni/Task.hs

Common Commands

bild Omni/Task.hs           # Build a namespace
bild --test Omni/Task.hs    # Build and run tests
bild --plan Omni/Task.hs    # Analyze without building
bild --time 0 Omni/Task.hs  # Build with no timeout

Output goes to _/bin/:

bild Omni/Task.hs
_/bin/task --help

Adding Dependencies

Python (in nixpkgs)

Just add the dep comment:

# : dep requests
import requests as Requests

Note: Use import X as Y pattern, not from X import Y.

Haskell (in nixpkgs)

Add to Omni/Bild/Deps/Haskell.nix whitelist:

[
  "aeson"
  "your-package"  # alphabetically
]

Not in nixpkgs

  1. deps add owner/repo -n package-name
  2. Set "auto-override": false in Sources.json
  3. Create derivation in Omni/Bild/Deps/

Lint and Type Check

lint Omni/Task.hs              # Lint
lint --fix Omni/Task.py        # Lint and auto-fix
typecheck.sh Omni/Example.py   # Type check Python

Common Errors

“attribute ‘foo’ missing”

The Haskell package isn’t whitelisted. Add it to Omni/Bild/Deps/Haskell.nix:

[
  ...
  "foo"  # Add alphabetically
  ...
]

Python “ModuleNotFoundError”

Check package name in nixpkgs:

nix-env -qaP -A nixpkgs.python312Packages | grep <name>

The nixpkgs name may differ from pip name.

Timeout during build

Use no timeout:

bild --time 0 <namespace>

“module X not found” (Haskell)

Check:

  1. File exists at the import path
  2. Module name matches file path
  3. Dep comment is present: -- : dep Omni/Other/Module.hs

Import not detected (Python)

bild only detects import X as Y pattern. Change:

# Wrong - bild won't detect
from requests import get

# Right - bild will detect
import requests as Requests

Package Name Lookup

# Find Python packages
nix-env -qaP -A nixpkgs.python312Packages | grep <name>

# Find Haskell packages
nix-env -qaP -A nixpkgs.haskellPackages | grep <name>

# Find system packages
nix-env -qaP -A nixpkgs | grep <name>

Dep Comments

Haskell:

-- : out myapp           -- Output binary name
-- : dep aeson           -- Hackage dependency
-- : dep Omni/Other.hs   -- Local module dependency

Python:

# : out myapp            # Output binary name
# : dep requests         # PyPI dependency
# : dep Omni/Other.py    # Local module dependency