Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnuplot_full: init with support for lua/tikz/tex #32957

Closed
wants to merge 2 commits into from

Conversation

dtzWill
Copy link
Member

@dtzWill dtzWill commented Dec 21, 2017

Motivation for this change

#32941

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Test included that both demonstrates how to use gnuplot_full with tikz terminal, as well as verifying it continues to work moving forward.

@@ -58,6 +62,9 @@ stdenv.mkDerivation rec {

enableParallelBuilding = true;

# Set TEXINPUTS to include us
setupHook = lib.optionalString (withTeXLive) ./setup-hook.sh;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this setupHook is necessary for tests, then users won't be able to use tikz outside nix-shell, right? To fix this, replace the hook with makeWrapper.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that gnuplot doesn't need TEXINPUTS set, but instead latex will need to know how to find gnuplot's tex files when building the output created using the tikz terminal.

That doesn't mean there isn't a cleaner way, which would be welcome! :)

Copy link
Contributor

@orivej orivej Dec 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not tested this (except that it evaluates), but you can try:

-stdenv.mkDerivation rec {
+lib.fix (self: stdenv.mkDerivation rec {

-    ++ lib.optional withTeXLive (texlive.combine { inherit (texlive) scheme-small; })
+    ++ lib.optional withTeXLive (texlive.combine { inherit (texlive) scheme-small self; })

-    configureFlagsArray+=(--with-texdir=$out/share/texmf-nix/tex/latex/gnuplot)
+    configureFlagsArray+=(--with-texdir=$out/share/texmf/tex/latex/gnuplot)

-}
+})

EDIT: this is incorrect, it will not evaluate with withTeXLive.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, if runCommand "tikz-plot" succeeds and it needs TEXINPUTS, then the wrapper should be an adequate replacement for setupHook, and it will also support users outside nix-shell. However, I'd prefer my snippet if it works.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gnuplot does not invoke tex-- and so setting TEXINPUTS in the tex we pass it doesn't help. Honestly I'm not entirely sure what purpose passing tex as a buildInput does, I'm not sure it's used at runtime.

The workflow is instead that gnuplot, when using the tikz terminal, generates output that is "incomplete" and needs gnuplot's generated files to be properly build using texlive.
So when the user includes this output in a document (tikz-pdf generates a basic example of this) the tex used needs to know how to find these pieces, hence the setup-hook.
If a wrapper were used, it would need to wrap tex or something, I think.

tikz-plot doesn't need any tex bits, or TEXINPUTS to be set, but rather it's that TEXINPUTS is how the tex in tikz-pdf knows to resolve the gnuplot tikz package/extensions.

At first I wanted to do something like:

texlive.combine { inherit (texlive) scheme-small; inherit gnuplot_full; }

For this purpose (the tex in tikz-pdf, not input to gnuplot build) which maybe would remove the need for the setup-hook and should work outside of nix-shell ... if it evaluated O:).

Unfortunately that's not really how texlive.combiine is meant to work, so instead of faking a texlive package for gnuplot or something I went the setup-hook route.

Make sense?

@dtzWill
Copy link
Member Author

dtzWill commented Jan 18, 2018

Closing due to lack of interest (myself very much included), can revisit if someone is interested in this.

@dtzWill dtzWill closed this Jan 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants