[Nix-dev] Evaluation time vs build time

Peter Simons simons at nospf.cryp.to
Wed May 31 23:28:31 CEST 2017


Hi Judson,

I am not entirely sure whether I understand your thoughts correctly, but
if I did then it might be interesting for you to store the following
file as "default.nix":

 | { nixpkgs ? import <nixpkgs> {} }:
 |
 | with nixpkgs.pkgs;
 |
 | let
 |
 |   random = stdenv.mkDerivation {
 |              name = "random-0";
 |              buildCommand = "mkdir $out; echo $RANDOM >$out/default.nix";
 |            };
 |
 |   randomValue = import random;
 |
 | in
 | stdenv.mkDerivation {
 |
 |   name = "test-0";
 |
 |   buildCommand = ''
 |     mkdir $out
 |     touch $out/${toString randomValue}
 |   '';
 |
 | }

Then run:

  $ ls -l $(nix-build --no-out-link default.nix)

Best regards,
Peter



More information about the nix-dev mailing list