Haskell executable not added to path in nix-shell

I’m trying to start a nix shell with citeproc using:

nix-shell -p 'haskellPackages.citeproc' --run 'citeproc -h'

But this fails with:

/private/tmp/nix-shell-69925-0/rc: line 3: citeproc: command not found

I also tried the following version that I found in a StackOverflow post:

nix-shell -p 'haskell.lib.justStaticExecutables haskellPackages.citeproc' --run 'citeproc -h'

But it also fails with command not found

A few details:

  • aarch64-darwin
  • nix 2.9.1

Am I doing something wrong here?

Thank you for your help!

Upstream disalbes the citeproc executable by default, it seems. This probably changed in some release since the stackoverflow post you are talking about. As it is just gated behind a cabal flag, it can be relatively easily be flicked on. It does require extra dependencies, so the magic invocation becomes quite lengthy:

nix-shell -p "with haskell.lib.compose; justStaticExecutables (addBuildDepends [ haskellPackages.aeson-pretty haskellPackages.text-icu ] (enableCabalFlag \"executable\" haskellPackages.citeproc))"

We should probably provide a better way to obtain the executable, either via a bin output or separate attribute. Feel free to open a bug report about this in the nixpkgs repository and tagging @NixOS/haskell.

3 Likes

Thank you! That solution works for me.

I opened an issue about exposing the executable in a friendlier way here.