nrfconnect: Refactor BLE module (#383190)

This commit is contained in:
h7x4
2025-02-25 21:56:24 +01:00
committed by GitHub
3 changed files with 59 additions and 9 deletions
@@ -0,0 +1,48 @@
{
lib,
fetchurl,
appimageTools,
segger-jlink-headless,
libxshmfence,
}:
let
pname = "nrfconnect-bluetooth-low-energy";
version = "4.0.4";
src = fetchurl {
url = "https://github.com/NordicPlayground/pc-nrfconnect-ble-standalone/releases/download/v${version}/nrfconnect-bluetooth-low-energy-${version}-x86_64.AppImage";
hash = "sha256-mL8ky/cYjNgfUJgE7W5LFK/w7Ky9Xx6E84UT668HRAk=";
name = "${pname}-${version}.AppImage";
};
appimageContents = appimageTools.extractType2 {
inherit pname version src;
};
in
appimageTools.wrapType2 {
inherit pname version src;
extraPkgs = pkgs: [
segger-jlink-headless
libxshmfence
];
extraInstallCommands = ''
install -Dm444 ${appimageContents}/nrfconnect-bluetooth-low-energy.desktop -t $out/share/applications
install -Dm444 ${appimageContents}/usr/share/icons/hicolor/512x512/apps/nrfconnect-bluetooth-low-energy.png \
-t $out/share/icons/hicolor/512x512/apps
substituteInPlace $out/share/applications/nrfconnect-bluetooth-low-energy.desktop \
--replace-fail 'Exec=AppRun' 'Exec=nrfconnect-bluetooth-low-energy'
'';
meta = {
description = "Nordic Semiconductor Bluetooth low energy app for nRF Connect for Desktop";
homepage = "https://docs.nordicsemi.com/bundle/nrf-connect-ble/page/index.html";
license = lib.licenses.unfree;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ stargate01 ];
mainProgram = "nrfconnect-bluetooth-low-energy";
};
}
+4 -2
View File
@@ -1,7 +1,9 @@
{
lib,
stdenv,
fetchurl,
appimageTools,
segger-jlink-headless,
}:
let
@@ -23,7 +25,7 @@ appimageTools.wrapType2 {
inherit pname version src;
extraPkgs = pkgs: [
pkgs.segger-jlink-headless
segger-jlink-headless
];
extraInstallCommands = ''
@@ -31,7 +33,7 @@ appimageTools.wrapType2 {
install -Dm444 ${appimageContents}/usr/share/icons/hicolor/512x512/apps/nrfconnect.png \
-t $out/share/icons/hicolor/512x512/apps
substituteInPlace $out/share/applications/nrfconnect.desktop \
--replace 'Exec=AppRun' 'Exec=nrfconnect'
--replace-fail 'Exec=AppRun' 'Exec=nrfconnect'
'';
meta = {
+7 -7
View File
@@ -115,16 +115,16 @@ stdenv.mkDerivation {
installPhase = ''
runHook preInstall
mkdir -p $out/opt
mkdir -p $out/opt/SEGGER/JLink
${lib.optionalString (!headless) ''
# Install binaries and runtime files into /opt/
mv J* ETC GDBServer Firmwares $out/opt
# Install binaries and runtime files into /opt/SEGGER/JLink
mv J* ETC GDBServer Firmwares $out/opt/SEGGER/JLink
# Link executables into /bin/
mkdir -p $out/bin
for binr in $out/opt/*Exe; do
binrlink=''${binr#"$out/opt/"}
for binr in $out/opt/SEGGER/JLink/*Exe; do
binrlink=''${binr#"$out/opt/SEGGER/JLink/"}
ln -s $binr $out/bin/$binrlink
# Create additional symlinks without "Exe" suffix
binrlink=''${binrlink/%Exe}
@@ -132,7 +132,7 @@ stdenv.mkDerivation {
done
# Copy special alias symlinks
for slink in $(find $out/opt/. -type l); do
for slink in $(find $out/opt/SEGGER/JLink/. -type l); do
cp -P -n $slink $out/bin || true
rm $slink
done
@@ -141,7 +141,7 @@ stdenv.mkDerivation {
# Install libraries
install -Dm444 libjlinkarm.so* -t $out/lib
for libr in $out/lib/libjlinkarm.*; do
ln -s $libr $out/opt
ln -s $libr $out/opt/SEGGER/JLink
done
# Install docs and examples