mplabx #
Nix flake packaging Microchip MPLAB X (v6.35) for NixOS / Nix on Linux.
The full installation is built entirely at build time: the official
BitRock installer is downloaded and run inside a bubblewrap + fakeroot
chroot, so the result is a self-contained store path under
$out/opt/microchip/mplabx. Nothing is installed into the host /opt.
Only the MPLAB IPE (programming environment) is installed; the IDE and compiler toolchains (XC8/XC16/XC32) are out of scope. IDE-only component directories are pruned from the store path.
Usage #
{
inputs.mplabx.url = "github:you/mplabx";
outputs = { self, mplabx, ... }: {
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
modules = [
mplabx.nixosModules.default
{
services.mplabx = {
enable = true;
users = [ "ben" ];
};
}
];
};
};
}
On a plain Nix setup (no NixOS):
$ nix run '.#mplab-ipe' # MPLAB IPE GUI
$ nix run '.#ipecmd' -- -? # headless ipecmd CLI (usage)
$ nix build '.#mplabx-unwrapped' # the raw install (no wrappers/FHS)
Packages #
mplabx-unwrapped— the raw install from the official installer, atopt/microchip/mplabx/v6.35.mplabx-fhs—buildFHSEnvsandbox that presents the install at the hardcoded/opt/microchip/mplabxlocation and provides the runtime libraries (GTK, X11, libusb, mesa, udev, JDK, ...).mplab-ipe— launcher for the IPE GUI.ipecmd— launcher for the headlessipecmdCLI.default— alias formplab-ipe.
An overlay is available at overlays.default.
NixOS module (services.mplabx) #
enable— install the package and enable udev rules.package— which package to install (defaultmplabx.mplab-ipe).users— additional users to add to theplugdevgroup (programmers are usually accessible without udev rules on modern kernels, but the group is provided for completeness).
Udev rules are installed for PICkit 4, PICkit 5, MPLAB SNAP, ICD 4/5,
REAL ICE and a generic Microchip USB VID (04d8). A stub for MPLAB's
/etc/.mplab_ide/mchpsegusbmonitor is also provided.
How it works #
-
pkgs/mplabx/unwrapped.nixfetchesMPLABX-v6.35-linux-installer.tar(SRI-hashed, requires aRefererheader), extracts the BitRock installer withmakeself, and runs it in abwrapchroot underfakerootwith:--mode unattended --unattendedmodeui none \ --ide 0 --ipe 1 --8bitmcu 0 --16bitmcu 0 --32bitmcu 0 --othermcu 0 \ --collectInfo 0 --collectMyMicrochipInfo 0Only
etc,usr/share,lib/udevandoptare copied to the store path. IDE-only directories are deleted afterwards (seeetc/mplab_ipe.clustersfor the clusters IPE actually loads). -
pkgs/mplabx/fhs.nixbuilds abuildFHSEnvrootfs;extraBuildCommandsadds the/opt/microchip/mplabxsymlink because MPLAB scripts hardcode paths like/opt/microchip/mplabx/v6.35/sys/java/zulu8.... -
pkgs/mplabx/wrapper.nixproduces themplab-ipeandipecmdlaunchers, which exec the FHS env and deriveJAVA_HOMEfrom the bundled JRE.
Notes / caveats #
- Device packs are not bundled (that saves ~10 GB). They are downloaded
at runtime by the Pack Manager into
~/.mchp_packs. If offline use is needed, bundle them via the installer's--8bitmcu/--16bitmcu/--32bitmcuoptions. - MPLAB's own
mchpsegusbmonitorhelper does not exist on a plain NixOS system; the module provides a stub at/etc/.mplab_ide/. Its absence is harmless (the launcher backgrounds it and continues). - The first GUI run initializes the userdir at
~/.mplab_ipe/dev/v6.35. ipecmdruns withDISPLAYunset (headless) as shipped by Microchip.- Build depends on network access to ww1.microchip.com (blocked inside
nix's default sandbox, so use--option sandbox falseor a sandbox-exempt builder if needed).
- Nix 100%