[Nix-dev] fixed-output derivation that *also* depend on (some of) its inputs?

Vladimír Čunát vcunat at gmail.com
Sat Sep 27 11:12:23 CEST 2014


On 09/24/2014 09:58 PM, Bjørn Forsman wrote:
> On 22 September 2014 17:16, Shea Levy <shea at shealevy.com> wrote:
>> I suppose a flag that says to rebuild if the output is valid but doesn't
>> have the right deriver could be what you want? But for now the best answer
>> seems to be "change the hash when it needs to change"
>
> I don't know what "deriver" is.

Deriver is the derivation that built a path (i.e. the build recipe).
If you built a path yourself, you can get it by
nix-store -q --deriver /nix/store/path

> Even though it's a bit hackish, using
>
> stdenv.mkDerivation rec {
>    extraHash = builtins.hashString "sha256" (buildCommand);
>    name = "foo-${extraHash}-0.0";
>
> works just like I want it to.

I think I understand what you want: the output should not change except 
on updating the package itself, but one can only find out the hash by 
performing the build. On update you want to do that.

I personally force such rebuilds by changing the first few sha256 
characters to zeros. The extraHash way and Shea's suggestion are other 
fine ways. For this use case, I find no clear winner, and I don't think 
we can do significantly better.


Vladimir


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3251 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20140927/c41802ed/attachment.bin 


More information about the nix-dev mailing list