Infinite recursion on nixos-rebuilt - related to lxqt

I don’t have/use any overlays. This just broke after a nixos-rebuild switch --ugprade, I couldn’t pinpoint exactly the moment.

$ sudo nixos-rebuild --upgrade switch --show-trace
unpacking channels...
created 2 symlinks in user environment
Failed to parse bus message: Invalid argument
building Nix...
building the system configuration...
error: while evaluating the attribute 'activationScript' of the derivation 'nixos-system-nixos-20.03.3129.d3784204ba1' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix:103:5:
while evaluating the attribute 'system.activationScripts.script' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/activation-script.nix:68:9:
while evaluating 'textClosureMap' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/strings-with-deps.nix:70:35, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/activation-script.nix:89:18:
while evaluating 'id' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/trivial.nix:14:5, called from undefined position:
while evaluating the attribute 'text' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/activation-script.nix:9:5:
while evaluating the attribute 'text' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/strings-with-deps.nix:77:38:
while evaluating the attribute 'sources' of the derivation 'etc' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/etc/etc.nix:12:5:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/etc/etc.nix:20:20, called from undefined position:
while evaluating the attribute 'source' at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:84:45, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:379:9:
while evaluating the option `environment.etc.dbus-1.source':
while evaluating the attribute 'mergedValue' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:411:5:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:413:22, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:413:9:
while evaluating 'check' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:251:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:414:14:
while evaluating the attribute 'serviceDirectories' of the derivation 'dbus-1' at /nix/store/nn66gl5dyy0sk2ikyd8cvgkh95v3r8bh-nixos-20.03.3129.d3784204ba1/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:263:14, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:425:27:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:413:22, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:413:9:
while evaluating 'check' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:251:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:414:14:
while evaluating the attribute 'passAsFile' of the derivation 'system-path' at /nix/store/nn66gl5dyy0sk2ikyd8cvgkh95v3r8bh-nixos-20.03.3129.d3784204ba1/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'buildCommand' of the derivation 'desktops' at /nix/store/nn66gl5dyy0sk2ikyd8cvgkh95v3r8bh-nixos-20.03.3129.d3784204ba1/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating 'concatMapStrings' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/strings.nix:31:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/x11/display-managers/default.nix:124:9:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/x11/display-managers/default.nix:124:27, called from undefined position:
while evaluating the attribute 'text' of the derivation 'lxqt+openbox-xsession' at /nix/store/nn66gl5dyy0sk2ikyd8cvgkh95v3r8bh-nixos-20.03.3129.d3784204ba1/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'text' of the derivation 'xsession' at /nix/store/nn66gl5dyy0sk2ikyd8cvgkh95v3r8bh-nixos-20.03.3129.d3784204ba1/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'start' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/x11/desktop-managers/default.nix:73:11:
while evaluating the attribute 'start' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/x11/desktop-managers/lxqt.nix:34:7:
infinite recursion encountered, at undefined position

Commenting out services.xserver.desktopManager.lxqt.enable = true; makes the infinite recursion go away. Any idea what might be going on here? I am on NixOS 20.03, I can post the entire configuration.nix if requested, but there’s really nothing special there. I am using some package versions from unstable, but that is all.

generally this happens if one module changes a value, then another module changes it to a different value, and then the modules are unable to get to a “fixed point”

please post the rest of the configuration.nix

Here it is. I did try commenting most of it out but it didn’t make a difference.

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ lib, config, pkgs, ... }:


let 
	unstable = import <nixos-unstable> { config = { allowUnfree = true; }; };
	myCustomLayout = pkgs.writeText "xkb-layout" ''
		! Map umlauts to RIGHT ALT + <key>
		keycode 108 = Mode_switch
		keysym e = e E EuroSign
		keysym c = c C cent
		keysym a = a A adiaeresis Adiaeresis
		keysym o = o O odiaeresis Odiaeresis
		keysym u = u U udiaeresis Udiaeresis
		keysym s = s S ssharp

		! disable capslock
		! remove Lock = Caps_Lock
	'';
	#protonmail-bridge = pkgs.protonmail-bridge.overrideAttrs(old: rec {
	#	version = "1.3.3";
	#	src = pkgs.fetchurl {
	#		url = "https://protonmail.com/download/protonmail-bridge_${version}-1_amd64.deb";
	#		sha256 = "5265f10ec78a1051ed816910f55aa8b1ebfca53f747df38dc8af27f214105ca0";
	#	};
	#});	
in
{
	imports =
		[ # Include the results of the hardware scan.
		./hardware-configuration.nix
		];

	nixpkgs.config.allowUnfree = true;

	# Use the systemd-boot EFI boot loader.
	boot.kernelPackages = unstable.linuxPackages_latest;
	boot.kernelModules = [ "zenpower" "msr" ];
	boot.loader.systemd-boot.enable = true;
	boot.loader.efi.canTouchEfiVariables = true;
	boot.blacklistedKernelModules = [ "radeon" "k10temp" ];
	boot.extraModulePackages = [ unstable.linuxPackages_latest.zenpower ];
	boot.kernel.sysctl = {
	    "kernel.sysrq" = 1;
    	};
	boot.loader.grub.efiSupport = true;
	boot.loader.grub.memtest86.enable = true;
  
	#powerManagement.cpuFreqGovernor = "schedutil";

	#swapDevices = [
	#	{
	#		device = "/var/swap";
	#		priority = 0;
	#		size = 2048;
	#	}
	#];




	# networking.hostName = "nixos"; # Define your hostname.

	# The global useDHCP flag is deprecated, therefore explicitly set to false here.
	# Per-interface useDHCP will be mandatory in the future, so this generated config
	# replicates the default behaviour.
	networking.useDHCP = false;
	networking.interfaces.enp5s0.useDHCP = true;

	# Configure network proxy if necessary
	# networking.proxy.default = "http://user:password@proxy:port/";
	# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

	# Select internationalisation properties.
	console.keyMap = "us";
	console.font   = "Lat2-Terminus16";
	i18n.defaultLocale = "en_US.UTF-8";

	# Set your time zone.
	time.timeZone = "Europe/Vienna";
	time.hardwareClockInLocalTime = true;

	# List packages installed in system profile. To search, run:
	# $ nix search wget
	environment.systemPackages = with pkgs; [
		# basic system
		htop wget mc vim tmux gitFull subversion msr-tools lm_sensors parallel zip p7zip
		tmate nix-prefetch-scripts tokei bat exa fd pv mbuffer zstd neofetch ntfs3g
		psmisc linuxPackages.cpupower stress-ng
		# utils
		unstable.kitty # terminal
		unstable.neovim unstable.neovim-qt # editor
		unstable.mupdf
		unstable.zathura
		unstable.llpp
		unstable.qalculate-gtk
		unstable.miller
		unstable.tmate
		unstable.aria
		unstable.persepolis
		kitty neovim neovim-qt youtube-dl nomacs mupdf zathura qpdfview llpp xdotool xclip 
		# productivity
		unstable.obsidian
		# desktop-web
		firefox hexchat thunderbird qbittorrent rtorrent discord teams skypeforlinux 
		# desktop-media
		unstable.mpv 
		unstable.strawberry 

		gimp inkscape calibre
		# chess
		unstable.chessx
		unstable.stockfish
		#others
		unzip figlet transmission

		# desktop-other
		unstable.adwaita-qt unstable.qt5ct libsForQt5.qtstyleplugin-kvantum # dark theme for qt5
		numix-gtk-theme numix-cursor-theme numix-icon-theme materia-theme libreoffice-fresh
		remmina obs-studio 
		xournalpp
		# latex
		texlive.combined.scheme-full
		# python
		python38 
		(python38.withPackages(ps: with ps; [ pynvim virtualenvwrapper pip ]))
		# proton mail & vpn
		openvpn
		networkmanager-openvpn
		networkmanagerapplet
		unstable.protonmail-bridge
		hydroxide # opensource protonmail bridge

		# flash player
		# flashplayer-standalone

		alsaTools
		arandr
		tint2
		conky
		gsimplecal
		obconf
		jgmenu
		zenmonitor

		# vaapi video acceleration
	        libva
	        libva-utils
	        libvdpau-va-gl
	        vaapiVdpau

		# teamviewer
		teamviewer

		# tcl/tk
		tcl
		tk

		#
		nodejs

		# steam
		unstable.steam
		unstable.lutris

		# troubleshoot
		memtest86
	];

	fonts.fonts = with unstable; [
		#unscii
		camingo-code
		cascadia-code
		corefonts
		dina-font
		fira-code
		go-font
		hack-font
		hermit
		ibm-plex
		jetbrains-mono
		liberation_ttf
		libertine
		mplus-outline-fonts
		noto-fonts
		proggyfonts
		roboto
		roboto-mono
		spleen
		sudo-font
		tamsyn
		tamzen
		terminus_font
		ucs-fonts
		ultimate-oldschool-pc-font-pack
		uw-ttyp0
		victor-mono
		vistafonts
	];
	fonts.fontconfig.allowBitmaps = true;

	# theme
	# environment.variables.QT_QPA_PLATFORMTHEME = "qt5ct";
	# environment.variables.QT_QPA_PLATFORMTHEME = "kvantum";

	# Some programs need SUID wrappers, can be configured further or are
	# started in user sessions.
	# programs.mtr.enable = true;
	# programs.gnupg.agent = { enable = true; enableSSHSupport = true; };

	# List services that you want to enable:
	networking.hostName = "jaghut";
	networking.networkmanager.enable = true;

	# Enable the OpenSSH daemon.
	services.openssh.enable = true;
	programs.ssh.askPassword = "lxqt-openssh-askpass";

	# Open ports in the firewall.
	networking.firewall.allowedTCPPorts = [ 8888 ];
	# networking.firewall.allowedUDPPorts = [ ... ];
	# Or disable the firewall altogether.
	# networking.firewall.enable = false;

	# Enable CUPS to print documents.
	# services.printing.enable = true;

	# Enable sound.
	sound.enable = true;
	hardware.pulseaudio.enable = true;
	hardware.pulseaudio.support32Bit = true; #steam
	hardware.pulseaudio.extraConfig = "unload-module module-suspend-on-idle"; 

	# Enable the X11 windowing system.
	services.xserver.enable = true;
	services.xserver.layout = "us";
	services.xserver = { 
		videoDrivers = [ "amdgpu" ]; 
		deviceSection = ''
			Option "TearFree" "true"
		''; 
	};
	#services.xserver.xkbOptions = "eurosign:e";
	#

	# hardware options
	hardware.opengl = { 
		enable = true;
		driSupport = true;
		driSupport32Bit = true; #steam
		extraPackages32 = with pkgs.pkgsi686Linux; [ libva ]; #steam
		#extraPackages = with pkgs; [
		#	rocm-opencl-icd
		#	amdvlk
		#];
	};
	hardware.cpu.amd.updateMicrocode = true;
	hardware.enableRedistributableFirmware = true;

	# docker virtualisation
	# virtualisation.docker.enable = true;


	# Enable touchpad support.
	# services.xserver.libinput.enable = true;

	# Enable the KDE Desktop Environment.
	#services.xserver.desktopManager.plasma5.enable = true;
	services.xserver.wacom.enable = true;
	services.xserver.dpi = 109;

	#services.xserver.desktopManager.lxqt.enable = true;
	# Enable the gnome-keyring service as many applications (even outside gnome) depend on it
	services.gnome3.gnome-keyring.enable = true;

	# Enable the Gnome3 Desktop Environment
	# services.xserver.displayManager.gdm.enable = true;
	# services.xserver.displayManager.gdm.wayland = false;
	# services.xserver.desktopManager.gnome3.enable = true;
	services.xserver = {
		displayManager = {
			sddm.enable = true;
			sddm.theme = "elarun";
			defaultSession = "xfce+openbox";
			sessionCommands = "${pkgs.xorg.xmodmap}/bin/xmodmap ${myCustomLayout}";
		};
		desktopManager = {
			xterm.enable = false;
			lxqt.enable = true;
			#xfce = {
			#	enable = true;
			#	noDesktop = true;
			#	enableXfwm = false;
			#};
		};
		windowManager.openbox = {
			enable = true;
		};
	};
	# Team viewer
	services.teamviewer.enable = true;	

	# VirtualBox virtualisation
	# virtualisation.virtualbox.host.enable = true;
	# virtualisation.virtualbox.host.enableExtensionPack = true;
	
	# Define a user account. Don't forget to set a password with ‘passwd’.
	users.users.bogdb = {
		isNormalUser = true;
		extraGroups = [ "wheel" "audio" "video" "networkmanager" ]; # Enable ‘sudo’ for the user.
	};

	# This value determines the NixOS release with which your system is to be
	# compatible, in order to avoid breaking some software such as database
	# servers. You should change this only after NixOS release notes say you
	# should.
	system.stateVersion = "20.03"; # Did you read the comment?
}

looks like lxqt doesn’t play well with some of the other modules. specifically around creating a session.

Thanks a lot. I’ve tried poking around and following the stack trace but I couldn’t fix it. Any general advice towards debugging this issue?

EDIT: maybe this commit is related?

EDIT2: a comment in this issue describes a similar infinite recursion problem: gnome3 logout button doesn't show · Issue #100108 · NixOS/nixpkgs · GitHub

You will need revert the commit/apply the patch mentioned in the issue.

I ended up cloning nixpkgs and switching to release-20.09, now everything more or less works except themes in lxqt. will have another go at it tomorrow, thanks.

EDIT (again)
Apparently building lxqt against qt-5.15 fixes the theming problems I had.

$ git diff
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index cc5a3e2a2d6..a428244ffb7 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -25581,8 +25581,8 @@ in
   lumina = recurseIntoAttrs (callPackage ../desktops/lumina { });
 
   lxqt = recurseIntoAttrs (import ../desktops/lxqt {
-    qt5 = qt514;
-    libsForQt5 = libsForQt514;
+    qt5 = qt515;
+    libsForQt5 = libsForQt515;
     inherit pkgs;
     inherit (lib) makeScope;
   });

20.09 largely uses qt5.12 as a base, I’m sure if you use a previous version of lxqt, which was built against 5.12, it would work great

However, if you’re fine with qt5.15 as part of your system’s closure, then using 5.15 should work as well.

The problem is qt5.12 doesn’t work great due to adwaita-qt: dark theme for Qt applications doesn’t work on NixOS 20.09 · Issue #98009 · NixOS/nixpkgs · GitHub. I am one of those people who can’t live without a dark theme. qt5.15 is not without it’s problems either (themes work at least, but lxqt-config-appearance “forgets” the settings - probably missing the right .conf file in the right location0.