From 6fa223c1c9185cda8c19ff327eb934a327099a81 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Sat, 22 Jun 2024 08:37:24 -0700 Subject: [PATCH] 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 --- .../libraries/pico-sdk/default.nix | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/pico-sdk/default.nix b/pkgs/development/libraries/pico-sdk/default.nix index 46a9a2348e44..0e702510823b 100644 --- a/pkgs/development/libraries/pico-sdk/default.nix +++ b/pkgs/development/libraries/pico-sdk/default.nix @@ -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 ];