Closed korrat closed 2 years ago
As a workaround, disabling the Nix step and using a custom command ("Nix" = "/usr/bin/nix-channel --update && /usr/bin/nix-env --upgrade"
) will preserve the intent of the Nix step. Adding an option for whether Nix is part of a profile seems like a more permanent solution, but some logic that determines whether nix is part of a profile and then decides whether nix upgrade-nix
should be used is preferred.
I don't use Nix so I'd be happy if someone can specify what needs to be done in order to determine whether the step should be skipped or not.
Use nix-env to check if nix is installed in a profile. Maybe also use it to check for a newer version of nix, so that we aren't upgrading to the same version? https://www.mankier.com/1/nix-env#Operation_--query
If nix-env --query
does not list something like nix-2.8.0
nix upgrade-nix
should not be run.
$ nix-env -q
nix-2.8.0
nix-bash-completions-0.6.8
nss-cacert-3.77
What did you expect to happen?
After installing Nix and running topgrade, I expected Nix to be upgraded.
What actually happened?
Instead, I got the following error message when running the Nix step.
Additional details
topgrade
.community/nix
.The first command in the above listing is the problem: it only works if the
nix
binary is part of a Nix profile, which it isn't on my system since I installed nix throughpacman
. I don't have much experience with Nix yet, so I'm not sure how it identifies whether a given directory is a profile or not.For my case, allowing to disable the
nix upgrade-nix
command through the configuration would be a viable workaround.