Weird error while packaging zsh-bd

https://github.com/pasqui23/nixpkgs/blob/03cb2002a8a466e0bedebcf98ff9c41eaea434f4/pkgs/shells/zsh/zsh-bd/default.nix
This simple package build fail in the following way:

nix build -f . zsh-bd                                                                                                                    builder for '/nix/store/avs6za8726kn5ggnpna714l6kvwc8qml-zsh-bd-2018-07-04.drv' failed with exit code 1; last 3 log lines:
  install
  install: missing file operand
  Try 'install --help' for more information.
[0 built (1 failed)]
error: build of '/nix/store/avs6za8726kn5ggnpna714l6kvwc8qml-zsh-bd-2018-07-04.drv' failed

It’s because you wrote phases = ["install"]. You want phases = ["installPhase"]. Each value of the phases argument is treated as a shell function to invoke, so you asked the builder to invoke the bare word install.

I thought this was discouraged. Is it needed ?

Setting phases in general is discouraged. You may want dontBuild = true; instead of setting it at all.

Also I guess dontUnpack since this derivation is copying from $src directly. Probably simpler to allow the unpack phase after all and then just copy from the working directory.

I’d also recommend tweaking the installPhase definition to begin with runHook preInstall and end with runHook postInstall.

1 Like