pico-sdk: add option to include submodules.

The SDK has a few submodules in its lib directory that contain
some additional functionality. Make it an option to include these
submodules.

Since it would create some license mix, keep it off by default. So
with that default, the default behavior is exactly as before.

While at it, make package overridable with finalAttrs.

Fixes #175297
This commit is contained in:
Henner Zeller 2024-06-22 08:37:24 -07:00
parent 0e34403dab
commit 6fa223c1c9

View File

@ -1,4 +1,16 @@
{ lib, stdenv, fetchFromGitHub, cmake }:
{
lib,
stdenv,
fetchFromGitHub,
cmake,
# Options
# The submodules in the pico-sdk contain important additional functionality
# such as tinyusb, but not all these libraries might be bsd3.
# Off by default.
withSubmodules ? false,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "pico-sdk";
@ -8,7 +20,11 @@ stdenv.mkDerivation (finalAttrs: {
owner = "raspberrypi";
repo = "pico-sdk";
rev = finalAttrs.version;
hash = "sha256-JNcxd86XNNiPkvipVFR3X255boMmq+YcuJXUP4JwInU=";
fetchSubmodules = withSubmodules;
hash = if (withSubmodules) then
"sha256-GY5jjJzaENL3ftuU5KpEZAmEZgyFRtLwGVg3W1e/4Ho="
else
"sha256-JNcxd86XNNiPkvipVFR3X255boMmq+YcuJXUP4JwInU=";
};
nativeBuildInputs = [ cmake ];