[Nix-dev] Re: I'm stuck again.. How is the nix way to do this? nix-env -i superfluous?

apfelmus apfelmus at quantentunnel.de
Wed Aug 15 13:59:20 CEST 2007


Andres Loeh schrieb:
>>> I'd see it more as generalizing nix-env -i. At the moment, you can
>>> fully instantiated nix expressions (i.e., non-functions) to your
>>> environment. Ideally, there'd be an UI where you can add functions
>>> still lacking arguments, and get some guided help what to fill in for
>>> the arguments. Phantasy syntax:
>>> nix-env -i ghc --with-libs="gtk2hs quickcheck"
>>> nix-env -i ghostview --with-x11
>>> Correspondingly, nix-env -q could provide output over the available
>>> flags per expression. The program nix-env would then translate all the
>>> commands into a per-user expression, what maybe it already does.
 >>
>>  Note that you can already install arbitrary nix expressions into your 
>>  environment. I guess that the following should work
>>
>>  $ nix-env -i -E 'f: f.ghostview {x11Support = true; x11 = f.x11 }'
>>
>>  See also the manual for nix-env. Of course, the syntax could use less space 
>>  but I think that's as best as we can get.
> 
> I'm aware of that, and I should have mentioned it.But I think that
> the UI side of things has to be improved. Sooner or later, we need
> a way to attach descriptions to missing arguments, to query the "type"
> of a missing argument, and for stuff like ghc library packages, have
> a list of possible choices that are supposed to work.

Yes, I want to query the types and see what combinations are 
possible/required!

 > Furthermore, I personally have no problems with being asked to
 > write an anonymous function parameterized by the default packages
 > collection, but the average user might not be too happy about
 > such an instruction.

Yeah. Hm, doesn't nix already have all the necessary ingredients? Given 
that the default package collection is an attribute set, we can write

   nix-env -i -E \
   'f : { with f; ghostview {x11Support = true; inherit x11} }'

The 'f : { with f; }' part can be abstracted into another command line flag

   nix-env -i -EE \
   'ghostview {x11Support = true; inherit x11} }'

Personally, I favor simple function application over other command line 
methods like --with-libs="gtk2hs quickcheck" since the latter cannot be 
nested and are not higher-order.

Arguably, the x11Support flag is superfluous and I wish that  x11  had 
the type  Maybe Derivation . Hm, or maybe supplying the  x11  package on 
the command line is superfluous. In any case, one of them is :)

Regards,
apfelmus




More information about the nix-dev mailing list