[Nix-dev] Packaging Bash Scripts

Shea Levy shea at shealevy.com
Wed Aug 29 14:20:55 CEST 2012


Hi Alexander,

On 08/29/2012 05:27 AM, Alexander Foremny wrote:
> Hello list,
>
> I am currently trying to create a Nix expression for plowshare [1]. I
> got a working version [2] already, since installation is quite
> straight forward. However, as mentioned in the pull request I am
> worrying about purity.
>
> In particular the Bash script calls the curl binary. The first
> observation is that running one of plowshare's executables the curl
> binary is being found correctly. I think this is because curl is
> available in my PATH.
>
>> $ which curl
>> ~/.nix-profile/bin/curl
> I would have expected that this wouldn't be the case if I had removed
> curl from my environment. However, the following still yields the same
> result.
>
>> $ nix-env -e curl
>> $ which curl
>> ~/.nix-profile/bin/curl
> This also arises in a newly created shell and I can also execute the
> curl binary. I am guessing that curl is some kind of NixOS' standard
> environment. Is this correct?
>
> Is it considered an impurity that plowshare finds curl without
> depending on curl's derivation? If this is the case, is this impurity
> introduced by NixOS or by the Nix expression?

It's an impurity in plowshare's nix expression.

> If this is an issue, how would I solve it? Should I patch plowshare's
> Bash scripts to refer to the curl's derivation instead of `which
> curl`? Or even better, is there a wrapper for this kind of programs
> already?

wrapProgram (available if you add makeWrapper to buildInputs) is 
probably what you want. An example of how it can be used is at 
https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/taxes/aangifte-2011/default.nix#L30

> Regards,
> Alexander Foremny
>
> [1] http://code.google.com/p/plowshare/
> [2] https://github.com/NixOS/nixpkgs/pull/117
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev



More information about the nix-dev mailing list