mcuxpresso: add feature flag for udev rules only

This commit is contained in:
Anthony Rodriguez 2024-12-25 10:28:00 +01:00
parent 0eab12a13f
commit 61bc1ea56d
Signed by: nezia
GPG key ID: EE3BE97C040A86CE
4 changed files with 31 additions and 8 deletions

View file

@ -0,0 +1,12 @@
{
inputs,
pkgs,
...
}: {
services.udev.packages = [
(inputs.self.packages.${pkgs.system}.mcuxpresso.ide.override
{
onlyUdevRules = true;
})
];
}

View file

@ -24,6 +24,7 @@ in {
"${nixos}/core/lanzaboote.nix"
"${nixos}/hardware/fprintd.nix"
"${nixos}/hardware/mcuxpresso.nix"
"${nixos}/services/power.nix"
"${nixos}/services/brightness.nix"

View file

@ -3,7 +3,7 @@
pkgs,
...
}: {
# mcuxpresso = import ./mcuxpresso pkgs;
mcuxpresso = import ./mcuxpresso pkgs;
# 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 =
(import inputs.nixpkgs {

View file

@ -1,5 +1,8 @@
# https://github.com/KoviRobi/nixos-config/blob/3ab3f8372d1fd021a235de4d314ef7147846513e/overlays/mcuxpresso.nix
{pkgs, ...}: let
{
pkgs,
onlyUdevRules ? false,
...
}: let
name = "mcuxpressoide";
version = "24.9.25";
description = "MCUXpresso IDE";
@ -50,7 +53,6 @@
pkgs.stdenv.cc.cc.lib
pkgs.gcc
pkgs.libgcc
pkgs.libstdcxx5
pkgs.xorg.libXext
pkgs.xorg.libX11
pkgs.xorg.libXrender
@ -73,7 +75,6 @@
runScript = "${mcuxpressoide}/bin/eclipse";
};
in
# wrapper with desktop entry and udev rules
pkgs.stdenv.mkDerivation {
inherit name version description;
dontUnpack = true;
@ -90,11 +91,20 @@ in
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/lib/udev/rules.d $out/eclipse $out/mcu_data
mkdir -p $out/lib/udev/rules.d
cp ${mcuxpressoide}/lib/udev/rules.d/85-mcuxpresso.rules ${mcuxpressoide}/lib/udev/rules.d/56-pemicro.rules $out/lib/udev/rules.d/
if [ ${toString onlyUdevRules} = "true" ]; then
# only 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/
else
# copy full installation
mkdir -p $out/bin $out/eclipse $out/mcu_data
cp ${mcuxpressoide}/lib/udev/rules.d/85-mcuxpresso.rules ${mcuxpressoide}/lib/udev/rules.d/56-pemicro.rules $out/lib/udev/rules.d/
cp -r ${mcuxpressoide}/eclipse $out/eclipse
cp -r ${mcuxpressoide}/mcu_data $out/mcu_data
ln -s ${mcuxpressoFhsEnv}/bin/mcuxpresso-env $out/bin/mcuxpresso
fi
ln -s ${mcuxpressoFhsEnv}/bin/mcuxpresso-env $out/bin/mcuxpresso
runHook postInstall
'';
}