[Nix-dev] Yet another configure proposal (final ?)

Michael Raskin 7c6f434c at mail.ru
Thu Aug 16 12:11:18 CEST 2007


Marc Weber wrote:
>   fltk20 = (import ../development/libraries/fltk) {
>     inherit fetchurl stdenv lib mesa mesaHeaders libpng libjpeg zlib;
>     flags = [ "useNixLibs" "threads" "shared" ];
>   };
Here we agree..

> args:
> with args;
> with args.lib; 
> let 
>   flagDescr = 
>     { mandatory = { cfgOption = " --prefix=\$out"; blocks = ["cygwin" "quartz" ]; }
>     ; cygwin = { cfgOption = "--enable-cygwin"; } #         use the CygWin libraries default=no
>     ; debug = { cfgOption = "--enable-debug"; } #          turn on debugging default=no
>     ; gl = { cfgOption = "--enable-gl"; buildInputs = [ "mesa" "mesa-heaaders"]; } #             turn on OpenGL support default=yes
>     ; shared = { cfgOption = "--enable-shared"; } #         turn on shared libraries default=no
...
>     ; xdbe = { cfgOption = "--enable-xdbe"; } #           turn on Xdbe support default=no
>     ;};
>   res = getFlagAttrs flagDescr args ( ["mandatory"] ++ args.flags );
>   flattend = flattenSet res;
>   buildInputs = map ( attr: if (! __hasAttr attr args) then throw "argument ${attr} is missing!" else (__getAttr attr args) )
>                 (uniqList { inputList = catAttrs "buildInputs" flattend; });
>   buildInputNames = catAttrs "name" buildInputs;
>   configureFlags = uniqList { inputList = intersperse " " ( catAttrs "cfgOption" flattend); };


So, you do not think that 'just supply and  auto-detect' optional
dependencies are critical for fltk, though looks like nixzlib flag is
really redundant (auto-detect should work). Also the changes to Nix are
not only in current release, but aren't still in SVN... Maybe, the best
way would be if you first commit listToAttrs; next add 'optional' to
your template and commit it as something like template-for-unstable.nix.
I will merge default value support and name suffixes into it. Also, I
cannot get the idea of using uniqList if you use listToAttrs anyway. I
guess just listToAttrs+attrNames will work better.



More information about the nix-dev mailing list