From 5d470b88351c1970b12849c251c899460415f656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Xaver=20H=C3=B6rl?= Date: Mon, 11 Nov 2024 21:36:45 +0100 Subject: [PATCH 1/2] nixos-install: clear executable cache after entering chroot Clear the cache for executable locations after entering the chroot. The cached locations are no longer valid there. This resolves problems with nixos-install failing to find binaries from coreutils as witnessed in https://github.com/NixOS/nixpkgs/issues/241356. --- pkgs/by-name/ni/nixos-install/nixos-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/by-name/ni/nixos-install/nixos-install.sh b/pkgs/by-name/ni/nixos-install/nixos-install.sh index b428406f95a2f..2a592223a921e 100755 --- a/pkgs/by-name/ni/nixos-install/nixos-install.sh +++ b/pkgs/by-name/ni/nixos-install/nixos-install.sh @@ -246,6 +246,8 @@ if [[ -z $noBootLoader ]]; then export mountPoint NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root "$mountPoint" -c "$(cat <<'EOF' set -e + # Clear the cache for executable locations. They were invalidated by the chroot. + hash -r # Create a bind mount for each of the mount points inside the target file # system. This preserves the validity of their absolute paths after changing # the root with `nixos-enter`. From b0dfd60e5700b1bd70ef821d5119115b437a33e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 11 Dec 2024 15:47:10 +0100 Subject: [PATCH 2/2] nixos-install: link to installer test --- pkgs/by-name/ni/nixos-install/package.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/by-name/ni/nixos-install/package.nix b/pkgs/by-name/ni/nixos-install/package.nix index fbe75619674ed..7ffc2984ef038 100644 --- a/pkgs/by-name/ni/nixos-install/package.nix +++ b/pkgs/by-name/ni/nixos-install/package.nix @@ -7,6 +7,7 @@ jq, nixos-enter, util-linuxMinimal, + nixosTests, }: substituteAll { name = "nixos-install"; @@ -29,6 +30,8 @@ substituteAll { installManPage ${./nixos-install.8} ''; + passthru.tests.installer-simpleUefiSystemdBoot = nixosTests.installer.simpleUefiSystemdBoot; + meta = { description = "Install bootloader and NixOS"; homepage = "https://github.com/NixOS/nixpkgs/tree/master/pkgs/by-name/ni/nixos-install";