repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
htb-shell.nixNix32 lines1.2 KiBraw download
# modules/home/htb-shell.nix — $TARGET in the prompt.
#
# The shell integration that exports $TARGET/$RHOST/$IP/$BOX is NOT here: it is
# a NixOS option (programs.zsh.interactiveShellInit in
# modules/features/pentest/htb.nix), because zsh's configuration on this
# machine is the dotfiles' ZDOTDIR tree and home-manager's zsh module is not
# enabled — anything put in programs.zsh.initContent is never read. This file
# is only the prompt half.
#
# The format entry itself lives in modules/home/prompt.nix, which lists every
# starship module explicitly; starship renders nothing that is absent from
# `format`, so defining the module here alone did nothing.
{ ... }:
{
  flake.homeModules.htb-shell =
    { lib, osConfig, ... }:
    let
      cfg = osConfig.daemon.pentest or { };
      on = (cfg.enable or false) && (cfg.htb.promptTarget or false);
    in
    {
      # Rosé Pine love (#eb6f92) for the target, so it reads as "live fire".
      programs.starship.settings = lib.mkIf on {
        env_var.TARGET = {
          variable = "TARGET";
          format = "[ 󰓾 $env_value]($style) ";
          style = "bold #eb6f92";
          disabled = false;
        };
      };
    };
}