treewide: add custom packages + mcuxpesso IDE

This commit is contained in:
Anthony Rodriguez 2024-10-30 08:31:31 +01:00
parent 2e29a5cec7
commit 209dba67ae
Signed by: nezia
GPG key ID: EE3BE97C040A86CE
8 changed files with 91 additions and 3 deletions

View file

@ -26,6 +26,7 @@
formatter = eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
nixosModules = import ./modules;
nixosConfigurations = import ./hosts {inherit self inputs;};
packages = eachSystem (pkgs: import ./pkgs pkgs);
deploy.nodes = import ./nodes {inherit self inputs;};
};
inputs = {

View file

@ -1,4 +1,8 @@
{pkgs, ...}: {
{
inputs,
pkgs,
...
}: {
imports = [
./browsers
./media
@ -35,5 +39,7 @@
nautilus
simple-scan
entr
inputs.self.packages.${pkgs.system}.mcuxpresso.ide
# inputs.self.packages.${pkgs.system}.mcuxpresso.config-tools
];
}

3
pkgs/default.nix Normal file
View file

@ -0,0 +1,3 @@
pkgs: {
mcuxpresso = import ./mcuxpresso pkgs;
}

View file

@ -0,0 +1,3 @@
pkgs: {
ide = pkgs.callPackage ./ide.nix {};
}

65
pkgs/mcuxpresso/ide.nix Normal file
View file

@ -0,0 +1,65 @@
# https://github.com/KoviRobi/nixos-config/blob/3ab3f8372d1fd021a235de4d314ef7147846513e/overlays/mcuxpresso.nix
{pkgs, ...}: let
name = "mcuxpressoide";
version = "24.9.25";
description = "MCUXpresso IDE";
filename = "${name}-${version}.x86_64.deb";
src = pkgs.stdenv.mkDerivation {
inherit version description;
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=";
};
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 ./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
cd ./final
tar -czf $out ./
'';
};
mcuxpressoide = pkgs.eclipses.buildEclipse {
name = "${name}-eclipse";
inherit description src;
};
in
pkgs.stdenv.mkDerivation {
inherit name version description;
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [pkgs.copyDesktopItems];
desktopItems = [
(pkgs.makeDesktopItem {
inherit name;
type = "Application";
desktopName = "MCUXpresso IDE";
exec = "mcuxpresso";
})
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
ln -s ${mcuxpressoide}/bin/eclipse $out/bin/mcuxpresso
runHook postInstall
'';
}

View file

@ -7,6 +7,7 @@
"audio"
"video"
"wheel"
"plugdev"
];
};
}

View file

@ -1,6 +1,5 @@
{pkgs, ...}: {
nixpkgs = {
config.allowUnfree = true;
overlays = [
(_: prev: {
lib =
@ -10,6 +9,11 @@
};
})
];
config.permittedInsecurePackages = ["cinny-4.2.2" "cinny-unwrapped-4.2.2"];
config = {
allowUnfree = true;
permittedInsecurePackages = ["cinny-4.2.2" "cinny-unwrapped-4.2.2" "segger-jlink-qt4-796s"];
segger-jlink.acceptLicense = true;
};
};
}

View file

@ -1,3 +1,8 @@
{
inputs,
pkgs,
...
}: {
imports = [./docker.nix ./gnupg.nix ./pipewire.nix ./kmscon.nix];
services.udev.packages = [pkgs.segger-jlink inputs.self.packages.${pkgs.system}.mcuxpresso.ide];
}