Update removal for newer nix profile output

This commit is contained in:
anmiller 2024-09-30 16:58:09 +00:00
parent c460081637
commit ed643a06f9

View File

@ -112,7 +112,9 @@ install_nix_packages()
# The name of the package we are going to install, needed to check for presence/uninstall # The name of the package we are going to install, needed to check for presence/uninstall
package_name=packages.x86_64-linux.myPackageCollection package_name=packages.x86_64-linux.myPackageCollection
if [ "${nix_packages[*]}" ]; then if [ "${nix_packages[*]}" ]; then
if nix profile list | cut -d' ' -f 2 | grep -q "${package_name}"; then # Updated to process new nix profile format, proper processing probably needs JQ
# But JQ would be another dependency and this is good enough for now
if nix profile list --json | grep -i "\"attrPath\":\"${package_name}\""; then
echo "Removing previous version of profile" echo "Removing previous version of profile"
nix profile remove "${package_name}" nix profile remove "${package_name}"
fi fi