Nix command doesn't work after `flake update` and switch+restart, "version `GLIBC_2.43' not found"

Today after running nix flake update (on nixos-26.05) on a previously working system, my nix command no longer works, saying:

/run/current-system/sw/bin/nix: /nix/store/fsd4vbp9zjd9iaicq2fb9lpc1h5j973y-glibc-2.42-100/lib/libc.so.6: version `GLIBC_2.43' not found (required by /nix/store/p9i1b7jgfj4fl5bx557jnwbdsafl434i-curl-8.22.0/lib/libcurl.so.4)

I tried to flake update a week or two ago as well and it did the same thing. I tried to attach my lock files but the extensions aren’t allowed so they are hidden here:

old flake.lock
{
  "nodes": {
    "flake-compat": {
      "locked": {
        "lastModified": 1767039857,
        "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
        "owner": "edolstra",
        "repo": "flake-compat",
        "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
        "type": "github"
      },
      "original": {
        "owner": "edolstra",
        "repo": "flake-compat",
        "type": "github"
      }
    },
    "nix-alien": {
      "inputs": {
        "flake-compat": "flake-compat",
        "nix-index-database": "nix-index-database",
        "nixpkgs": "nixpkgs"
      },
      "locked": {
        "lastModified": 1784118096,
        "narHash": "sha256-iW7BzSkv27lII5FvrB6kPRO0CzOZj8utOIpvcFWjHgw=",
        "owner": "thiagokokada",
        "repo": "nix-alien",
        "rev": "df422df4324674417f91dee49bae401eef87c6ed",
        "type": "github"
      },
      "original": {
        "owner": "thiagokokada",
        "repo": "nix-alien",
        "type": "github"
      }
    },
    "nix-index-database": {
      "inputs": {
        "nixpkgs": [
          "nix-alien",
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1783864904,
        "narHash": "sha256-BQxN5UMg9FOevAsgBRwPxfxlh51Puj+dNn/8Dsi3sPM=",
        "owner": "nix-community",
        "repo": "nix-index-database",
        "rev": "1111b9bc836afb7e31a7014e8d1272de9b1c917d",
        "type": "github"
      },
      "original": {
        "owner": "nix-community",
        "repo": "nix-index-database",
        "type": "github"
      }
    },
    "nixos-hardware": {
      "inputs": {
        "nixpkgs": "nixpkgs_2"
      },
      "locked": {
        "lastModified": 1786717298,
        "narHash": "sha256-asdPlqtM0AweQ5YNLad6eY4tSYW55YNr1uyayf7mOMQ=",
        "owner": "NixOS",
        "repo": "nixos-hardware",
        "rev": "2dda192987ab6815e44df0130f03d6c907b79134",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "master",
        "repo": "nixos-hardware",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1784007870,
        "narHash": "sha256-djcLt/JJphyNt4eDY9XTly+/WbCK5lqWq9lSgCmJkkQ=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "18b9261cb3294b6d2a06d03f96872827b8fe2698",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixos-unstable",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "nixpkgs-local": {
      "locked": {
        "lastModified": 1777179155,
        "narHash": "sha256-AzZkIUUNB+XPjhmR0a/fTVOBP3MTOYhW7XXKo5NSCEM=",
        "ref": "refs/heads/master",
        "rev": "62833e6d841e0f7d3279b9aa57d97f786520f2e5",
        "revCount": 986562,
        "type": "git",
        "url": "file:///home/helpimnotdrowning/git/nixpkgs"
      },
      "original": {
        "type": "git",
        "url": "file:///home/helpimnotdrowning/git/nixpkgs"
      }
    },
    "nixpkgs-unstable": {
      "locked": {
        "lastModified": 1786599213,
        "narHash": "sha256-yNJd40f11EzXBjSByCB7IPpeFFAdeoSKKM67dGkfFoU=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "0e251e24a4f24e036a084b6b4b2d2491af4167f4",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixos-unstable",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "nixpkgs_2": {
      "locked": {
        "lastModified": 1767892417,
        "narHash": "sha256-8bW3q88CEg2u4hSP66Vf4lpbLonHz7hqDNBMcCY7E9U=",
        "rev": "3497aa5c9457a9d88d71fa93a4a8368816fbeeba",
        "type": "tarball",
        "url": "https://releases.nixos.org/nixos/unstable/nixos-26.05pre924538.3497aa5c9457/nixexprs.tar.xz"
      },
      "original": {
        "type": "tarball",
        "url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
      }
    },
    "nixpkgs_3": {
      "locked": {
        "lastModified": 1786711500,
        "narHash": "sha256-QvnceIGTBeDvDd9oCn+GvdsnkquliuwbVgpiRH68qaQ=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "02e08985a27c65ffd33d434eeb2e660a2e4dc84d",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixos-26.05",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "nix-alien": "nix-alien",
        "nixos-hardware": "nixos-hardware",
        "nixpkgs": "nixpkgs_3",
        "nixpkgs-local": "nixpkgs-local",
        "nixpkgs-unstable": "nixpkgs-unstable"
      }
    }
  },
  "root": "root",
  "version": 7
}
new flake.lock
{
  "nodes": {
    "flake-compat": {
      "locked": {
        "lastModified": 1767039857,
        "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
        "owner": "edolstra",
        "repo": "flake-compat",
        "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
        "type": "github"
      },
      "original": {
        "owner": "edolstra",
        "repo": "flake-compat",
        "type": "github"
      }
    },
    "nix-alien": {
      "inputs": {
        "flake-compat": "flake-compat",
        "nix-index-database": "nix-index-database",
        "nixpkgs": "nixpkgs"
      },
      "locked": {
        "lastModified": 1792056812,
        "narHash": "sha256-3FHVsncGsfcxozcQgHULGkQ6TqXOlguxX6YlBQhQrT8=",
        "owner": "thiagokokada",
        "repo": "nix-alien",
        "rev": "07c41bfdc3b986b7e65e19380b28916e10112c0f",
        "type": "github"
      },
      "original": {
        "owner": "thiagokokada",
        "repo": "nix-alien",
        "type": "github"
      }
    },
    "nix-index-database": {
      "inputs": {
        "nixpkgs": [
          "nix-alien",
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1791711434,
        "narHash": "sha256-LpIhxnuO0tYeZ4k7BbNMxsPs2zJpB4hWXO1jdhUuE7Q=",
        "owner": "nix-community",
        "repo": "nix-index-database",
        "rev": "9a2dd40780eeab8543aa97c59c26f11267025616",
        "type": "github"
      },
      "original": {
        "owner": "nix-community",
        "repo": "nix-index-database",
        "type": "github"
      }
    },
    "nixos-hardware": {
      "inputs": {
        "nixpkgs": "nixpkgs_2"
      },
      "locked": {
        "lastModified": 1793054847,
        "narHash": "sha256-mhud3nRH8RoP0h9MydfkJ8mISpj+QE/S//wOt9bNgC0=",
        "owner": "NixOS",
        "repo": "nixos-hardware",
        "rev": "8ba09466dc929acf5c8bb3e0cc40f472a7df3630",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "master",
        "repo": "nixos-hardware",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1791956154,
        "narHash": "sha256-jBYGPi4udQ9uo4KQp9m2J0546nJVQitG15gvZSaVVAs=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "55bfb4d7437bd4e09ab7cba58a43bd68eb310044",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixos-unstable",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "nixpkgs-local": {
      "locked": {
        "lastModified": 1777179155,
        "narHash": "sha256-AzZkIUUNB+XPjhmR0a/fTVOBP3MTOYhW7XXKo5NSCEM=",
        "ref": "refs/heads/master",
        "rev": "62833e6d841e0f7d3279b9aa57d97f786520f2e5",
        "revCount": 986562,
        "type": "git",
        "url": "file:///home/helpimnotdrowning/git/nixpkgs"
      },
      "original": {
        "type": "git",
        "url": "file:///home/helpimnotdrowning/git/nixpkgs"
      }
    },
    "nixpkgs-unstable": {
      "locked": {
        "lastModified": 1792773339,
        "narHash": "sha256-rZLrzrC6i+jnTAlvPZHogKDulY7WWDEv9hJeHieO7Zw=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "3ec636362e1816bc2f0888fa0fa2c69f1bc9e504",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixos-unstable",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "nixpkgs_2": {
      "locked": {
        "lastModified": 1789546076,
        "narHash": "sha256-vWkSk5bbfTqdtMoSgD9FshACO8JCvXTFi+3cqEp0mH0=",
        "rev": "b1b875982b17dabde9b4a37f3e229e74913e6db3",
        "type": "tarball",
        "url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1074753.b1b875982b17/nixexprs.tar.xz"
      },
      "original": {
        "type": "tarball",
        "url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
      }
    },
    "nixpkgs_3": {
      "locked": {
        "lastModified": 1793015021,
        "narHash": "sha256-Ee5BWo8sh3pGt70QUdRajnaginqFmWvrtdBc4gJzhks=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "718f670e845328e9c2cecdd832835712b2cbd065",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixos-26.05",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "nix-alien": "nix-alien",
        "nixos-hardware": "nixos-hardware",
        "nixpkgs": "nixpkgs_3",
        "nixpkgs-local": "nixpkgs-local",
        "nixpkgs-unstable": "nixpkgs-unstable"
      }
    }
  },
  "root": "root",
  "version": 7
}

Essentially, pkgs was locked to 02e08985a27c65ffd33d434eeb2e660a2e4dc84d , and is now 718f670e845328e9c2cecdd832835712b2cbd065 (which is where I believe my nix command comes from).

I have no idea how to fix this, please let me know if you need any more information.

That sounds quite severe. Since it’s NixOS, you should be able to boot into an older generation.

Did you search Nix or Nixpkgs issues for whether anyone else reported this?

Perhaps a nix store repair invocation?

I checked when it first happened and just now, and it doesn’t seem like anyone else has this issue.

I am able to go to previous generations, but doing so corrupts my Firefox profile (from 153 to 158 and back) so its not preferred. I am not sure how to use nix store repair; running just that in /etc/nixos says error: flake 'git+file:///etc/nixos' does not provide attribute 'packages.x86_64-linux.default' or 'defaultPackage.x86_64-linux'. nix store verify --all (found through a search) does not complain either…

Hrm… can you try a more recent nix version?

You mention that you are on NixOS 26.05, but the libcurl output in your log is from NixOS unstable while the glibc output is from NixOS 26.05.

Your flake.lock has nixpkgs, nixpkgs-local, nixpkgs-unstable, nixpkgs_2 and nixpkgs_3. This is atypical.

Somehow, you are mixing up outputs from different nixpkgs sets, which is ill-advised.

You should share your configuration.nix.

Also, how are you updating?

nix flake update just updates your flake.lock file, it does not rebuild or activate your system.

Also, how are you updating?

Sorry, I did a nix flake update, then immediately nixos-rebuild switch. This is how I always do my updates (not always a flake update, usually just configuration.nix/flake.nix changes).

configuration.nix
# 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’).

{
	config,
	pkgs,
	pkgs-nix-alien,
	 ...
}: {
	imports =[
		./hardware-configuration.nix
	];

	nix.settings.experimental-features = [ "nix-command" "flakes" "pipe-operators" ];

	hardware.opentabletdriver = {
		enable = true;
		package = pkgs.unstable.opentabletdriver;
	};
	hardware.uinput.enable = true;
	hardware.graphics.enable32Bit = true;
	hardware.enableAllFirmware = true;
	hardware.bluetooth.enable = true;
	hardware.bluetooth.package = pkgs.bluez; # pkgs.bluezFull;

	boot.loader.systemd-boot.enable = false;
	boot.loader.efi = {
		efiSysMountPoint = "/boot";
		canTouchEfiVariables = true;	
	};
	boot.loader.grub = {
		enable = true;
		backgroundColor = "#61c792";
		device = "nodev";
		useOSProber = true;
		efiSupport = true;
		memtest86.enable = true;
		font = "${pkgs.berkeley-mono}/share/fonts/truetype/BerkeleyMono-Regular.ttf";
		fontSize = 18;
		splashImage = ./grub_background.png; # FIXME
	};
	
	# pkgs.linuxPackages_latest breaks virtualbox, https://github.com/VirtualBox/virtualbox/issues/467
	# boot.kernelPackages = pkgs.linuxPackages_7_1;
	boot.kernelModules = [ "uinput" ];

	swapDevices = [{
		device = "/swap";
		size = 12 * 1024;
	}];

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

	# Configure network proxy if necessary
	# networking.proxy.default = "http://192.168.49.1:8000/";
	# networking.proxy.noPrsoxy = "127.0.0.1,localhost,internal.domain";

	networking.networkmanager.enable = true;

	time.timeZone = "America/Chicago";

	# Select internationalisation properties.
	i18n.defaultLocale = "en_US.UTF-8";
	i18n.extraLocaleSettings = {
		LC_ADDRESS = "en_US.UTF-8";
		LC_IDENTIFICATION = "en_US.UTF-8";
		LC_MEASUREMENT = "en_US.UTF-8";
		LC_MONETARY = "en_US.UTF-8";
		LC_NAME = "en_US.UTF-8";
		LC_NUMERIC = "en_US.UTF-8";
		LC_PAPER = "en_US.UTF-8";
		LC_TELEPHONE = "en_US.UTF-8";
		LC_TIME = "en_US.UTF-8";
	};
	
	i18n.inputMethod = {
		enable = true;
		type = "fcitx5";
		fcitx5.addons = with pkgs; [
			fcitx5-mozc-ut
			fcitx5-gtk
		];
	};

	# nixpkgs.config.allowUnfree = true;

	# Enable the X11 windowing system.
	# You can disable this if you're only using the Wayland session.
	# services.xserver.enable = true;

	# Enable the KDE Plasma Desktop Environment.
	services.displayManager.sddm.enable = true;
	services.desktopManager.plasma6.enable = true;

	services.power-profiles-daemon.enable = true;
	services.fprintd.enable = true;
	services.fwupd.enable = true;
	services.fwupd.extraRemotes = [ "lvfs-testing" ];

	# Configure keymap in X11
	services.xserver.xkb = {
		layout = "us";
		variant = "";
	};

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

	# Enable sound with pipewire.
	services.pulseaudio.enable = false;
	security.rtkit.enable = true;
	services.pipewire = {
		enable = true;
		alsa.enable = true;
		alsa.support32Bit = true;
		pulse.enable = true;
		jack.enable = true;
	};

	fonts = {
		packages = with pkgs; [
			berkeley-mono
			ibm-plex
			twemoji-color-font
		 ];

		 fontconfig = {
			defaultFonts = {
				serif = [ "IBM Plex Serif" "Noto Serif" "IBM Plex Sans JP" "Twitter Color Emoji" ];
				sansSerif = [ "IBM Plex Sans JP" "Twitter Color Emoji" "Noto Sans" ];
				monospace = [ "Berkeley Mono" "IBM Plex Mono" "Twitter Color Emoji" ];
			};
		};
	};

	# Define a user account. Don't forget to set a password with ‘passwd’.
	users.users.helpimnotdrowning = {
		isNormalUser = true;
		initialPassword = "password";
		description = "helpimnotdrowning";
		extraGroups = [ "networkmanager" "wheel" ];
		shell = pkgs.unstable.powershell;
		packages = with pkgs; [
		  # ...
		];
	};

	programs.nix-ld.enable = true;
	programs.firefox = {
		enable = true;
		# autoConfig = 

		policies = {
			# AIControls = {
			# 	Default = {
			# 		Value = false;
			# 	};
			# 	Translations = {
			# 		Value = true;
			# 	};
			# };
			AutofillAddressEnabled = false;
			AutofillCreditCardEnabled = false;
			GenerativeAI = {
				Enabled = false;
			};
 			OfferToSaveLogins = false;
			PasswordManagerEnabled = false;
		};
		preferences = {
			"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
			"browser.compactmode.show" = true;
			"browser.urlbar.scotchBonnet.enableOverride" = false;
			"browser.nova.enabled" = false;
			"browser.newtabpage.activity-stream.nova.enabled" = false;
			"pdfjs.enableNova" = false;
		};
	};
	
	environment.systemPackages = (with pkgs; [
		micro-full
		gitFull
		gcc14
		gcc_multi
		cmake
		dotnet-sdk_10
		gparted
		btop
		prismlauncher
		krita
		thunderbird
		gdb
		smplayer
		mpv
		libreoffice
		obs-studio
		kdePackages.kdeconnect-kde
		kdePackages.kate
		ffmpeg_8-full
		qbittorrent
		steam
		vesktop
		vscode
		zed-editor
		file
		git-credential-oauth
		tshark
		gnumake
		wireshark-cli
		wireshark
		gimp2
		oh-my-posh
		kmscon
		usbutils
		pciutils
		tailwindcss_4
		rustdesk-flutter
		nodejs_22
		
		javaPackages.compiler.temurin-bin.jdk-21

		jetbrains.rider
			watchman
		jetbrains.idea
		jetbrains.clion
		jetbrains.pycharm
		
		unstable.powershell-editor-services

		unstable.powershell
	]) ++ [
		pkgs-nix-alien.nix-alien
	];

	environment.sessionVariables = {
		MICRO_TRUECOLOR = "1";
		COLORTERM = "truecolor";
		EDITOR = "micro";
		PAGER = "less";
		LESS = "-R --mouse";
	};

	environment.shells = with pkgs; [
		unstable.powershell
	];

	# environment.etc."net.helpimnotdrowning" {
	# 	
	# }
	
	# 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;
	# };

	programs.appimage.enable = true;
	programs.appimage.binfmt = true;

	# virtualisation.virtualbox.host = {
	# 	enable = true;
	# 	package = pkgs.unstable.virtualbox;
	# };

	virtualisation.docker = {
		enable = true;
		rootless = {
			enable = true;
			setSocketVariable = true;
		};
	};

	# List services that you want to enable:

	# Enable the OpenSSH daemon.
	services.openssh = {
		enable = true;
		settings = {
			PasswordAuthentication = false;
			KbdInteractiveAuthentication = false;
			PermitRootLogin = "no";
			X11Forwarding = true;
		};
	};

	services.tailscale = {
		enable = true;
		useRoutingFeatures = "client";
	};

	services.kmscon = {
		enable = true;
		hwRender = true;
		extraConfig = ''
			font-name=Berkeley Mono
			font-size=22
		'';
	};

	services.flatpak = {
		enable = true;
	};

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

	# This value determines the NixOS release from which the default
	# settings for stateful data, like file locations and database versions
	# on your system were taken. It‘s perfectly fine and recommended to leave
	# this value at the release version of the first install of this system.
	# Before changing this value read the documentation for this option
	# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
	system.stateVersion = "25.05"; # Did you read the comment?
}
flake.nix
{
	description = "helpimnotdrowning's NixOS config";
	inputs = {
		nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
		nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
		nixpkgs-local.url = "git+file:///home/helpimnotdrowning/git/nixpkgs";
		nixos-hardware.url = "github:NixOS/nixos-hardware/master";
		nix-alien.url = "github:thiagokokada/nix-alien";
	};

	outputs = {
		self,
		nixpkgs,
		nixpkgs-unstable,
		nixpkgs-local,
		nixos-hardware,
		nix-alien,
		...
	} @inputs : let
			system = "x86_64-linux";
			lib = nixpkgs.lib;
			pkgs-nix-alien = nix-alien.packages.${system};
			extraOverlays = import ./overlays.nix;
			
			pkgs = (import nixpkgs {
				inherit system;
				overlays = extraOverlays;
				config.allowUnfree = true;
			});
			pkgsUnstable = (import nixpkgs-unstable {
				inherit system;
				overlays = extraOverlays;
				config.allowUnfree = true;
			});
			pkgsLocal = (import nixpkgs-local {
				inherit system;
				overlays = extraOverlays;
				config.allowUnfree = true;
			});
		in {
			nixosConfigurations.NIXYEVA = lib.nixosSystem {
				inherit system;
				modules = [
					{
						nixpkgs.pkgs = pkgs;
					 	nixpkgs.overlays = [ (final: prev: {
							unstable = pkgsUnstable;
							local = pkgsLocal;
						}) ];
					}
					nixos-hardware.nixosModules.framework-13-7040-amd
					./configuration.nix
				];
				specialArgs = {
					inherit inputs;
					inherit pkgs-nix-alien;
					inherit pkgsUnstable;
					inherit pkgsLocal;
				};
			};
		};
}

My pkgs is configured this way so I can write things like pkgs.unstable.X or pkgs.local.X. Looking into it I only do this a few times with opentabletdriver and powershell-editor-services (pkgs.unstable.powershell gets overlayed, it is not actually unstable’s PowerShell; this is so I can update faster than nixpkgs and modify $PROFILE.AllUsersAllHosts since the file is locked away in the nix store)

This is all bodged together from the last few months of using NixOS, maybe the way I do certain things is breaking it?

I rolled back to a previous generation and added pkgs.unstable.nixVersions.git, which, after switching and restarting, gives me a working nix again! unfortunately, now git pull breaks with a similar error:

/nix/store/3k4fbj6ywjlpqckbbipcl7mfi823srxf-git-with-svn-2.54.0/libexec/git-core/git-remote-https: /nix/store/fsd4vbp9zjd9iaicq2fb9lpc1h5j973y-glibc-2.42-100/lib/libc.so.6: version `GLIBC_2.43' not found (required by /nix/store/p9i1b7jgfj4fl5bx557jnwbdsafl434i-curl-8.22.0/lib/libcurl.so.4)

edit: QEMU also fails to launch for the exact same reason; I found this by trying to nixos-rebuild build-vm and trying to start the VM.

… this seems to be the fault of pkgs.unstable.powershell. This is the relevant part of my overlay.nix:

[
	# powershellOverlay
	(final: prev:
		let		
			__pwsh_profile = final.writeText "FIRST" ''
				# this file is managed by Nix
				# see the below file vv to make edits
				. /etc/net.helpimnotdrowning/pwsh/profile.ps1
			'';
			__pwsh_version = "7.6.7";
		in {
			powershell = prev.powershell.overrideAttrs(old: rec {
				version = __pwsh_version;
				passthru.shellPath = old.passthru.shellPath;
				passthru.sources.x86_64-linux = prev.fetchurl {
					url = "https://github.com/PowerShell/PowerShell/releases/download/v${__pwsh_version}/powershell-${__pwsh_version}-linux-x64.tar.gz";
					hash = "sha256-aJb546awo1S/Rwg1qW2nbS+AHNUNzwR618RWO/k79DE=";
				};

				src = passthru.sources.x86_64-linux;

				postInstall = (old.postInstall or "") + ''
					install -Dm444 ${__pwsh_profile} $out/share/powershell/profile.ps1
				'';
			});
	})
]

Using pkgs.powershell instead of pkgs.unstable.powershell (they are both overlayed) in my configuration.nix makes all of the issues go away. The PowerShell definition does take curl as an input (which would have been unstable’s curl), but wouldn’t nix/git/qemu/etc all use their appropriate curls instead of taking PowerShell’s ? Do I misunderstand how this is supposed to work?

Just wondering when we have the ability to load your configuration and use nix eval and nix repl wouldn’t be easier to just share the repo if its public. Would make helping you 100 times easier. As there are so many factors that go into building a flake based config. Just my 2 pence :smiley:

The Powershell package wraps pwsh with LD_LIBRARY_PATH, this causes libc version mixing errors when using programs that load libcurl from Powershell.

It looks like 26.05 is using glibc 2.42 while unstable is using glibc 2.43.

Unfortunately, all I can recommend here is not using PowerShell, or trying out this LLM-written hack (by openai-codex/gpt-6-luna in omp):

hack

Overlay pkgs.unstable with this:

(final: prev: {
  powershell = prev.powershell.overrideAttrs (finalAttrs: previousAttrs: {
    appendRunpaths =
      (previousAttrs.appendRunpaths or [ ])
      ++ prev.lib.optionals prev.stdenv.hostPlatform.isLinux [
        (prev.lib.makeLibraryPath finalAttrs.buildInputs)
      ];

    installPhase =
      ''
        runHook preInstall

        mkdir -p $out/{bin,share/powershell}
        cp -R * $out/share/powershell
        chmod +x $out/share/powershell/pwsh
        wrapProgram $out/share/powershell/pwsh \
          ${prev.lib.optionalString prev.stdenv.hostPlatform.isDarwin "--prefix DYLD_FALLBACK_LIBRARY_PATH : \"${prev.lib.makeLibraryPath finalAttrs.buildInputs}\""} \
          --set POWERSHELL_TELEMETRY_OPTOUT 1 \
          --set DOTNET_CLI_TELEMETRY_OPTOUT 1
        cp $out/share/powershell/pwsh $out/bin/pwsh
      ''
      + prev.lib.optionalString prev.stdenv.hostPlatform.isLinux ''
        patchelf --replace-needed \
          liblttng-ust${prev.stdenv.hostPlatform.extensions.sharedLibrary}.0 \
          liblttng-ust${prev.stdenv.hostPlatform.extensions.sharedLibrary}.1 \
          $out/share/powershell/libcoreclrtraceptprovider.so
      ''
      + ''
        runHook postInstall
      '';
  });
})

If you try this hack and it works (even with Powershell things that use libcurl under the hood) I’ll go PR it to nixpkgs.

{ config, pkgs, … }:
let
omniflake = builtins.getFlake “github:fzakaria/omniflake”;
in
{
imports =
omniflake.flakes.disko.nixosModules.disko
];
nixpkgs.overlays = [ omniflake.flakes.rust-overlay.overlays.default ];

environment.systemPackages = with pkgs; [
omniflake.flakes.nh.packages.${pkgs.system}.default
#if you want only one program
(builtins.getFlake “github:nix-community/nixgl”).packages.${pkgs.system}.default
];

I have configuration.nix only and rebuild switch is applaying updates from flakes

So basically powershell is mispackaged. Setting LD_LIBRARY_PATH in a wrapper is a no-no for exactly this reason.

Not that I mean to suggest this was necessarily negligent on the part of the packager. In some cases doing it properly can be prohibitively difficult. I have no idea if this is one of those cases.

However, at worst, a comparatively small patch to such a program should theoretically always be a viable option if it’s open source. You need to reverse whatever environment changes the wrapper made before the program calls external programs. In the case of powershell, that would be before calling commands typed by the user.

Variants of this problem with python module paths and the like are unfortunately still rampant in nixpkgs. We need a formula for how to solve it…

The LD_LIBRARY_PATH point is the key one here: wrapping pwsh that way leaks the build inputs’ glibc into everything PowerShell spawns, including anything that dlopens libcurl, so the 2.42 versus 2.43 mismatch is basically inevitable after a channel bump. Unsetting or restoring the variable before user commands run sounds like the right shape of fix, though I’d want to know whether pwsh already provides a hook for that or whether it needs a patch to the startup path. Also worth checking whether the wrapper really needs the full buildInputs library path, or only a couple of entries like the lttng lib.