[Nix-dev] nix-shell with system pkgs

Colin Putney colin at wiresong.com
Tue Jan 26 18:14:24 CET 2016


On Tue, Jan 26, 2016 at 9:03 AM, yacine.hmito <yacine.hmito at gmail.com>
wrote:

> Thanks for the answer.
>
> What I am trying to achieve is using nix-shell from a custom derivation.
> Not a specific one (your solution is on point for that) but any derivation
> in a set.
>
> I achieved this as I explain in the first message. The problem is that the
> way I did it, derivations cannot depend on each other. I don't understand
> why.
>
>
Ah, ok. Then you want something like this:

in custompkgs.nix:

let

  pkgs = import <nixpkgs> {};

  callPackage = pkgs.lib.callPackageWith allPkgs;

  allPkgs = pkgs // {

    mypkg = callPackage ./mypkg.nix {};

    otherpkg = callPackage ./otherpkg.nix {};

  };

in allPkgs


In mypkg.nix:

{ stdenv, otherpkg }:

  stdenv.mkDerivation { inherit otherpkg; ... }

Then invoke the shell like this:

> nix-shell custompkgs.nix -A mypkg



- Colin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160126/c1913c26/attachment-0001.html 


More information about the nix-dev mailing list