diff --git a/config/nixos/hardware/mcuxpresso.nix b/config/nixos/hardware/mcuxpresso.nix new file mode 100644 index 0000000..ec05218 --- /dev/null +++ b/config/nixos/hardware/mcuxpresso.nix @@ -0,0 +1,12 @@ +{ + inputs, + pkgs, + ... +}: { + services.udev.packages = [ + (inputs.self.packages.${pkgs.system}.mcuxpresso.ide.override + { + onlyUdevRules = true; + }) + ]; +} diff --git a/hosts/vamos/default.nix b/hosts/vamos/default.nix index faf3293..91178fd 100644 --- a/hosts/vamos/default.nix +++ b/hosts/vamos/default.nix @@ -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" diff --git a/shared/pkgs/default.nix b/shared/pkgs/default.nix index d77fc9a..0cf4299 100644 --- a/shared/pkgs/default.nix +++ b/shared/pkgs/default.nix @@ -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 { diff --git a/shared/pkgs/mcuxpresso/ide.nix b/shared/pkgs/mcuxpresso/ide.nix index fa49330..c279268 100644 --- a/shared/pkgs/mcuxpresso/ide.nix +++ b/shared/pkgs/mcuxpresso/ide.nix @@ -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 ''; }