Creating a nix derivation for wxchartdir

Hi everyone!

There is this niche library associate with wxWidgets (available in nixpkgs as wxGTK32) and I noticed no package is available in nixpkgs. I wanted to take a stab at doing this myself for both practice/learning. The library is called wxchartdir (GitHub - utelle/wxchartdir: wxChartDir - Support for using the ChartDirector charting library in wxWidgets applications)

Although before that, I decided to make a derivation that can be installed, etc… However going this way I have run into wits end :laughing: and am asking the community for some guidance/ideas here.

You can see what I have so far below in my default.nix, but I have two main questions:

  1. Does what I’m doing so far seem okay? I got this far with a bunch of google-foo and doc-foo and this may be as far as I can go on my own :slight_smile:
  2. It currently is stuck because some of the files I add to $out aren’t in an expected ELF format. What is the expected format? How do I do this? Do I need the patch phase (why is is necessary?).
with import <nixpkgs> {};
stdenv.mkDerivation {
    name = "wxchartdir";
    src = fetchFromGitHub {
        owner = "utelle";
        repo = "wxchartdir";
        rev = "d612cc6b8d463c3c11d4374291e493c74039aac1";
        hash = "sha256-3MfNtkgmQs8UMz99ZRlkNqaHO62tNssYUVrTh9xMV20=";
    };
    enableParallelBuilding = true;
    doInstallCheck = false;
    dontPatch = true;
    nativeBuildInputs = with pkgs; [ autoreconfHook ];
    buildInputs = with pkgs; [ autoconf automake gnumake wxGTK32 ];
    configurePhase = ''
        ./configure
    '';
    buildPhase = ''
        make
    '';
    installPhase = ''
        mkdir $out
        cp -r include $out
        cp -r lib $out
        cp -r libtool $out
        cp -r *.la $out
        cp -r *.pc $out
        cp -r *.m4 $out
        cp -r wxdemo $out
    '';
}

If you can help me out once more, I am trying to make this derivation digestable by a cmake project. Building this produces a package-config file (.pc), some .la file, some .m4 file, and .lo files, all of which I have never heard of (except package-config of course). Do I really need to include all of these files to make it digestible for a cmake project?

Thanks everyone! Apologies for such a noobie question! :slight_smile:

autoconf automake gnumake