Hi Darcy,

I had this idea as well.
I came up with a temporary solution (if you want to use it you have to
heavily tweak it.. not very well tested.. 
Basically all it does is adding some .nix-profile/dev-envs/* files
created from running export within the builder thus feeding in the
buildinputs (without HOME=/homelessshelter)
Only a hack, maybe you can get some ideas from this code..

=============  =======================================================
.bashrc :
loadEnv(){
  . "${HOME}/.nix-profile/dev-envs/${1}"
}
=============  =======================================================
Put this into all-packages.nix

        myEnvFun = import ../misc/my-env;

        #example adding some libraries used to compile gegl
        geglEnv = myEnvFun rec {
           name = "gegl";
           inherit stdenv;
           buildInputs = [perl curl bzip2 gegl babl glib214 glibc ] 
                  ++ map (x : sourceWithTagsDerivation ( (addCTaggingInfo 
x).passthru.sourceWithTags ) ) [ glibc gegl ];
            extraCmds = ". ~/.bashrc; cd $PWD";
          };
=============  =======================================================
misc/my-env/default.nix:

args: args.stdenv.mkDerivation ( 
  { extraCmds =""; } // {
  phases = "buildPhase";
  buildPhase = ''
    name=${args.name}
    o=$out/dev-envs/$name
    ensureDir `dirname $o`
    echo "
    OLDPATH=\$PATH " >> $o
    export | grep -v HOME= | grep -v PATH= | grep -v PWD= | grep -v
TEMP= | grep -v TMP= >> $o 
    echo "
    PATH=$PATH:$OLDPATH
    for i in \$buildInputs; do
      export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$i/lib
    done
    export PATH=\$PATH:\$OLDPATH
    $extraCmds
    echo env $name loaded
    " >> $o
    chmod +x $o
  '';
} // args // { name = "${args.name}-env"; } )


Marc Weber
_______________________________________________
nix-dev mailing list
[email protected]
https://mail.cs.uu.nl/mailman/listinfo/nix-dev

Reply via email to