[Nix-dev] nix-shell with overlay?

Nicolas Pierron nicolas.b.pierron at nbp.name
Wed Mar 8 01:29:44 CET 2017


On Tue, Mar 7, 2017 at 5:14 PM, Matthias Beyer <mail at beyermatthias.de> wrote:
> On 07-03-2017 16:33:15, Profpatsch wrote:
>> On 17-03-07 03:57pm, Matthias Beyer wrote:
>> > Hi,
>> >
>> > is there a way to import an overlay in a default.nix for a nix-shell
>> > and use the packages from the overlay in the nix-shell only, without
>> > installing the overlay "globally" for my user?
>> >
>> > If yes, how?
>>
>> Not sure what you mean, how about just adding the overlay to the default.nix?
>>
>> import <nixpkgs> {
>>   overlays: [(self: super: {
>>     myDep = super.myDep.override {
>>>>     };
>>     myPkg = self.callPackage ./. {};

nit: super.callPackage, as the super.callPackage *function* already
aliases self packages.  Otherwise, you would be going twice through
the fix-point.

>>   })];
>> }
>
> Ah, nice! But I also have to fetch the overlay in the expression...
> (I'm trying to get the rust-overlay from mozilla to work)

you can import it in the list of overlays.

  overlays = [ (import ~/nixpkgs-mozilla/rust-overlay.nix) ]

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/


More information about the nix-dev mailing list