Add 'nix upgrade-nix' command
This command upgrades Nix to the latest stable version by installing a store path obtained from https://github.com/NixOS/nixpkgs/raw/master/nixos/modules/installer/tools/nix-fallback-paths.nix which is the same store path that the installer at https://nixos.org/nix/install.sh uses. The upgrade fails if Nix is not installed in a profile (e.g. on NixOS, or when installed outside of the Nix store).
This commit is contained in:
parent
8af911be5c
commit
6fa690291a
4 changed files with 142 additions and 1 deletions
|
|
@ -16,6 +16,8 @@ void chrootHelper(int argc, char * * argv);
|
|||
|
||||
namespace nix {
|
||||
|
||||
std::string programPath;
|
||||
|
||||
struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
|
||||
{
|
||||
NixArgs() : MultiCommand(*RegisterCommand::commands), MixCommonArgs("nix")
|
||||
|
|
@ -78,7 +80,8 @@ void mainWrapped(int argc, char * * argv)
|
|||
initNix();
|
||||
initGC();
|
||||
|
||||
string programName = baseNameOf(argv[0]);
|
||||
programPath = argv[0];
|
||||
string programName = baseNameOf(programPath);
|
||||
|
||||
{
|
||||
auto legacy = (*RegisterLegacyCommand::commands)[programName];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue