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

Domen Kožar domen at dev.si
Thu Oct 8 09:18:01 CEST 2015


It's easier to generate a package that wraps the script binary and then use
it in a cronjob

On Wed, Oct 7, 2015 at 11:17 PM, Bjørn Forsman <bjorn.forsman at gmail.com>
wrote:

> 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
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20151008/6dd33bd1/attachment.html 


More information about the nix-dev mailing list