Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Nix Module Options Specification

Verified 1:1 against nix/module-options.nix and nix/default.nix.

Options Reference

OptionTypeDefaultDescription / Output Mapping
uci.packageManagerenum [ "opkg" "apk" ]"opkg"Package backend (opkg ≤ 23.05, apk 24.10+).
uci.settings(pkgs.formats.json {}).type{}UCI configuration attrset (config → section → option).
uci.secrets.sops.fileslistOf path[]SOPS encrypted files decrypted in-memory at compile time.
uci.packageslistOf str[]Packages to install. Prefix with - to remove (-pkg).
uci.packageSources.feedslistOf str[]Repository lines (/etc/opkg/customfeeds.conf or /etc/apk/repositories.d/customfeeds.list).
uci.packageSources.localPackageslistOf (either str path)[]Local .ipk/.apk paths, streamed via in-memory tar to /tmp/.
uci.sshKeyslistOf str[]Public keys deployed to /etc/dropbear/authorized_keys (0600).
uci.watchdogTimeoutint60Rollback watchdog timeout in seconds.
uci.rawUcilistOf str[]Raw UCI lines (must start with "uci "). Auto-touches missing /etc/config/<file>.
uci.fileslistOf (submodule)[]Custom file payloads (spec below).

uci.files.* Submodule Options

OptionTypeDefaultDescription
pathstr(required)Absolute destination path on target.
contentnullOr strnullText content (written via POSIX cat heredoc). Empty string creates a zero-byte file.
base64nullOr strnullBase64 binary payload (decoded via base64 -d). Mutually exclusive with content.
checksumnullOr strnullExpected SHA256 hex. Skips write if target hash matches.
executableboolfalseFile mode (true0755, false0644).

Nix Library Functions (nix/default.nix)

writeUci configuration

Evaluates Nix configuration module and returns:

  • json: Derivation generating uci.json.
  • command: Wrapper script executing nuci compile or nuci deploy (forwards $@ flags).

buildFirmware { configuration, profile, release ? null }

Combines nuci with nix-openwrt-imagebuilder:

  • Bakes compiled UCI directives into /etc/uci-defaults/99-nuci-bootstrap.
  • Inherits settings, packages, packageSources, sshKeys, files, and rawUci.