I am attempting to run Haskell executables from the command line, following the example of this blog. My machine runs NixOS.
The blog is about compiling markdown literate haskell into html for publishing blog posts. One step in that process is to run the haskell program hscolour on the .lhs file to create a .mkd file with the code syntax-highlighted via html and css.
cat blah.lhs | hscolour -lit -css > blah.mkd
When I try to run this command, however, I get the following command not found error.
$ cat blah.lhs | hscolour -lit -css > blah.mkd
hscolour: command not found
I'm not sure whether this issue I'm having is specific to NixOS, or with making haskell executables available to the command line more broadly. How do I make haskell executables such as hscolour available from the command line?
I have tried running this command from within a nix-shell in which hscolour has been built. The hscolour command still was not found.
$ nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [hscolour])"
$ cat functor-proofs.lhs | hscolour -li
hscolour: command not found
Two things to know:
You don't need GHC, you just need the executable from hscolour, which you can obtain as haskell.lib.justStaticExecutables haskellPackages.hscolour.
The binary for hscolour is called HsColour, not hscolour.
To demonstrate:
$ nix-shell -p 'haskell.lib.justStaticExecutables haskellPackages.hscolour' --run 'HsColour --version'
HsColour 1.24
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With