diff --git a/pkgs/by-name/ra/raspi-utils/package.nix b/pkgs/by-name/ra/raspi-utils/package.nix new file mode 100644 index 000000000000..f24a1c0186ab --- /dev/null +++ b/pkgs/by-name/ra/raspi-utils/package.nix @@ -0,0 +1,135 @@ +{ + lib, + stdenv, + fetchFromGitHub, + unstableGitUpdater, + cmake, + makeBinaryWrapper, + pkg-config, + bashNonInteractive, + coreutils, + dtc, + gawk, + gitMinimal, + gnugrep, + gnutls, + gnutar, + kmod, + ncurses, + perl, + python3, + targetPackages, + util-linux, + which, + zstd, + cc ? targetPackages.stdenv.cc, +}: + +let + runtimePath = lib.makeBinPath [ + coreutils + dtc + gawk + gitMinimal + gnugrep + gnutar + kmod + cc + util-linux + which + zstd + ]; +in +stdenv.mkDerivation (finalAttrs: { + pname = "raspi-utils"; + version = "0-unstable-2026-07-08"; + + src = fetchFromGitHub { + owner = "raspberrypi"; + repo = "utils"; + rev = "5edd399260b5081f9c1c96fc7f369b920d6732d1"; + hash = "sha256-qxwASdmEH47oCjuPtboWuUkcNsw5j6eCSsWrNejpIMU="; + }; + + __structuredAttrs = true; + strictDeps = true; + + outputs = [ + "out" + "dev" + ]; + + nativeBuildInputs = [ + cmake + makeBinaryWrapper + pkg-config + ]; + + buildInputs = [ + bashNonInteractive + dtc + gnutls + ncurses + perl + python3 + ]; + + cmakeFlags = [ + (lib.cmakeBool "BUILD_SHARED_LIBS" true) + ]; + + postPatch = '' + substituteInPlace CMakeLists.txt \ + --replace-fail "add_subdirectory(raspinfo)" "" + + substituteInPlace dtapply/dtapply \ + --replace-fail \ + "parser = argparse.ArgumentParser(" \ + 'parser = argparse.ArgumentParser(prog="dtapply",' + substituteInPlace eeptools/eepflash.sh \ + --replace-fail 'me=$(basename "$0")' 'me=eepflash.sh' + substituteInPlace otamaker/otamaker \ + --replace-fail \ + "parser = argparse.ArgumentParser()" \ + "parser = argparse.ArgumentParser(prog='otamaker')" + substituteInPlace otpset/otpset \ + --replace-fail \ + "parser = argparse.ArgumentParser(description=" \ + "parser = argparse.ArgumentParser(prog='otpset', description=" + substituteInPlace overlaycheck/overlaycheck \ + --replace-fail \ + 'my $exclusions_file = $0 . "_exclusions.txt";' \ + 'my $exclusions_file = "${placeholder "out"}/bin/overlaycheck_exclusions.txt";' + ''; + + postFixup = '' + for program in \ + dtapply \ + dtoverlay \ + eepflash.sh \ + kdtc \ + otamaker \ + otpset \ + overlaycheck \ + ovmerge + do + wrapProgram "$out/bin/$program" \ + --prefix PATH : "$out/bin:${runtimePath}" + done + ''; + + passthru.updateScript = unstableGitUpdater { }; + + meta = { + description = "Scripts and applications for interfacing with Raspberry Pi hardware"; + homepage = "https://github.com/raspberrypi/utils"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ jamiemagee ]; + platforms = [ + "armv6l-linux" + "armv7l-linux" + "aarch64-linux" + "x86_64-linux" + ]; + }; +})