Installing gnuplot with X11 support

When I install gnuplot under macOS, it has no X11 support, which makes it mostly useless. After a quick look at the package definition (note that this is the first time I look at Nix expressions, I know strictly nothing about the syntax), X11 support seems to be optional. If this is true, what is the magic incantation to install gnuplot with X11 support?

Secondary question: where would I find the answer in the manual? I spend at least one hour searching, with no useful result.

It looks like gnuplot unconditionally disables X11 on macOS, or if a flag aquaterm is provided. I don’t know what the expected UI is on macOS.

If you want to try aquaterm, whatever that is, add an overlay that looks like

self: super:
  gnuplot = super.gnuplot.override {
    aquaterm = true;

But I don’t know if this is actually what you want.

Yeah, the gnuplot situation is kind of annoying right now. Probably enabling X11 by default would make things easier & more consistent with Linux. At the same time, Apple may eventually break compatibility with XQuartz, making it a little bit dangerous to assume we have access to. Aquaterm might be an okay option, but it hasn’t been updated in 5+ years.

I actually think the Qt backend might be the best one right now. You can use withQt = true for this.

Incidentally it looks like there’s a package gnuplot_qt which is gnuplot with withQt = true (and a similar one gnuplot_aquaterm), so no overlay needed.

Thanks @lilyball and @matthewbauer for your suggestions!

Qt looks like a good option, but there is no gnuplot_qt on my system (error: selector 'gnuplot_qt' matches no derivations, my channel being at nixpkgs-20.03pre207249.7e8454fb856). But there is a line in all-packages.nix saying

gnuplot_qt = gnuplot.override { withQt = true; };

Does this require some extra command-line magic to install?

As for X11, XQuartz is just a plain macOS application that happens to implement the X11 protocol, so I don’t see how Apple could break it without also breaking tons of other applications. Which is of course something they do from time to time.

You need to install it via attribute path, not package name. nix-env -iA nixpkgs.gnuplot_qt.

Ah, thanks, that works fine!

Unfortunately, the installed gnuplot doesn’t:

Could not connect to existing gnuplot_qt. Starting a new one.
qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Do I need to install another package to get the Qt platform plugin?

I tried installing qt:

$ nix-env -i qt                                                    [7:32:46]
installing 'qt-4.8.7'
error: Package ‘qt-4.8.7’ in /nix/store/96l86c0mpipbx10yfrzk65s6yc0jj7cf-nixpkgs-19.09pre188239.c0e56afddbc/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/default.nix:230 is not supported on ‘x86_64-darwin’, refusing to evaluate.

That’s another known issue which isn’t specific to GNUplot and it has been fixed for a few packages in the past. I don’t have a mac to test this for you before giving a full solution, but you can try figure out a fix for the package according to this.

Thanks for the hint! Unfortunately this is way beyond my Nix competence. For now I am back to MacPorts.

You can try to create an issue on GitHub and quote the maintainer - @love323.