commit ab29a98dd31b1654810bf719c4c8998ca8b63e9b parent 2a406dd6bcc57b4fe5b248fc5169b7f1c3392ea3 Author: Jan Pobříslo <ccx@te2000.cz> Date: Thu, 23 Jun 2022 02:39:32 +0200 Also resolve symlinks for manifest.nix itself Diffstat:
M | zsh-functions/confz_containers_init | | | 20 | +++++++++++++++++--- |
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/zsh-functions/confz_containers_init b/zsh-functions/confz_containers_init @@ -1058,11 +1058,25 @@ confz_container_nix_packages_installed_check() { fi zstat -L -H stat_info $profile_dir done + [[ -d $profile_dir ]] || \ + die "Could not find profile directory: ${(qqq)profile_dir}" + + local manifest_file=$profile_dir/manifest.nix + zstat -L -H stat_info $manifest_file + # while it's a symlink + while (( $stat_info[mode] >> 12 == 10 )); do + if [[ $stat_info[link] == /* ]]; then + manifest_file=$root$stat_info[link] + else + manifest_file=${manifest_file:h}/$stat_info[link] + fi + zstat -L -H stat_info $manifest_file + done + [[ -f $profile_dir/manifest.nix ]] || \ - die "Could not find manifest.nix inside ${(qqq)profile_dir}" + die "Could not find manifest.nix file: ${(qqq)manifest_file}" local -a world=( "${(@f)$( - grep -o 'outPath = "[^"]*"' \ - $profile_dir/manifest.nix \ + grep -o 'outPath = "[^"]*"' $manifest_file \ | uniq | sed 's|^outPath = "/nix/store/[^-]*-||;s|"$||' )}" ) local -a missing