shared/pkgs: move mcuxpresso to its own file
This commit is contained in:
parent
4ccd29cb9d
commit
065266ee3a
4 changed files with 100 additions and 137 deletions
|
@ -2,8 +2,10 @@
|
||||||
inputs,
|
inputs,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
mcuxpresso = import ./mcuxpresso pkgs;
|
mcuxpressoPkgs = inputs.nixpkgs-mcuxpresso.legacyPackages.${pkgs.system};
|
||||||
|
in {
|
||||||
|
mcuxpresso = pkgs.callPackage ./mcuxpresso.nix mcuxpressoPkgs;
|
||||||
# this is unfortunately needed since bolt-launcher makes use of openssl-1.1.1w, and since it is not part of hosts, we have to add it this way
|
# this is unfortunately needed since bolt-launcher makes use of openssl-1.1.1w, and since it is not part of hosts, we have to add it this way
|
||||||
bolt-launcher =
|
bolt-launcher =
|
||||||
(import inputs.nixpkgs {
|
(import inputs.nixpkgs {
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
{pkgs, ...}: let
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
name = "mcuxpressoide";
|
name = "mcuxpressoide";
|
||||||
version = "24.9.25";
|
version = "24.9.25";
|
||||||
description = "MCUXpresso IDE";
|
description = "MCUXpresso IDE";
|
||||||
|
@ -6,13 +10,72 @@
|
||||||
mcuxpressoideSrc = pkgs.stdenv.mkDerivation {
|
mcuxpressoideSrc = pkgs.stdenv.mkDerivation {
|
||||||
inherit version description;
|
inherit version description;
|
||||||
name = "${name}-src";
|
name = "${name}-src";
|
||||||
|
src = pkgs.requireFile {
|
||||||
|
url = "https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-integrated-development-environment-ide:MCUXpresso-IDE";
|
||||||
|
name = "${filename}.bin";
|
||||||
|
hash = "sha256-e3g7rzZQ1WFLcUakkjaufpHMtw3qkw5lwxJuCKs6L+k=";
|
||||||
|
};
|
||||||
|
nativeBuildInputs = [pkgs.makeWrapper];
|
||||||
|
|
||||||
nativeBuildInputs = [pkgs.autoPatchelfHook];
|
buildCommand = ''
|
||||||
|
# Unpack tarball.
|
||||||
|
mkdir -p deb
|
||||||
|
sh $src --target deb || true
|
||||||
|
ar -xv deb/${filename}
|
||||||
|
tar xfvz data.tar.gz -C .
|
||||||
|
|
||||||
dontUnpack = true;
|
# Unpack LinkServer.
|
||||||
dontAutoPatchelf = true;
|
mkdir -p linkserver
|
||||||
|
sh deb/LinkServer_24.9.75.x86_64.deb.bin --target deb/linkserver || true
|
||||||
|
ar -xv deb/linkserver/LPCScrypt.deb
|
||||||
|
tar xfvz data.tar.gz -C linkserver
|
||||||
|
ar -xv deb/linkserver/MCU-Link.deb
|
||||||
|
tar xfvz data.tar.gz -C linkserver
|
||||||
|
ar -xv deb/linkserver/LinkServer_24.9.75.x86_64.deb
|
||||||
|
tar xfvz data.tar.gz -C linkserver
|
||||||
|
|
||||||
buildInputs = [
|
mkdir -p ./final/eclipse
|
||||||
|
mv ./usr/local/${name}-${version}/ide/* ./usr/local/${name}-${version}/ide/.* final/eclipse
|
||||||
|
mv final/eclipse/mcuxpressoide final/eclipse/eclipse
|
||||||
|
mv final/eclipse/mcuxpressoide.ini final/eclipse/eclipse.ini
|
||||||
|
|
||||||
|
# Create custom .eclipseproduct file
|
||||||
|
rm final/eclipse/.eclipseproduct
|
||||||
|
echo "name=${name}
|
||||||
|
id=com.nxp.${name}
|
||||||
|
version=${version}
|
||||||
|
" > final/eclipse/.eclipseproduct
|
||||||
|
# Install udev rules
|
||||||
|
mkdir -p final/lib/udev/rules.d
|
||||||
|
mv ./lib/udev/rules.d/56-pemicro.rules ./lib/udev/rules.d/85-mcuxpresso.rules final/lib/udev/rules.d/
|
||||||
|
|
||||||
|
# Additional files
|
||||||
|
mv ./usr/local/${name}-${version}/mcu_data final/mcu_data
|
||||||
|
|
||||||
|
# Place LinkServer, lpcscrypt, and MCU-LINK_installer in /usr/local
|
||||||
|
mkdir -p ./final/usr/local
|
||||||
|
mv ./linkserver/usr/local/LinkServer_24.9.75 ./final/usr/local
|
||||||
|
mv ./linkserver/usr/local/lpcscrypt-2.1.3_83 ./final/usr/local
|
||||||
|
mv ./linkserver/usr/local/MCU-LINK_installer_3.148 ./final/usr/local
|
||||||
|
|
||||||
|
# Install LinkServer udev rules
|
||||||
|
mv ./linkserver/lib/udev/rules.d/{85-linkserver_24.9.75.rules,85-mcu-link_3.148.rules,99-lpcscrypt.rules} final/lib/udev/rules.d
|
||||||
|
|
||||||
|
cd ./final
|
||||||
|
|
||||||
|
tar -czf $out ./
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
mcuxpressoide = pkgs.eclipses.buildEclipse {
|
||||||
|
name = "mcuxpresso-eclipse";
|
||||||
|
inherit description;
|
||||||
|
src = mcuxpressoideSrc;
|
||||||
|
};
|
||||||
|
|
||||||
|
# needed because of the integrated toolchain
|
||||||
|
mcuxpressoFhsEnv = pkgs.buildFHSEnv {
|
||||||
|
name = "mcuxpresso-env";
|
||||||
|
targetPkgs = pkgs: [
|
||||||
pkgs.dfu-util
|
pkgs.dfu-util
|
||||||
pkgs.stdenv.cc.cc.lib
|
pkgs.stdenv.cc.cc.lib
|
||||||
pkgs.gcc
|
pkgs.gcc
|
||||||
|
@ -35,86 +98,32 @@
|
||||||
pkgs.libxcrypt-legacy
|
pkgs.libxcrypt-legacy
|
||||||
pkgs.libusb-compat-0_1
|
pkgs.libusb-compat-0_1
|
||||||
pkgs.xorg.libxcb
|
pkgs.xorg.libxcb
|
||||||
|
pkgs.python3
|
||||||
pkgs.usbutils
|
pkgs.usbutils
|
||||||
pkgs.libuuid
|
pkgs.libuuid
|
||||||
pkgs.libudev-zero
|
pkgs.libudev-zero
|
||||||
|
|
||||||
pkgs.python39
|
|
||||||
pkgs.libz
|
|
||||||
];
|
];
|
||||||
|
profile = ''
|
||||||
src = pkgs.requireFile {
|
export LD_LIBRARY_PATH=${lib.makeLibraryPath [pkgs.ncurses5 pkgs.ncurses]}:$LD_LIBRARY_PATH
|
||||||
url = "https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-integrated-development-environment-ide:MCUXpresso-IDE";
|
|
||||||
name = "${filename}.bin";
|
|
||||||
hash = "sha256-e3g7rzZQ1WFLcUakkjaufpHMtw3qkw5lwxJuCKs6L+k=";
|
|
||||||
};
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
# Unpack tarball
|
|
||||||
mkdir -p deb
|
|
||||||
sh $src --target deb || true
|
|
||||||
ar -xv deb/${filename}
|
|
||||||
tar xfvz data.tar.gz -C .
|
|
||||||
|
|
||||||
# Unpack LinkServer
|
|
||||||
mkdir -p linkserver
|
|
||||||
sh deb/LinkServer_24.9.75.x86_64.deb.bin --target deb/linkserver || true
|
|
||||||
ar -xv deb/linkserver/LPCScrypt.deb
|
|
||||||
tar xfvz data.tar.gz -C linkserver
|
|
||||||
ar -xv deb/linkserver/MCU-Link.deb
|
|
||||||
tar xfvz data.tar.gz -C linkserver
|
|
||||||
ar -xv deb/linkserver/LinkServer_24.9.75.x86_64.deb
|
|
||||||
tar xfvz data.tar.gz -C linkserver
|
|
||||||
|
|
||||||
# Prepare Eclipse files
|
|
||||||
mkdir -p ./final/eclipse
|
|
||||||
mv ./usr/local/${name}-${version}/ide/* ./usr/local/${name}-${version}/ide/.* final/eclipse
|
|
||||||
mv final/eclipse/mcuxpressoide final/eclipse/eclipse
|
|
||||||
mv final/eclipse/mcuxpressoide.ini final/eclipse/eclipse.ini
|
|
||||||
|
|
||||||
# Create custom .eclipseproduct file
|
|
||||||
rm final/eclipse/.eclipseproduct
|
|
||||||
echo "name=${name}
|
|
||||||
id=com.nxp.${name}
|
|
||||||
version=${version}" > final/eclipse/.eclipseproduct
|
|
||||||
|
|
||||||
# Install udev rules
|
|
||||||
mkdir -p final/lib/udev/rules.d
|
|
||||||
mv ./lib/udev/rules.d/56-pemicro.rules ./lib/udev/rules.d/85-mcuxpresso.rules final/lib/udev/rules.d/
|
|
||||||
|
|
||||||
# Additional files
|
|
||||||
mv ./usr/local/${name}-${version}/mcu_data final/mcu_data
|
|
||||||
|
|
||||||
# Place LinkServer, lpcscrypt, and MCU-LINK_installer in /usr/local
|
|
||||||
mkdir -p ./final/usr/local
|
|
||||||
mv ./linkserver/usr/local/LinkServer_24.9.75 ./final/usr/local
|
|
||||||
mv ./linkserver/usr/local/lpcscrypt-2.1.3_83 ./final/usr/local
|
|
||||||
mv ./linkserver/usr/local/MCU-LINK_installer_3.148 ./final/usr/local
|
|
||||||
|
|
||||||
# Install LinkServer udev rules
|
|
||||||
mv ./linkserver/lib/udev/rules.d/{85-linkserver_24.9.75.rules,85-mcu-link_3.148.rules,99-lpcscrypt.rules} final/lib/udev/rules.d
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
fixupPhase = ''
|
extraBuildCommands = ''
|
||||||
# Tarball creation in postFixup
|
# Ensure necessary directories exist
|
||||||
echo "Creating tarball from ./final..."
|
mkdir -p $out/usr/local/LinkServer_24.9.75/lpcscrypt $out/usr/local/LinkServer_24.9.75/MCU-LINK_installer
|
||||||
autoPatchelf ./final
|
|
||||||
cd ./final
|
cp -r ${mcuxpressoide}/usr/local/LinkServer_24.9.75/* $out/usr/local/LinkServer_24.9.75
|
||||||
tar -czf $out .
|
cp -r ${mcuxpressoide}/usr/local/lpcscrypt-2.1.3_83/* $out/usr/local/LinkServer_24.9.75/lpcscrypt
|
||||||
|
cp -r ${mcuxpressoide}/usr/local/MCU-LINK_installer_3.148/* $out/usr/local/LinkServer_24.9.75/MCU-LINK_installer
|
||||||
'';
|
'';
|
||||||
};
|
runScript = "${mcuxpressoide}/bin/eclipse";
|
||||||
mcuxpresso = pkgs.eclipses.buildEclipse {
|
|
||||||
name = "mcuxpresso-eclipse";
|
|
||||||
inherit description;
|
|
||||||
src = mcuxpressoideSrc;
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
pkgs.stdenv.mkDerivation {
|
pkgs.stdenv.mkDerivation {
|
||||||
inherit name version description;
|
inherit name version description;
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
dontConfigure = true;
|
dontConfigure = true;
|
||||||
|
dontBuild = true;
|
||||||
nativeBuildInputs = [pkgs.copyDesktopItems];
|
nativeBuildInputs = [pkgs.copyDesktopItems];
|
||||||
buildInputs = [pkgs.zlib];
|
|
||||||
desktopItems = [
|
desktopItems = [
|
||||||
(pkgs.makeDesktopItem {
|
(pkgs.makeDesktopItem {
|
||||||
inherit name;
|
inherit name;
|
||||||
|
@ -124,19 +133,23 @@ in
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
# Ensure necessary directories exist
|
|
||||||
mkdir -p $out/usr/local/LinkServer_24.9.75/lpcscrypt $out/usr/local/LinkServer_24.9.75/MCU-LINK_installer
|
|
||||||
|
|
||||||
cp -r ${mcuxpresso}/usr/local/LinkServer_24.9.75/* $out/usr/local/LinkServer_24.9.75
|
|
||||||
cp -r ${mcuxpresso}/usr/local/lpcscrypt-2.1.3_83/* $out/usr/local/LinkServer_24.9.75/lpcscrypt
|
|
||||||
cp -r ${mcuxpresso}/usr/local/MCU-LINK_installer_3.148/* $out/usr/local/LinkServer_24.9.75/MCU-LINK_installer
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
mkdir -p $out/bin
|
|
||||||
ln -s ${mcuxpresso}/bin/eclipse $out/bin/mcuxpresso
|
# Create necessary directories
|
||||||
|
mkdir -p $out/lib/udev/rules.d
|
||||||
|
mkdir -p $out/bin $out/eclipse $out/mcu_data
|
||||||
|
|
||||||
|
# Copy udev rules
|
||||||
|
cp ${mcuxpressoide}/lib/udev/rules.d/85-mcuxpresso.rules ${mcuxpressoide}/lib/udev/rules.d/56-pemicro.rules $out/lib/udev/rules.d/
|
||||||
|
|
||||||
|
# Copy full installation
|
||||||
|
cp -r ${mcuxpressoide}/eclipse $out/eclipse
|
||||||
|
cp -r ${mcuxpressoide}/mcu_data $out/mcu_data
|
||||||
|
|
||||||
|
# Create symlink for the environment
|
||||||
|
ln -s ${mcuxpressoFhsEnv}/bin/mcuxpresso-env $out/bin/mcuxpresso
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
}
|
}
|
|
@ -1,49 +0,0 @@
|
||||||
{
|
|
||||||
eclipses,
|
|
||||||
stdenv,
|
|
||||||
requireFile,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
name = "mcuxpressotools";
|
|
||||||
version = "v16-1";
|
|
||||||
description = "MCUXpresso Config Tools";
|
|
||||||
filename = "mcuxpresso-config-tools-${version}_amd64.deb";
|
|
||||||
|
|
||||||
src = stdenv.mkDerivation {
|
|
||||||
inherit version description;
|
|
||||||
name = "${name}-src";
|
|
||||||
src = requireFile {
|
|
||||||
url = "https://www.nxp.com/design/software/development-software/mcuxpresso-config-tools-pins-clocks-and-peripherals:MCUXpresso-Config-Tools";
|
|
||||||
name = "${filename}.bin";
|
|
||||||
sha256 = "sha256-BbEwxm1urV2IrgUiTiMBEAPvonQGwdL4fpqFftGgRxI=";
|
|
||||||
};
|
|
||||||
|
|
||||||
buildCommand = ''
|
|
||||||
# Unpack tarball.
|
|
||||||
mkdir -p deb
|
|
||||||
sh $src --target deb || true
|
|
||||||
ar -xv deb/${filename}
|
|
||||||
tar xfvz data.tar.gz -C .
|
|
||||||
|
|
||||||
mkdir -p ./final/eclipse
|
|
||||||
mv ./opt/nxp/MCUX_CFG_v13/bin/.* final/eclipse
|
|
||||||
mv ./usr final/
|
|
||||||
mv final/eclipse/tools final/eclipse/eclipse
|
|
||||||
mv final/eclipse/tools.ini final/eclipse/eclipse.ini
|
|
||||||
|
|
||||||
# Create custom .eclipseproduct file
|
|
||||||
echo "name=${name}
|
|
||||||
id=com.nxp.${name}
|
|
||||||
version=${version}
|
|
||||||
" > final/eclipse/.eclipseproduct
|
|
||||||
|
|
||||||
# Additional files
|
|
||||||
mkdir -p final/usr/share/mime
|
|
||||||
mv ./opt/nxp/MCUX_CFG_v13/mcu_data final/mcu_data
|
|
||||||
|
|
||||||
cd ./final
|
|
||||||
tar -czf $out ./
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
in
|
|
||||||
eclipses.buildEclipse {inherit description name src;}
|
|
|
@ -1,3 +0,0 @@
|
||||||
pkgs: {
|
|
||||||
ide = pkgs.callPackage ./ide.nix {};
|
|
||||||
}
|
|
Loading…
Reference in a new issue