[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nix-dev
Subject:    Re: [Nix-dev] nix-shell with system pkgs
From:       Colin Putney <colin () wiresong ! com>
Date:       2016-01-26 17:14:24
Message-ID: CAD+=c1hR61At3S7T0iYvZ79P6NqGCgP906xzXnocXTr6MjQt2Q () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Tue, Jan 26, 2016 at 9:03 AM, yacine.hmito <yacine.hmito@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

[Attachment #5 (text/html)]

<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan \
26, 2016 at 9:03 AM, yacine.hmito <span dir="ltr">&lt;<a \
href="mailto:yacine.hmito@gmail.com" \
target="_blank">yacine.hmito@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div>  
<div>Thanks for the answer.</div><div><br></div><div>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.</div><div><br></div><div>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&#39;t understand \
why.</div><div><br></div></div></blockquote><div><br></div><div>Ah, ok. Then you want \
something like this:</div><div><br></div><div>in \
custompkgs.nix:</div><div><br></div></div></div><blockquote style="margin:0 0 0 \
40px;border:none;padding:0px"><div class="gmail_extra"><div \
class="gmail_quote"><div><font face="monospace, \
monospace">let</font></div></div></div></blockquote><blockquote style="margin:0 0 0 \
40px;border:none;padding:0px"><div class="gmail_extra"><div \
class="gmail_quote"><div><font face="monospace, monospace">   pkgs = import \
&lt;nixpkgs&gt; {};</font></div></div></div></blockquote><blockquote style="margin:0 \
0 0 40px;border:none;padding:0px"><div class="gmail_extra"><div \
class="gmail_quote"><div><font face="monospace, monospace">   callPackage = \
pkgs.lib.callPackageWith allPkgs;</font></div></div></div></blockquote><blockquote \
style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_extra"><div \
class="gmail_quote"><div><font face="monospace, monospace">   allPkgs = pkgs // \
{</font></div></div></div></blockquote><blockquote style="margin:0 0 0 \
40px;border:none;padding:0px"><div class="gmail_extra"><div \
class="gmail_quote"><div><font face="monospace, monospace">      mypkg = callPackage \
./mypkg.nix {};</font></div></div></div></blockquote><blockquote style="margin:0 0 0 \
40px;border:none;padding:0px"><div class="gmail_extra"><div \
class="gmail_quote"><div><font face="monospace, monospace">      otherpkg = \
callPackage ./otherpkg.nix {};</font></div></div></div></blockquote><blockquote \
style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_extra"><div \
class="gmail_quote"><div><font face="monospace, monospace">   \
};</font></div></div></div></blockquote><blockquote style="margin:0 0 0 \
40px;border:none;padding:0px"><div class="gmail_extra"><div \
class="gmail_quote"><div><font face="monospace, monospace">in \
allPkgs</font></div></div></div></blockquote><font face="monospace, \
monospace"><br></font><div><font face="arial, helvetica, sans-serif">In \
mypkg.nix:</font></div><div><font face="arial, helvetica, \
sans-serif"><br></font></div><blockquote style="margin:0 0 0 \
40px;border:none;padding:0px"><div><font face="monospace, monospace">{ stdenv, \
otherpkg }:</font></div></blockquote><blockquote style="margin:0 0 0 \
40px;border:none;padding:0px"><div><font face="monospace, monospace">   \
stdenv.mkDerivation { inherit otherpkg; ... \
}</font></div><div><br></div></blockquote>Then invoke the shell like \
this:<div><br></div><blockquote style="margin:0 0 0 \
40px;border:none;padding:0px"><div><font face="monospace, monospace">&gt; nix-shell \
custompkgs.nix -A mypkg</font></div></blockquote><div><font face="arial, helvetica, \
sans-serif"><br></font></div><font face="arial, helvetica, sans-serif"><div><font \
face="arial, helvetica, sans-serif"><br></font></div>- \
Colin<br></font><div><div><font face="arial, helvetica, \
sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">    \
</font></div></div></div>



_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic