From ae7eab49b952895b3aa88192768843bccabe1ea2 Mon Sep 17 00:00:00 2001 From: Qyriad Date: Fri, 12 Jul 2024 16:17:54 -0600 Subject: nix3-upgrade-nix: always use the /new/ nix-env to perform the installation Fixes #411. Change-Id: I8d87c0e9295deea26ff33234e15ee33cc68ab303 --- tests/nixos/nix-upgrade-nix.nix | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/nixos/nix-upgrade-nix.nix b/tests/nixos/nix-upgrade-nix.nix index acccc2e03..01e641d81 100644 --- a/tests/nixos/nix-upgrade-nix.nix +++ b/tests/nixos/nix-upgrade-nix.nix @@ -35,9 +35,8 @@ in { machine.succeed("nix --version >&2") - # Install Lix into the default profile, overriding /run/current-system/sw/bin/nix, - # and thus making Lix think we're not on NixOS. - machine.succeed("nix-env --install '${lib.getBin lix}' --profile /nix/var/nix/profiles/default >&2") + # Use Lix to install CppNix into the default profile, overriding /run/current-system/sw/bin/nix + machine.succeed("nix-env --install '${lib.getBin newNix}' --profile /nix/var/nix/profiles/default") # Make sure that correctly got inserted into our PATH. default_profile_nix_path = machine.succeed("command -v nix") @@ -45,16 +44,15 @@ in { assert default_profile_nix_path.strip() == "/nix/var/nix/profiles/default/bin/nix", \ f"{default_profile_nix_path.strip()=} != /nix/var/nix/profiles/default/bin/nix" - # And that it's the Nix we specified. + # And that it's the Nix we specified default_profile_version = machine.succeed("nix --version") - assert "${lixVersion}" in default_profile_version, f"${lixVersion} not in {default_profile_version}" - - # Upgrade to a different version of Nix, and make sure that also worked. + assert "${newNixVersion}" in default_profile_version, f"${newNixVersion} not in {default_profile_version}" - machine.succeed("nix upgrade-nix --store-path ${newNix} >&2") + # Now upgrade to Lix, and make sure that worked. + machine.succeed("${lib.getExe lix} upgrade-nix --debug --store-path ${lix} 2>&1") default_profile_version = machine.succeed("nix --version") print(default_profile_version) - assert "${newNixVersion}" in default_profile_version, f"${newNixVersion} not in {default_profile_version}" + assert "${lixVersion}" in default_profile_version, f"${lixVersion} not in {default_profile_version}" # Now 'break' this profile -- use nix profile on it so nix-env will no longer work on it. machine.succeed( -- cgit v1.2.3