[Nix-dev] easiest way to create a derivation which is just a directory with files

Marc Weber marco-oweber at gmx.de
Tue Aug 28 20:08:10 CEST 2012


Excerpts from Mathijs Kwik's message of Tue Aug 28 18:14:07 +0200 2012:
> I have a bunch of files created with pkgs.writeText.

writeText => you can specify the target location such as $out/bin/x or
$out/share/foo

=> how to turn them into one directory?

mkDerivation {
 name = "x";
 phases = "installPhase";

 derivationsToLink = [ fileA fileB ];

 installPhase = ''
   ensureDir $out
   for i in $derivationsToLink;
    mkdir -p ..
    cp $i $out/ ..
   done
 '';
}

well - this derivation already exists, its called buildEnv and is very
very similar to what nix-env does..

> I would like to bundle them into 1 derivation, so I can run buildEnv
> on a few of these dirs to merge them.
Alternative -> wiki "how to keep multiple packages up to date easily" or such.
That's using buildEnv like stuff, too.

There was yet another function using xorg tool to build symlinks - but
it does not matter anymore cause you got enough pointers now.

Marc Weber


More information about the nix-dev mailing list