repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
nixmod.mdMarkdown79 lines3.8 KiBrendered raw download
# Nixmod

`nixmod new TOOL` reads the program and service options from the Home Manager
and NixOS versions pinned in this checkout's `flake.lock`. It prefers a Home
Manager module when both provide one. Nix fetches the pinned inputs if needed;
nixmod does not need a separate Home Manager installation or a lock-file update.

For a recognized tool, it enables the module, generates its available options,
adds the import, and evaluates the selected host. Upstream examples stay commented.
When an option has an empty-set default and a structured example, its wrapper
is already active, so you can uncomment or add individual settings inside it.
It does not replace existing modules unless you explicitly pass `--force`.

## Supply settings when creating a module

```sh
nixmod new gallery-dl --set 'settings.extractor.base-directory=~/Downloads/gallery-dl/'
nixmod new kitty --set font.size=12 --set 'settings.enable_audio_bell=false'
nixmod new gallery-dl --dry-run --set 'settings.extractor.base-directory=~/Downloads/gallery-dl/'
```

`--set` is repeatable. Paths are relative to the selected option tree; fully
qualified paths such as `programs.gallery-dl.settings.extractor.base-directory`
also work. Values are JSON booleans, numbers, lists, objects or null, or plain
strings. To keep a string such as `true` or `123` as text, use a JSON string:
`--set 'settings.example="true"'`. Quote the whole argument to preserve spaces
and shell characters. Attribute names containing dots can be quoted inside the
path: `--set 'settings."a.b"=value'`.

Nixmod rejects unknown Home Manager / NixOS option paths and overlapping
assignments. Home Manager sometimes exposes application configuration as a
free-form JSON/TOML set. For those options, it knows where settings belong and
checks their Nix type, but application-specific key names and values still need
the application's documentation. It does not guess credentials or enable every
example from upstream.

## Inspect options and check edits

```sh
nixmod doc gallery-dl
nixmod doc programs.gallery-dl --home
nixmod search gallery
nixmod check gallery-dl
nixmod check
nh os build
```

`doc` includes the pinned module's source links, option descriptions, defaults
and examples. `check NAME` checks that file's syntax first, then evaluates the
selected host's complete system derivation. `check` without a name evaluates
the host. These checks do not download/build package outputs or activate NixOS;
they may fetch flake sources. `nh os build` performs the actual system build.

New program modules check their selected host by default, including after an
editor opened with `--edit` exits. A failed check returns a failure status and
keeps the file for correction. `--check` additionally evaluates both configured
hosts; `--no-check` skips automatic host evaluation. Other template types are
scaffolds and only evaluate hosts when `--check` is requested. `--no-wire` leaves
the module out of the imports and reports a syntax-only check. Host checks only
validate modules imported by that host; add an unwired module before relying on
the result. Package templates need `nix build .#NAME`.

The host defaults to the current hostname if it is a configuration in the
flake, or to the sole configuration when there is only one. With multiple
configurations and an unmatched hostname, nixmod requires `--host NAME` rather
than silently selecting another host. On the owner's laptop this is `nixos`,
with user `daemonsec`. Nixmod never activates a system or changes accounts.

## Run the checkout's version before activating it

The installed `nixmod` is packaged in the Nix store. To use changes from this
checkout immediately:

```sh
python3 -B modules/home/_nixmod/nixmod.py doc gallery-dl
python3 -B modules/home/_nixmod/nixmod.py check gallery-dl
```

Run these from the checkout, or provide `--repo /path/to/NixDaemon`.