[Nix-dev] loading the nix-shell in a jenkins job

zimbatm zimbatm at zimbatm.com
Tue Feb 16 18:32:43 CET 2016


Sorry I meant your wrapper would look like this:

  #!/bin/sh
  cat | ./your-script

Can you also gist or make attach an exact copy of your script to make sure
things like whitespaces are not an issue ?

On Tue, 16 Feb 2016 at 15:32 Allan Espinosa <yecartes at gmail.com> wrote:

> Hi Jonas,
>
> Thanks for the tip.  I couldn't do what you said in Jenkins itself so
> I had to wrap nix-shell inside another shell wrapper:
>
> wrapper.sh:
>     #!/bin/bash
>
>     cat $1 | exec nix-shell
>
> Then i had my Jenkins job as follows:
>     #!/path/to/wrapper.sh
>     #!nix-shell -i bash
>
>     jupyter --version
>
> Hope somebody else finds this useful.
>
> Regards,
> Allan
>
> On Tue, Feb 16, 2016 at 8:49 AM, zimbatm <zimbatm at zimbatm.com> wrote:
> > It looks legit.
> >
> > Something I noticed is that nix-shell still drops me in a shell if it
> thinks
> > that the input is interactive.
> >
> > Can you try to run the same command but with `cat | ` piped in front ?
> >
> > On Tue, 16 Feb 2016 at 02:06 Allan Espinosa <yecartes at gmail.com> wrote:
> >>
> >> Hi,
> >>
> >> I've been trying to get one of my default.nix development environment
> >> build in a Jenkins job. I'm not trying to make a package but create a
> >> different artifact that will be consumed in a different way.
> >>
> >> I have this in my execute build step in a freestyle job:
> >>
> >> ```
> >> #!/usr/bin/env nix-shell
> >> #!nix-shell -i bash
> >>
> >> jupyter --version
> >> ```
> >>
> >> However, I am getting this output:
> >>
> >> ```
> >> [workspace] $ /usr/bin/env nix-shell
> >>
> >>
> /var/folders/bh/q33bp93j2js6zv27rds0n1x00000gn/T/hudson5799651993425365822.sh
> >> error: undefined variable ‘jupyter’ at
> >>
> >>
> /var/folders/bh/q33bp93j2js6zv27rds0n1x00000gn/T/hudson5799651993425365822.sh:4:1
> >> ```
> >>
> >> From the output above, it looks like my script is being interpreted as
> >> a nix expression instead.
> >>
> >> Has anyone else have experience loading the nix-shell in a Jenkins job?
> >>
> >> Thanks
> >> Allan
> >> _______________________________________________
> >> 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/20160216/c7a4e26f/attachment.html 


More information about the nix-dev mailing list