[Nix-dev] Packaging Bash Scripts

Alexander Foremny alexanderforemny at gmail.com
Wed Aug 29 15:20:29 CEST 2012


Hello Shea,

thank you very much for your response! I modified my Nix expression
[1]. Is this correct?

Is there a way to test if things are actually working? Apparently I
cannot remove curl from my profile.

> $ nix-env -e curl
> $ curl --help
> Usage: curl [options...] <url>
> ...

The commands above prints curl's help text which I did not expect.

Regards,
Alexander Foremny

[1] https://github.com/aforemny/nixpkgs/blob/aed5c366944b98624411c5551f2d43becafdf44d/pkgs/tools/misc/plowshare/default.nix

2012/8/29 Shea Levy <shea at shealevy.com>:
> 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