From 9d66d3c7f87e10c83d74b7f3d6b541360e04cb22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20F=C3=B6rster?=
 <135814375+secufoe@users.noreply.github.com>
Date: Mon, 16 Oct 2023 12:08:18 +0200
Subject: [PATCH] rshim-user-space: add bfb-install

Make bfb-install script available for convenient bootstream installation
including log output and progress feedback.
---
 pkgs/tools/misc/rshim-user-space/default.nix | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/pkgs/tools/misc/rshim-user-space/default.nix b/pkgs/tools/misc/rshim-user-space/default.nix
index 79b795f869a3..4f1bc510dd80 100644
--- a/pkgs/tools/misc/rshim-user-space/default.nix
+++ b/pkgs/tools/misc/rshim-user-space/default.nix
@@ -3,10 +3,13 @@
 , fetchFromGitHub
 , autoconf
 , automake
+, makeBinaryWrapper
 , pkg-config
 , pciutils
 , libusb1
 , fuse
+, busybox
+, pv
 }:
 
 stdenv.mkDerivation rec {
@@ -24,12 +27,15 @@ stdenv.mkDerivation rec {
     autoconf
     automake
     pkg-config
+    makeBinaryWrapper
   ];
 
   buildInputs = [
     pciutils
     libusb1
     fuse
+    busybox
+    pv
   ];
 
   strictDeps = true;
@@ -39,6 +45,12 @@ stdenv.mkDerivation rec {
   installPhase = ''
     mkdir -p "$out"/bin
     cp -a src/rshim "$out"/bin/
+    cp -a scripts/bfb-install "$out"/bin/
+  '';
+
+  postFixup = ''
+    wrapProgram $out/bin/bfb-install \
+      --set PATH ${lib.makeBinPath [ busybox pv ]}
   '';
 
   meta = with lib; {