repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
README.mdMarkdown353 lines18.1 KiBrendered raw download
<div align="center">
  <img src="docs/images/nixdaemon-hero.svg" width="1000" alt="NixDaemon — a declarative NixOS offensive-security workstation in Gruvpine"/>

<p><strong>Your desktop, editor, toolkit, and lab workflow — declared in one flake.</strong><br/>
Built for authorised assessments, HackTheBox, and the CPTS path. The successor to IceBreaker.</p>

<p>
  <img src="https://img.shields.io/badge/NixOS-unstable-9ccfd8?style=for-the-badge&amp;logo=nixos&amp;logoColor=ebdbb2&amp;labelColor=32302f" alt="NixOS unstable"/>
  <img src="https://img.shields.io/badge/Flake-dendritic-b8bb26?style=for-the-badge&amp;labelColor=32302f" alt="Dendritic flake"/>
  <img src="https://img.shields.io/badge/Theme-Gruvpine-fabd2f?style=for-the-badge&amp;labelColor=32302f" alt="Gruvpine theme"/>
  <br/>
  <img src="https://img.shields.io/badge/Linux-x86__64%20%7C%20aarch64-c4a7e7?style=for-the-badge&amp;labelColor=32302f" alt="Linux: x86_64 and aarch64, with category limitations"/>
  <img src="https://img.shields.io/badge/Toolkit-23%20categories-eb6f92?style=for-the-badge&amp;labelColor=32302f" alt="23 toolkit categories"/>
  <img src="https://img.shields.io/badge/Checks-smoke%20%2B%20VM-ebbcba?style=for-the-badge&amp;labelColor=32302f" alt="Includes smoke checks and NixOS VM tests"/>
</p>

<p>
  <a href="docs/install.md"><strong>Install</strong></a> ·
  <a href="#03-daily-ops">Daily operations</a> ·
  <a href="#04-arsenal">Arsenal</a> ·
  <a href="docs/neovim.md">Editor guide</a> ·
  <a href="#10-theme">Gruvpine</a> ·
  <a href="docs/recovery.md">Recovery</a>
</p>
</div>

> **Choose the right host before installing or rebuilding.**
> `nixdaemon` is the generic template, with user `operator` by default.
> `nixos` is the owner's laptop, with user `daemonsec`.
> On an existing system, preserve its accounts and use its verified configuration.
> Switching to a different host can remove accounts and password hashes;
> rolling back a generation does not restore that mutable state.
> [Already locked out? Start with the recovery guide.](docs/recovery.md)

<a id="what-is-this"></a>
## Overview

<img src="docs/images/headers/00-what-is-this.svg" width="1000" alt="Overview: what is NixDaemon?"/>

NixDaemon brings the operating system and the working environment into the same
repository. Nix builds the tools and their dependencies; Home Manager configures
the shell and applications; small helpers connect the steps of a lab engagement.
The lock file pins the inputs, and each toolkit category has its own enable switch.

Start with a Niri desktop, a Nix-configured Neovim IDE, and the default assessment
toolkit. Choose an X11 desktop for a VM without 3D, or use a headless host.
The generic configuration stands on its own; the personal laptop adds private
identity, secrets, dotfiles, and hardware settings.

```sh
htbup                                      # connect the lab VPN
htbbox new Sauna 10.10.10.175 win easy       # create the box workspace and target
htbscan full                               # save scans under the box's recon directory
htbbox info                                # review ports, credentials, flags, and notes
htbcast -n enumeration                      # record a terminal session for the write-up
```

<a id="00-payload-manifest"></a>
## The workstation

<img src="docs/images/headers/01-payload-manifest.svg" width="1000" alt="Payload manifest: the workstation"/>

| Layer | What is included |
| --- | --- |
| **Desktop** | Niri + Noctalia by default. Optional XFCE or i3 for VMs without 3D, or a headless console/SSH setup. The shared palette currently selects **Gruvpine**. |
| **Editor** | Neovim through **nvf**: Nix-themed dashboard, file tree, completion, bracket pairing, Nix and Python language tools, formatting, Git signs, and Python debugging. [Keys and setup →](docs/neovim.md) |
| **Shell** | Zsh, Starship with target context, fzf, zoxide, Kitty, and Yazi. The generic host has a self-contained Home Manager setup; the laptop uses the owner's dotfiles. |
| **Toolkit** | 23 categories: 12 enabled by default on x86_64, 11 optional. Packages are available system-wide, including for commands run with `sudo`. |
| **Lab workflow** | VPN management, a shared `$TARGET`, clock-skew handling, per-box workspaces, scan imports, credentials and flags, and terminal recordings. |
| **Payload library** | `~/pentesting/`, `htbpaths`, and variables such as `$privesc`, `$potatoes`, and `$ligolo`. Pinned downloads plus cross-built agents for supported OS/architecture combinations. |
| **VM integration** | Guest tools for VMware, VirtualBox, QEMU/KVM/UTM, and Hyper-V. Optional shared folders for VMware and VirtualBox. |
| **Reference cards** | `pentest-cheat`, `niri-cheat`, `nix-cheat`, and `gpg-cheat`, with individual sections available from the terminal. |
| **Validation** | Category checks for expected binaries, smoke runs, Python collision checks, and NixOS VM tests for the VPN, target, and clock helpers. Run them with `nix flake check`. |

<a id="01-system-requirements"></a>
## System requirements

<img src="docs/images/headers/02-system-requirements.svg" width="1000" alt="System requirements: choose your machine"/>

| | Minimum | Comfortable |
| --- | --- | --- |
| **CPU** | x86_64 or aarch64, 2 cores | 4+ cores |
| **RAM** | 4 GB; limit parallel builds | 8–16 GB |
| **Disk** | 60 GB | 100 GB+ for generations, wordlists, and labs |
| **Firmware** | UEFI or legacy BIOS | UEFI, Secure Boot off for this setup |
| **Graphics** | X11 desktop or headless if 3D is unavailable | Working 3D for Niri |

On **aarch64**, BloodHound CE is disabled automatically and the `mobile`
category is unavailable. Niri and the toolkit get daily use; XFCE, i3, ARM,
and some hypervisor combinations have had less testing.
[The installation guide covers the platform-specific details.](docs/install.md#6-hypervisor-notes)

<a id="02-installation"></a>
## Installation

<img src="docs/images/headers/03-installation.svg" width="1000" alt="Installation: start with your host"/>

| Your starting point | Follow this path |
| --- | --- |
| A new bare-metal machine or VM | [Fresh install](docs/install.md#3-path-a--fresh-install-bare-metal-or-vm) |
| An existing NixOS system | [Integrate with your existing system](docs/install.md#4-path-b--you-already-run-nixos) |
| Only the tools, on Linux or WSL | [Use the toolkit without installing NixDaemon](docs/install.md#5-path-c--just-the-tools-any-linux-wsl) |

<img src="docs/images/jack-in-flow.svg" width="1000" alt="Fresh installation: clone, configure user and hardware, install the generic host, then boot"/>

For a **fresh generic installation**, the machine-specific settings live in two files:

| File | Purpose |
| --- | --- |
| [`_settings.nix`](modules/hosts/generic/_settings.nix) | Username, hostname, architecture, boot mode, hypervisor, desktop, and optional toolkit categories |
| [`_hardware-configuration.nix`](modules/hosts/generic/_hardware-configuration.nix) | Disks and kernel modules generated for your machine |

From the installer, **after following the guide to mount your target system at `/mnt`**.
This example uses the template's `operator` account; if you choose a different
username, use it in the checkout path as well:

```sh
nix-shell -p git
git clone https://gitlab.com/DAEMON-404/NixDaemon.git /mnt/home/operator/NixDaemon
cd /mnt/home/operator/NixDaemon
nano modules/hosts/generic/_settings.nix
nixos-generate-config --root /mnt --show-hardware-configuration \
  > modules/hosts/generic/_hardware-configuration.nix
nixos-install --flake .#nixdaemon
```

Set your intended username before installing and change the initial password at
first login. The checkout above will be `~/NixDaemon` for that account after
reboot, matching the generic host's `nh` configuration. The full guide covers
first-boot ownership and account setup.

<a id="03-daily-ops"></a>
## Daily operations

<img src="docs/images/headers/04-daily-ops.svg" width="1000" alt="Daily operations: build, work, record"/>

**The owner's laptop** — the existing `nixos` host and `daemonsec` account:

```sh
cd ~/NixDaemon
sudo nixos-rebuild build --flake .#nixos    # build first, without activation
sudo nixos-rebuild switch --flake .#nixos   # apply the reviewed configuration
```

**A generic installation** — from its checkout, after verifying its configured accounts:

```sh
sudo nixos-rebuild build --flake .#nixdaemon
sudo nixos-rebuild switch --flake .#nixdaemon
```

| Task | Command |
| --- | --- |
| Update pinned inputs | `nix flake update`, review the lock-file diff, then build and switch your existing host |
| Roll back system configuration | `sudo nixos-rebuild switch --rollback`, or select a generation at boot |
| Keep the latest five generations and clean older store paths | `nh clean all --keep 5` |
| Run repository checks | `nix flake check` |
| Open the editor | `nvim`; `Space e` opens the tree, `Space ff` finds files, `Space lf` formats |

**During a lab engagement:**

```sh
htbup                                     # profiles live in ~/.config/htb/vpn/
htbbox new EscapeTwo 10.10.11.202 win medium sequel.htb dc01.sequel.htb
htbscan full                              # scan results → recon/ and box.json
htbtime                                   # handle Kerberos clock skew against the DC
htbbox info                               # the current box card
htbcast -n foothold                        # record the terminal session
```

`pentest-cheat` is the full reference. Use `pentest-cheat ad` or
`pentest-cheat pivot` for a focused section.

<a id="04-arsenal"></a>
## Arsenal

<img src="docs/images/headers/05-arsenal.svg" width="1000" alt="Arsenal: 23 categories, one switch each"/>

<img src="docs/images/arsenal-map.svg" width="1000" alt="Default categories: recon, AD, web, pivot, crack, shells, core, Python, BloodHound, GUI, payloads, and wordlists. Eleven optional categories are listed below."/>

| Default on x86_64 | Optional |
| --- | --- |
| `core`, `python`, `recon`, `ad`, `web`, `pivot` | `dfir`, `reversing`, `wireless`, `radio`, `hardware`, `c2` |
| `crack`, `shells`, `bloodhound`, `gui`, `payloads`, `wordlists` | `database`, `cloud`, `osint`, `social`, `mobile` |

Category modules live in [`modules/features/pentest/`](modules/features/pentest).
The option is `daemon.pentest.<category>.enable`; generic installations set
these through the `pentest` attribute set in `_settings.nix`:

```nix
pentest = {
  reversing = true;
  dfir = true;
  wireless = false;
};
```

To use a package category temporarily, enter its development shell:

```sh
nix develop .#pentest-recon
```

Use `htbpaths` to locate the payload library and `pentest-update` when updating
its pinned upstream releases. The payload tree is managed separately from the
package-category development shells.

<a id="05-adding-removing"></a>
## Make it yours

<img src="docs/images/headers/06-adding-removing.svg" width="1000" alt="Make it yours: packages and modules"/>

**Add a toolkit package** in its category's `packages` list. Add the executable
name to `expectedBins` so the check verifies what is actually installed:

```nix
# Example shape inside a category module
packages = pkgs: with pkgs; [ ffuf gobuster feroxbuster wafw00f ];
expectedBins = [ "ffuf" "gobuster" "feroxbuster" "wafw00f" ];
```

The attribute and executable can differ: `netexec` provides `nxc`, for example.
Use `nix search nixpkgs <word>` to find attributes, then inspect the package's
executables when adding checks.

**Add a personal application** to the relevant host's `environment.systemPackages`
or Home Manager `home.packages`. **Add a category** by following `recon.nix`,
using the [`_sets.nix` factory](modules/features/pentest/_sets.nix), and importing
the new module from `modules/features/pentest/default.nix`.

New files must be tracked for a Git-backed flake to see them: use
`git add path/to/new-file.nix`, then build your existing host before switching.

<a id="06-architecture"></a>
## Architecture

<img src="docs/images/headers/07-architecture.svg" width="1000" alt="Architecture: how the dendritic modules fit together"/>

`flake-parts` and `import-tree` load the Nix modules under `modules/`.
Each module declares the outputs it owns, and modules refer to each other by
name through `self`. Paths containing `/_` are excluded from automatic loading;
those files hold data, helper functions, or explicitly imported configuration.

```text
NixDaemon/
├── flake.nix / flake.lock        inputs, pins, and module discovery
├── theme.nix                    active theme selector
├── modules/
│   ├── _palette.nix             shared colours and theme adapters
│   ├── hosts/
│   │   ├── generic/             nixdaemon: the portable template
│   │   │   ├── _settings.nix
│   │   │   ├── _hardware-configuration.nix
│   │   │   ├── default.nix
│   │   │   └── home.nix
│   │   └── laptop/              nixos: the owner's personal machine
│   ├── features/
│   │   ├── pentest/             toolkit, checks, dev shells, lab helpers
│   │   └── desktop/             Niri, Noctalia, XFCE, i3
│   └── home/                    editor, terminal, prompt, reference cards
├── docs/                        install, recovery, editor, SVG artwork
└── scripts/                     recovery and README artwork generation
```

The generic host builds without the owner's keys or dotfiles. The laptop host
imports its personal identity, encrypted secrets, and hardware configuration.
They share the toolkit, but are separate system configurations.

<a id="07-when-things-break"></a>
## When things break

<img src="docs/images/headers/08-when-things-break.svg" width="1000" alt="Troubleshooting: diagnose and recover"/>

| Symptom | First check |
| --- | --- |
| A newly created module is missing from the flake | Track that specific file with `git add path/to/file.nix` |
| Black screen after starting Niri in a VM | Check 3D support; choose `desktop = "xfce"` or `"i3"` for a VM without it |
| `_settings.nix` assertion fails | Read the named setting and its allowed values |
| Boot fails after installation | Verify the boot mode, disk configuration, and `biosDevice` where applicable |
| Build is killed or runs out of RAM | Retry with `--max-jobs 1 --cores 2` |
| Payload hash mismatch | Review the upstream release and update the relevant pin with `pentest-update` |
| Account missing or password rejected after changing hosts | Follow [live-USB recovery](docs/recovery.md); rollback alone may not restore login |
| Desktop or packages regress after a rebuild | Select the previous generation; mutable data is not rolled back |

For step-by-step diagnosis, see [installation troubleshooting](docs/install.md#9-when-something-goes-wrong).
The [recovery guide](docs/recovery.md) documents the recovery script, its backups,
and the checks it performs before making account changes.

<a id="08-documentation"></a>
## Documentation

<img src="docs/images/headers/09-documentation.svg" width="1000" alt="Documentation: keep the map close"/>

| Read | For |
| --- | --- |
| [Installation guide](docs/install.md) | Fresh installs, existing NixOS systems, hypervisors, and tools-only setups |
| [Recovery guide](docs/recovery.md) | Missing accounts, password recovery, live USBs, and backups |
| [Neovim guide](docs/neovim.md) | Dashboard, tree, completion, Nix/Python tools, formatting, and debugging |
| [Pentest card](modules/home/cheats/pentest.md) | The lab workflow and toolkit, by section |
| [Niri card](modules/home/cheats/niri.md) | Desktop keys and shell controls |
| [Nix card](modules/home/cheats/nix.md) | Builds, updates, generations, and repository operations |
| [Generic settings](modules/hosts/generic/_settings.nix) | Every portable machine setting, commented |
| [Artwork notes](docs/images/README.md) | SVG sources, palette, and regeneration |

<a id="09-lineage"></a>
## From IceBreaker

<img src="docs/images/headers/10-lineage.svg" width="1000" alt="Lineage: from IceBreaker"/>

NixDaemon succeeds **IceBreaker**, the earlier NixOS pentest flake. The workflow
stays familiar while more of the environment moves into declarative configuration.

| IceBreaker | NixDaemon |
| --- | --- |
| `setup.sh` edits files before rebuilding | `_settings.nix` plus standard NixOS install/build commands |
| Runtime pipx installs | A pinned Python environment with collision checks |
| Downloaded tunnelling agents | Cross-built ligolo-ng, chisel, fscan, and pspy agents |
| `newbox`, `flag`, `cred`, `~/targets/` | `htbbox`, per-box `box.json`, and scan imports |
| `settarget` and `~/.target.env` | `htbbox new`/`use`/`clear`, refreshed in open terminals at their next prompt |
| Toolkit presets | Per-category switches, development shells, and checks |

<a id="10-theme"></a>
## Gruvpine and the artwork

<img src="docs/images/headers/11-theme.svg" width="1000" alt="Theme and artwork: Gruvpine throughout"/>

<img src="docs/images/gruvpine-palette.svg" width="1000" alt="Gruvpine palette: charcoal #282828, cream #ebdbb2, gold #fabd2f, sage #b8bb26, love #eb6f92, rose #ebbcba, foam #9ccfd8, iris #c4a7e7"/>

Gruvpine combines Gruvbox's warm charcoal, cream, gold, and sage with Rosé Pine's
love, rose, foam, and iris accents. It is the current selection in
[`theme.nix`](theme.nix); `rose-pine` and `gruvbox` are also available.

The shared [`modules/_palette.nix`](modules/_palette.nix) feeds Kitty, Starship,
Fastfetch, Neovim, Yazi, rmpc, Zen Browser, GTK, pixel icons, desktop-shell colours, Niri, i3/XFCE,
GRUB, and the console. Apply theme changes using your existing host and restart
the desktop session to reload its colours. Restart Zen to reload its preferences
and CSS. Wallpapers, cursors, Floorp, and some dotfiles-managed applications keep
their own themes. See [desktop theme configuration](docs/desktop-theme.md) for
Zen, GTK, the pixel icons, and the Home Manager directory migration.

The hero, section headers, dividers, palette, and diagrams are **local SVGs**.
They use the repository's Gruvpine colour definitions and have no embedded raster
images, remote fonts, or JavaScript. Regenerate them with:

```sh
python3 scripts/render-readme.py
```

The Shields badges use the same colours. [Artwork details →](docs/images/README.md)

<img src="docs/images/dividers/rose.svg" width="1000" alt=""/>

<p align="center">☧ NixDaemon · Gruvpine · built for authorised work</p>