[Nix-dev] Running nix-shell commands as cron jobs

Bjørn Forsman bjorn.forsman at gmail.com
Wed Oct 7 23:17:32 CEST 2015


On 7 October 2015 at 22:06, Anders Lundstedt <anders at anderslundstedt.se> wrote:
> A python script I have depends on the requests2 package. I can run the
> script using
>
> nix-shell --pure -p python3 -p python3Packages.requests2 --run ./my-script.py
>
>
> However when putting this line as a cron job I get the cron output:
>
> error: Nix database directory ‘/nix/var/nix/db’ is not writable:
> Permission denied
>
>
> What solutions are there to run a simple script with dependencies as a
> cron job, other than to add the script as a package?

I think that means the cron job does not have the environment variable
NIX_REMOTE set to "daemon". Try setting it, one way or the other, and
the command should work.

- Bjørn


More information about the nix-dev mailing list