about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/misc/rpiboot/unstable.nix
blob: a8f7e4795e77aed87631bc006518742cb5bf61bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ stdenv, fetchFromGitHub, libusb1 }:

let
  version = "2020-05-11";
  name = "rpiboot-unstable-${version}";
in stdenv.mkDerivation {
  inherit name;

  src = fetchFromGitHub {
    owner = "raspberrypi";
    repo = "usbboot";
    rev = "c650cd747c1d0597487dcf319bf95b5ba775d78b";
    sha256 = "17kapny79dh05vfmrniqdvz6xhpwnqnw0511ycfx4qcjh4krxh8n";
  };

  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 = {
    homepage = "https://github.com/raspberrypi/usbboot";
    description = "Utility to boot a Raspberry Pi CM/CM3/Zero over USB";
    maintainers = [ stdenv.lib.maintainers.cartr ];
    license = stdenv.lib.licenses.asl20;
    platforms = stdenv.lib.platforms.unix;
  };
}