Re: [Nix-dev] Evaluation time vs build time

2017-06-03 Thread Profpatsch
On 17-05-31 08:07pm, Linus Heckemann wrote:
> On 31/05/17 18:01, Judson Lester wrote:
> As far as I understand it, it's mostly true β€” I believe it *is* actually
> possible, just strongly discouraged and absolutely not accepted in
> nixpkgs because (iiuc) of the mess of dependencies it can create.

That is true.

something like
```
let
  fooSrc = fechgit {};
  fooDerivation = import "${fooSrc}/default.nix"
in
  fooDerivation
```

will build the fooSrc derivation at *evaluation time*
(blocking the evaluator) before building the derivation
imported from the fooSrc derivation output.

Because the hash of `fooSrc` has to be given,
the default.nix in `fooSrc` is also fixed-input.

It is strongly discouraged in nixpkgs,
though I sometimes use it for private projects.

-- 
Proudly written in Mutt with Vim on NixOS.
Q: Why is this email five sentences or less?
A: http://five.sentenc.es
May take up to five days to read your message. If it’s urgent, call me.
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Evaluation time vs build time

2017-05-31 Thread Peter Simons
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  {} }:
 |
 | 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

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Evaluation time vs build time

2017-05-31 Thread Frank

Op 31-5-2017 om 21:07 schreef Linus Heckemann:

On 31/05/17 18:01, Judson Lester wrote:


nix expressions cannot 'makedepend'

In other words, values in a nix expression can't be computed from the
sources used to build an application.

My question is, basically, is that true? Do I understand this correctly?
Even if I do, I'm sure there's details an nuances that could be expanded on.

As far as I understand it, it's mostly true β€” I believe it *is* actually
possible, just strongly discouraged and absolutely not accepted in
nixpkgs because (iiuc) of the mess of dependencies it can create.

However, I don't fully understand all the ins and outs of this and may
be wrong.


It is nice to do all package management (except building) without 
downloading sources. Using the sources in nix-expressions would 
compromise that.


Greetings,
Frank

(BTW, makedepend changes the makefile: autogenerating nix-files is possible)
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Evaluation time vs build time

2017-05-31 Thread Linus Heckemann
On 31/05/17 18:01, Judson Lester wrote:
> All,
> 
> Please take this with a grain of salt. I'm trying to clarify my
> understanding of Nix, and I've started to develop a kind of precept that
> I don't know that I've seen documented anywhere. It may well be a
> sophomore misunderstanding, and if such I don't want it to be taken up
> as gospel. I think the most succinct way to put it would be:
> 
> nix expressions cannot 'makedepend'
> 
> In other words, values in a nix expression can't be computed from the
> sources used to build an application.
> 
> This is because (and here I'm sketchier) nix-build (upon which `nix-env
> --install` /et al/ are based) evaluates the expressions, and calls to
> 'derivation' that are executed, as a side effect, "queue up" builds.
> Once a derivation is actually produced (iow, when the evaluation
> completes), the queue of derivation builds are run. Since the
> expression's evaluation is complete before the derivation builds happen,
> the sources aren't available at evaluation time.
> 
> One of the consequences of this are the family of *2nix tools that
> exist: per-language library dependency manifests (like a Gemfile or
> package.json) wouldn't be available if the corresponding builder
> function just said "gitfetch this repo and build from it", so setting
> those packages up requires the extra step of getting the appropriate
> manifest files, running a simple tool on them, and pointing the
> expression to the tool's results.
> 
> Another, more profound consequence, is that the set of expressions is in
> some sense "complete" - they fully describe where to get and how to
> build packages, where a solution that admitted "makedepend" would blur
> that line and allow code to determine at packaging time what to include
> in the store.
> 
> My question is, basically, is that true? Do I understand this correctly?
> Even if I do, I'm sure there's details an nuances that could be expanded on.

As far as I understand it, it's mostly true β€” I believe it *is* actually
possible, just strongly discouraged and absolutely not accepted in
nixpkgs because (iiuc) of the mess of dependencies it can create.

However, I don't fully understand all the ins and outs of this and may
be wrong.

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] Evaluation time vs build time

2017-05-31 Thread Judson Lester
All,

Please take this with a grain of salt. I'm trying to clarify my
understanding of Nix, and I've started to develop a kind of precept that I
don't know that I've seen documented anywhere. It may well be a sophomore
misunderstanding, and if such I don't want it to be taken up as gospel. I
think the most succinct way to put it would be:

nix expressions cannot 'makedepend'

In other words, values in a nix expression can't be computed from the
sources used to build an application.

This is because (and here I'm sketchier) nix-build (upon which `nix-env
--install` *et al* are based) evaluates the expressions, and calls to
'derivation' that are executed, as a side effect, "queue up" builds. Once a
derivation is actually produced (iow, when the evaluation completes), the
queue of derivation builds are run. Since the expression's evaluation is
complete before the derivation builds happen, the sources aren't available
at evaluation time.

One of the consequences of this are the family of *2nix tools that exist:
per-language library dependency manifests (like a Gemfile or package.json)
wouldn't be available if the corresponding builder function just said
"gitfetch this repo and build from it", so setting those packages up
requires the extra step of getting the appropriate manifest files, running
a simple tool on them, and pointing the expression to the tool's results.

Another, more profound consequence, is that the set of expressions is in
some sense "complete" - they fully describe where to get and how to build
packages, where a solution that admitted "makedepend" would blur that line
and allow code to determine at packaging time what to include in the store.

My question is, basically, is that true? Do I understand this correctly?
Even if I do, I'm sure there's details an nuances that could be expanded on.

Judson
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev