Nix Module Options

Index

  1. Core
  2. UCI Configuration
  3. Packages
  4. Files and Keys
  5. Secrets and Raw Commands
  6. Library Functions

Core

OptionTypeDefaultDescription
uci.packageManagerenum [ "opkg" "apk" ]"opkg"Package manager backend. Use apk on OpenWrt 25.12+, opkg on older releases.
uci.watchdogTimeoutint60Rollback watchdog timeout in seconds.
uci.verboseboolfalsePass --verbose to deploy (stage banners + remote set -x). A CLI -v takes precedence.
uci.portnullOr intnullSSH port injected into deploy; transport-only, ignored by compile/diff. A CLI --port takes precedence.
uci.identitynullOr strnullSSH identity path injected as --identity, shell-quoted; a string (not a path) so the key is not copied into the Nix store. A CLI -i takes precedence.

UCI Configuration

OptionTypeDefaultDescription
uci.settings(pkgs.formats.json {}).type{}UCI configuration (config → section → option).

Packages

OptionTypeDefaultDescription
uci.packageslistOf str[]Packages to install; prefix - to remove (e.g. -tcpdump).
uci.packageSources.opkgFeedslistOf str[]opkg feeds (src/gz <name> <url>), written to /etc/opkg/customfeeds.conf.
uci.packageSources.apkRepositorieslistOf str[]apk repository URLs, written to /etc/apk/repositories.d/customfeeds.list.
uci.packageSources.localPackageslistOf (either str path)[]Local .ipk / .apk files, streamed to the target /tmp/.

opkgFeeds and apkRepositories are mutually exclusive and must match packageManager.

Files and Keys

OptionTypeDefaultDescription
uci.fileslistOf (submodule)[]Custom files; see submodule below.
uci.sshKeyslistOf str[]Keys deployed to /etc/dropbear/authorized_keys (0600).
- sshKeys entries may carry an OpenSSH command="..." restriction, but the value must not contain shell metacharacters (;, &, `, `` ``, $(), $(, etc.). is_valid_authorized_keyrejects such keys as a conservative hardening measure — acommand= that embeds shell syntax is treated as a potential injection vector, not a literal. If you need restricted keys, keep the command a single quoted program path plus arguments with no shell operators.

uci.files.*

OptionTypeDefaultDescription
pathstrrequiredAbsolute destination path on the target.
contentnullOr strnullText content; empty string creates a zero-byte file. Mutually exclusive with base64.
base64nullOr strnullBase64 binary content. Mutually exclusive with content.
checksumnullOr strnullExpected SHA256; skips the write if the target hash matches.
executableboolfalsetrue sets 0755, false sets 0644.

Secrets and Raw Commands

OptionTypeDefaultDescription
uci.secrets.sops.fileslistOf path[]SOPS-encrypted files, decrypted in memory at compile time to fill @name@ placeholders.
uci.rawUcilistOf str[]Raw UCI command lines; must start with "uci ".

@name@ placeholder scope: settings option values, opkgFeeds / apkRepositories, rawUci, files.content, sshKeys. Not supported in packages, localPackages, or files.base64.

Library Functions (nix/default.nix)

writeUci configuration

Returns json (a derivation producing uci.json) and command (a wrapper script running nuci compile / nuci deploy).

buildFirmware { configuration, profile, release ? null }

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