[Nix-dev] Accessing files in derivations.
Guillaume Maudoux (Layus)
layus.on at gmail.com
Wed Apr 20 10:20:54 CEST 2016
Le 20/04/16 08:59, Vladimír Čunát a écrit :
> On 04/19/2016 10:03 PM, Layus wrote:
>> But your description made me think of a viable workaround.
>> We could ensure that every derivation has a fixed set of known outputs,
>> like dev, lib, out and man.
>> If there is no "lib" output, then the lib attribute could be an alias
>> for out.
> Yes, that has been suggested already and it's the current longer-term
> plan, at least as I see it. It requires nontrivial code rewrite, due to
> $outputLib and similar needing to be selected during evaluation and not
> during build.
>
> --Vladimir
If providing default outputs is just a question of symlinking attributes
to existing derivations, the following (pseudo)code would do, right ?
let
selectFirst = drv: attrs:
if (empty attrs) then drv else
if set ? (head attrs) then set.(head attrs) else selectFirst (tail
attrs);
wrapDerivation = drv: {
out = selectFirst drv ["out"];
dev = selectFirst drv ["dev" "out"];
man = selectFirst drv ["man" "out"];
lib = selectFirst drv ["lib" "dev" "out"];
devdoc = selectFirst drv ["dev" "man" "out"];
} // drv;
in
mkDerivarion = drv: wrapDerivation (oldMkDerivation drv);
-- Layus.
More information about the nix-dev
mailing list