Search code examples
haskellnixosketer

How to build & deploy Keter for NixOS?


Here is my fork of Keter with *.nix files generated via cabal2nix: https://github.com/bsima/keter/tree/nix

I did nix-build shell.nix on my dev machine (NixOS 17.09), then used nix-copy-closure to put it on my VPS on Digital Ocean (also NixOS 17.09, via nix-infect).

I created a systemd service which starts just fine, but then Keter dies after trying to fork a process for the server:

2018-02-03 19:34:03.21: Data.Conduit.Process.Unix.monitorProcess: /opt/keter/temp/pprjam-0/dist/bin/pprjam: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)

It can't find exec, which I believe should be a part of coreutils. I doubt coreutils is missing, but just in case I put it in my environment.systemPackages and rebuilt, but it still didn't work.

So that makes me think this is a $PATH problem, or this issue (which I don't quite understand, so I'm assuming it's more likely a $PATH problem).

Is there something I have to do in Keter's default.nix in order to help it find exec on the $PATH of the target machine? What else am I missing here?


Solution

  • exec is actually a shell built-in, not a coreutils command. Actually the createProcess error message is confusing. The command name that can't be found comes before the createProcess:. So the problem is not that pprjam can not find exec (as a command), but createProcess detected a failed exec system call.

    It seems that /opt/keter/temp/pprjam-0/dist/bin/pprjam is missing on your server, or the runtime linker can not find pprjam's dependencies. If the latter is the case, you may be able to fix it by extending the LD_LIBRARY_PATH environment variable of the Keter service.