htb-shell.nix (1195B)
1 # modules/home/htb-shell.nix — $TARGET in the prompt. 2 # 3 # The shell integration that exports $TARGET/$RHOST/$IP/$BOX is NOT here: it is 4 # a NixOS option (programs.zsh.interactiveShellInit in 5 # modules/features/pentest/htb.nix), because zsh's configuration on this 6 # machine is the dotfiles' ZDOTDIR tree and home-manager's zsh module is not 7 # enabled — anything put in programs.zsh.initContent is never read. This file 8 # is only the prompt half. 9 # 10 # The format entry itself lives in modules/home/prompt.nix, which lists every 11 # starship module explicitly; starship renders nothing that is absent from 12 # `format`, so defining the module here alone did nothing. 13 { ... }: 14 { 15 flake.homeModules.htb-shell = 16 { lib, osConfig, ... }: 17 let 18 cfg = osConfig.daemon.pentest or { }; 19 on = (cfg.enable or false) && (cfg.htb.promptTarget or false); 20 in 21 { 22 # Rosé Pine love (#eb6f92) for the target, so it reads as "live fire". 23 programs.starship.settings = lib.mkIf on { 24 env_var.TARGET = { 25 variable = "TARGET"; 26 format = "[ $env_value]($style) "; 27 style = "bold #eb6f92"; 28 disabled = false; 29 }; 30 }; 31 }; 32 }