6 votes

Help Packaging Elmer FEM for Nix

I'm trying to package Elmer for use with NixOS, and could use some help from any experienced Nix users. My current attempt is located here. There is some junk left around in that file from my experimenting, but it's at least a start. There are also a few lines of error included in the comment here.

Any help is appreciated!

3 comments

  1. [3]
    deing
    Link
    I copied over your expression and looked into the build, scrolling up in the output a bit I found why make failed: /build/source/matc/src/str.c: In function 'str_sprintf':...
    • Exemplary

    I copied over your expression and looked into the build, scrolling up in the output a bit I found why make failed:

    /build/source/matc/src/str.c: In function 'str_sprintf':
    /build/source/matc/src/str.c:85:5: error: format not a string literal and no format arguments [-Werror=format-security]
       85 |     sprintf(str_pstr, fmt);
          |     ^~~~~~~
    cc1: some warnings being treated as errors
    

    Nix by default enables some hardening options, you can disable the specific one causing this error by adding hardeningDisable = [ "format" ]; to your mkDerivation arguments.
    Obviously there's always one more problem. This time, it was

    In file included from /build/source/build/ElmerGUI/Application/ElmerGUI_autogen/UVLADIE3JM/moc_convergenceview.cpp:9,
                     from /build/source/build/ElmerGUI/Application/ElmerGUI_autogen/mocs_compilation.cpp:5:
    /build/source/ElmerGUI/Application/src/convergenceview.h:55:10: fatal error: qwt_compat.h: No such file or directory
       55 | #include <qwt_compat.h>
          |          ^~~~~~~~~~~~~~
    compilation terminated.
    

    You already had correctly specified qwt as a dependency, but for some reason the qwt package doesn't include that particular header. So I used nix-locate qwt_compat.h to find out that it's present in the qwt6_qt4 package. Replace it and your project should build correctly!

    8 votes