"Infinite loop"(?) in pkgOverrides?

Could somebody help me understand why the following “hangs” my system?

To explain and simplify, basePackageConfig is empty. There are two statemenst inside packageOverrides, to understand the first one, see the nixpkgstarball expression below. In that expression, I (only) grab tarballs. In the first statement of packageOverrides, I import those tarballs such that pkgs.versioned.master is a package set.

In the second (and offending, hanging) statement of packageOverrides, I assign onedrive to the “main” package set. I do it from the versioned.unstable key. I do this because I have created a onedrive module which automatically launches a onedrive service.

So help me understand please why this is hanging?

		nixpkgs.config = basePackageConfig // {
			packageOverrides = pkgs: rec {
				versioned = builtins.listToAttrs
								name: value: 
									name = name;
									value = import value{
										config = config.nixpkgs.config;

				onedrive = versioned.unstable.onedrive;
	nixpkgstarball = {
		# use howoldis.herokuapp.com for git revisions
		# https://channels.nix.gsc.io/nixos-19.09/history

		unstable = fetchtarball https://github.com/nixos/nixpkgs-channels/archive/nixos-unstable.tar.gz;
		#github master. untested and self-build.
		master   = fetchtarball https://github.com/nixos/nixpkgs/archive/master.tar.gz;

I guess it’s because versioned needs a definite evaulation of config but that needs versioned.unstable? In which I was hoping nix would throw some kind of error…

Also, how do I solve it? Overlays?

do you just want the onedrive version from unstable?

1 Like

I managed to solve it by doing a separate import of a tarball outside of the nixpkgs.config and using that. Thank you. I left it because i was hoping that the infinite loop issue could be brought to attention . I wish if there were warning.

I had literally more than 10 reboots before I realized which was the offending process (I leave rebuilds in background workspaces)

Generally when I import other channels like that I strip packageOverrides from the config that I’m passing along, specifically to avoid trying to override that channel to refer to itself, which then produces an infinite loop when referencing the overridden package. This would look like

import value {
    config = removeAttrs config.nixpkgs.config [ "packageOverrides" ];