repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
devshells.nixNix50 lines2.1 KiBraw download
# modules/features/pentest/devshells.nix — the toolkit without installing it,
# and one check that the whole thing can coexist in a single profile.
#
#   nix develop ~/NixDaemon#pentest          every category, on PATH, temporarily
#   nix develop ~/NixDaemon#pentest-ad       one category (mkCategory makes these)
#   nix develop github:…/NixDaemon#pentest   the same kit on any machine with Nix
#
# The per-category shells come from _sets.nix. This file adds the union, and
# `checks.pentest-collisions`.
#
# Why that check exists: environment.systemPackages merges everything into ONE
# profile with buildEnv, so two packages owning the same bin/ name is a hard
# failure that stops the system building. The toplevel build catches it only
# for the categories that are ENABLED — dfir, reversing, wireless, cloud,
# osint and mobile ship off, so a collision in one of them would lie dormant
# until the day you enabled it mid-engagement. This merges all of them,
# enabled or not. It is how `pwntools` shipping bin/checksec alongside the
# standalone `checksec` package was caught.
{ self, ... }:
{
  perSystem =
    { pkgs, lib, ... }:
    let
      sets = self.lib.pentestPackages or { };
      # Only what builds on this system: on aarch64-linux a few tools are
      # x86-only. On x86_64 nothing is dropped.
      allPackages = builtins.filter (lib.meta.availableOn pkgs.stdenv.hostPlatform) (
        lib.concatMap (f: f pkgs) (lib.attrValues sets)
      );
      names = lib.attrNames sets;
    in
    {
      devShells.pentest = pkgs.mkShell {
        name = "pentest";
        packages = allPackages;
        shellHook = ''
          echo "pentest: ${toString (lib.length names)} categories — ${lib.concatStringsSep " " names}"
          echo "  \$WORDLISTS and \$PAYLOADS are only set on the installed system,"
          echo "  not in this shell; use \$(nix build ..#checks..) paths if you need them."
        '';
      };

      checks.pentest-collisions = pkgs.buildEnv {
        name = "pentest-collisions-check";
        paths = allPackages;
        # The default (false) is the point: a clash fails this derivation.
        ignoreCollisions = false;
      };
    };
}