How to override stm32cubemx version?


I am using stm32cubemx package in my NixOS installation and I want to install the latest version, which is not available in nixpkgs yet. I have added these lines to my configuration.nix:

  nixpkgs.overlays = [(self: super: {
    stm32cubemx = super.stm32cubemx.overrideAttrs (old: {
      version = "6.11.0";
      src = pkgs.fetchzip {
        url = "";
        sha256 = "0qaqc1pgaz322rsq9b6lbv55yxi63jfb4h5yzs34p36k1wamdgiq";
        stripRoot = false;
    }); })];

Previously, I have done the same thing with Ghidra and it did the trick, but stm32cubemx package seems to ignore my overrides altogether - the package is still version 6.10.0. What am I missing?

Well, after reading overrideAttrs for AppImage packages? it seems, that there is no way to make overrides for this package, since it is built using buildFHSEnv.

Yeah, looking at the code for stm32cubemx in nixpkgs-unstable, seems like it’s not really possible to replace the src attribute in the package used by the buildFHSEnv. (package isn’t an attribute passed to buildFHSEnv).

(Though there’s nothing about buildFHSEnv that’d prevent use of overrideAttrs; overrideAttrs works with derivations built using stdenv.mkDerivation, and looks to me that buildFHSEnv uses that).

1 Like

@rgoulter, thank you for the clarification!

I have finally solved the problem by just going and making the pull request to bump the version. Since I am a noob with a very vague understanding of Nix (and also git/github), it was kinda scary, but in fact turned out to be easier than mucking around with overrides. I just had to stick to the, which has almost everything one should know. The only thing I had to find out myself is how to try out a single package from my local nixpkgs clone. Well, in fact I also have encountered a strange error, which didn’t allow me to do that right away, but that was just stm32cubemx specifics.

1 Like