Hi,
I’d like to install mozilla overlays using home-manager. Note that I’d like the overlay to be available both when home-manager
runs and afterward, because I’d like to use the nixpkgs.latest.rustChannels
packages in my projects. Having the overlays when home-manager runs is easy:
# home.nix
{ config, pkgs, ... }:
let
mozilla-overlays = import (builtins.fetchTarball {
url = https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz;
});
in {
nixpkgs.overlays = [ mozilla-overlays ];
nixpkgs.config.allowUnfree = true;
home.packages = with pkgs; [
latest.firefox-nightly-bin
];
}
But this does not install the overlays permanently. To do so, my idea was to have a derivation that would copy the overlays in the store, and use home-manager to write ~/.config/nixpkgs/config.nix
:
let
mozilla-overlays = pkgs.stdenv.mkDerivation rec {
name = "mozilla-overlays";
src = fetchTarball {
url = https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz;
};
installPhase = "mkdir -p $out ; cp -r * $out";
};
in {
programs.home-manager.enable = true;
home.stateVersion = "19.09";
nixpkgs.config.allowUnfree = true;
# Make the overlays available when home-manager runs
nixpkgs.overlays = [ mozilla-overlays ];
# Make the overlays available permanently
xdg.configFile."nixpkgs/config.nix".text = "${mozilla-overlays}";
home.packages = with pkgs; [
latest.firefox-nightly-bin
];
}
However, that doesn’t work:
$ home-manager build
error: infinite recursion encountered, at /nix/store/v8n46qk2mx9izhpnvk43ygiy3d2gr5cj-nixos-20.03pre209690.c438ce12a85/nixos/lib/attrsets.nix:344:7
(use '--show-trace' to show detailed location information)
error: infinite recursion encountered, at /nix/store/v8n46qk2mx9izhpnvk43ygiy3d2gr5cj-nixos-20.03pre209690.c438ce12a85/nixos/lib/attrsets.nix:344:7
(use '--show-trace' to show detailed location information)
/home/corentin/.nix-profile/bin/home-manager: line 115: /tmp/home-manager-build.MZGv2mHbnS/news-info.sh: No such file or directory
I’m wondering if what I’m trying to achieve makes sense, or if it is an anti-pattern. If that makes sense, how could I make this work?