title: How to use an idris package installed with a nixpkg in another nixpkg?
body: <p>Currently I am having some trouble using an Idris package that was installed with nixpkg in another Idris package that depends on it. Both of these packages have been tested on a Debian system, so the problem is not with the Idris code itself, but rather somewhere in how they are being installed on the NixOS system. I believe I can successfully install the first package by calling <code>nix-env -f math.nix -i idris_math</code> where <code>math.nix</code> is defined as: </p>
  
  <pre><code>with import &lt;nixpkgs&gt; { };
  
  stdenv.mkDerivation rec {
    name = "idris_math";
    idris = haskellPackages.idris;
    buildDepends = [ idris ];
    src = ./.;
  
    preHook = ''
      ln -sv ${idris}/share/x86_64-linux-ghc-8.0.1/${idris.name}/libs $PWD/libs
      export IDRIS_LIBRARY_PATH=$PWD/libs
    '';
  
    configurePhase = ''
      export TARGET=$out/lib/${idris.name}
    '';
  
    buildPhase = ''
        ${idris}/bin/idris --build *.ipkg
    '';
  
    installPhase = ''
      ${idris}/bin/idris --install *.ipkg
      ${idris}/bin/idris --clean *.ipkg
    '';
  
    }
  </code></pre>
  
  <p>I can then run <code>nix-env -q</code> and see that <code>idris_math</code> has been installed. The second nixpkg looks identical to <code>math.nix</code>, except the name is changed and the <code>buildDepends</code> line is now <code>buildDepends = [ idris idris_math ]</code>. When I try to build or install this package however, I am met with <code>error: undefined variable 'idris_math'</code>. Does anyone know what I am doing wrong, or of a way to fix this?</p>