Hi,
I have a problem adding an overlay in a mkShell derivation when other overlays are defined globally: the global defined ones are removed.
For example, I have configured the mozilla overlay to access the latest version of the rust compiler, adding it to ~/.config/nixpkgs/overlays/
. The overlay is working correctly, if added to any shell.nix or equivalent and used via nix-shell, lorry/direnv etc.
Now I would like to configure something else, and I tried to add another overlay in one shell.nix, but I noticed that if I have a file like this (there is an the empty overlay configured in overlays
just to reproduce the problem) all my previous overlays (for example the mozilla ones) are no longer available
{ pkgs ? import <nixpkgs> {
overlays = [
(self: super: {}) ];
}}:
with pkgs;
mkShell {
buildInputs = [
latest.rustChannels.stable.rust
];
}
In this case latest.rustChannels.stable.rust
is not defined anymore.
It seems that the overlays
attribute is not merged with the previous values, so if I have already some overlay defined, the overlays
properties is overwritten and the previous overlays are lost.
I tried to ++
overlays
using rec
but then I have an infinite recursion; I was not able to define a second pkgs extending the first one adding just an overlay too.
Do you have any hint how to solve this problem?
Thanks!
btw: then I would like to use one of global overlays inside my custom overlay in shell.nix, but I think it should not be a big problem using self
if the new overlay is added correctly to the overlay chain