summary refs log tree commit diff
path: root/pkgs/development/misc/rpiboot/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/misc/rpiboot/default.nix')
-rw-r--r--pkgs/development/misc/rpiboot/default.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/pkgs/development/misc/rpiboot/default.nix b/pkgs/development/misc/rpiboot/default.nix
new file mode 100644
index 00000000000..941c7ce904e
--- /dev/null
+++ b/pkgs/development/misc/rpiboot/default.nix
@@ -0,0 +1,34 @@
+{ lib, stdenv, fetchFromGitHub, libusb1 }:
+
+stdenv.mkDerivation rec {
+  pname = "rpiboot";
+  version = "2021.07.01";
+
+  src = fetchFromGitHub {
+    owner = "raspberrypi";
+    repo = "usbboot";
+    rev = "v${version}";
+    sha256 = "sha256-BkNyYCrasfiRs7CbJa7tCo2k70TLGcXkOX+zGPyZGGE=";
+  };
+
+  nativeBuildInputs = [ libusb1 ];
+
+  patchPhase = ''
+    sed -i "s@/usr/@$out/@g" main.c
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    mkdir -p $out/share/rpiboot
+    cp rpiboot $out/bin
+    cp -r msd $out/share/rpiboot
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/raspberrypi/usbboot";
+    description = "Utility to boot a Raspberry Pi CM/CM3/CM4/Zero over USB";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ cartr ];
+    platforms = [ "aarch64-linux" "armv7l-linux" "armv6l-linux" "x86_64-linux" ];
+  };
+}