{ lib, rustPlatform, fetchFromGitHub, pkg-config, openssl, stdenv, coreutils, gnome-keyring, libsecret, openvpn, gzip, killall, }: rustPlatform.buildRustPackage { pname = "htb-toolkit"; version = "0-unstable-2025-03-15"; src = fetchFromGitHub { owner = "D3vil0p3r"; repo = "htb-toolkit"; # https://github.com/D3vil0p3r/htb-toolkit/issues/3 rev = "dd193c2974cd5fd1bbc6f7f616ebd597e28539ec"; hash = "sha256-NTZv0BPyIB32CNXbINYTy4n8tNVJ3pRLr1QDhI/tg2Y="; }; cargoHash = "sha256-ReEe8pyW66GXIPwAy6IKsFEAUjxHmzw5mj21i/h4quQ="; # Patch to disable prompt change of the shell when a target machine is run. Needed due to Nix declarative nature patches = [ ./disable-shell-prompt-change.patch ]; nativeBuildInputs = [ pkg-config ]; buildInputs = [ openssl ] ++ lib.optionals stdenv.hostPlatform.isLinux [ gnome-keyring ]; postPatch = '' substituteInPlace src/manage.rs \ --replace-fail /usr/share/icons/htb-toolkit/ $out/share/icons/htb-toolkit/ substituteInPlace src/utils.rs \ --replace-fail "\"base64\"" "\"${coreutils}/bin/base64\"" \ --replace-fail "\"gunzip\"" "\"${gzip}/bin/gunzip\"" substituteInPlace src/appkey.rs \ --replace-fail secret-tool ${lib.getExe libsecret} substituteInPlace src/vpn.rs \ --replace-fail "arg(\"openvpn\")" "arg(\"${openvpn}/bin/openvpn\")" \ --replace-fail "arg(\"killall\")" "arg(\"${killall}/bin/killall\")" ''; meta = with lib; { description = "Play Hack The Box directly on your system"; mainProgram = "htb-toolkit"; homepage = "https://github.com/D3vil0p3r/htb-toolkit"; maintainers = with maintainers; [ d3vil0p3r ]; platforms = platforms.unix; license = licenses.gpl3Plus; }; }