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

Dubctl Flake Input Manager

dubctl is Dubnium’s small helper for managing top-level flake inputs. It is intended for quick add, remove, search, list, and update operations without hand-editing the common inputs = { ... }; block every time.

dubctl manages only flake inputs. It does not wire new inputs into outputs, NixOS modules, package sets, overlays, or Home Manager arguments. Make those call-site changes explicitly after adding an input.

Install and Run

From this repository:

nix run .#dubctl -- list

Install into a profile:

nix profile install .#dubctl
dubctl list --flake /path/to/dubnium

For local development without Nix packaging:

scripts/dubctl list

Commands

List current inputs:

dubctl list

Search input names and definitions:

dubctl search nix

Show one input definition:

dubctl info nixpkgs

Add an input:

dubctl install foo github:owner/repo

Add an input that follows nixpkgs:

dubctl install foo github:owner/repo --follows nixpkgs

Remove an input:

dubctl remove foo

Update all lock entries:

dubctl update

Update one lock entry:

dubctl update nixpkgs

Use a specific flake directory or file:

dubctl --flake /path/to/repo list
dubctl --flake /path/to/repo/flake.nix info nixpkgs

Lockfile Behavior

install and remove run nix flake lock after editing flake.nix. Use --no-lock when staging or testing a source-only change:

dubctl install foo github:owner/repo --no-lock
dubctl remove foo --no-lock

update runs nix flake update, with an optional input name.

Safety Model

dubctl treats command arguments as untrusted input.

Controls:

  • input names must be Nix attr-safe names
  • URLs cannot be empty and cannot contain quotes or newlines
  • edits are limited to the top-level inputs = { ... }; block
  • mutations write flake.nix.bak before changing flake.nix
  • Nix commands are invoked with argv arrays, not shell string concatenation

The backup is local operator safety only. Review the diff before committing.

When Not To Use Dubctl

Do not use dubctl for:

  • changing outputs arguments
  • adding module imports
  • adding overlays
  • changing Home Manager extra arguments
  • editing nested flakes such as external/dotfiles unless you pass that flake path explicitly

Those changes are architectural wiring, not package-manager operations.