jgm/texmath

Installing `texmath` binary as dependency in Nix project

Closed this issue · 2 comments

dpk commented

I have a non-Haskell project which depends on the texmath binary. I’m trying to set this up as a dependency in Nix and am not getting very far.

nixpkgs.haskellPackages.texmath does not include the binary (also not the server binary). I tried adding the texmath repo as a submodule and adding its default.nix as a build input, but that gave this error when I tried to start the shell:

bash: pop_var_context: head of shell_variables not a function context
bash: pop_var_context: head of shell_variables not a function context

and I’m not sure how I’d go about adapting that to also install the binary anyway.

jgm commented

I can't help with nix, but to get the executable you need to set the executable flag when compiling, e.g. -fexecutable when using cabal.

dpk commented

This did it:

let
  pkgs = import <nixpkgs> {};
  texmath = pkgs.haskellPackages.texmath;
  texmath-executable = pkgs.haskell.lib.addBuildDepends (pkgs.haskell.lib.enableCabalFlag texmath "executable") [ pkgs.haskellPackages.network-uri ];
in
pkgs.mkShell {
  buildInputs = [
    texmath-executable
  ];
}