diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/nix-channel.in | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/nix-channel.in b/scripts/nix-channel.in index 8e07821c43c7..b8c93df18c32 100755 --- a/scripts/nix-channel.in +++ b/scripts/nix-channel.in @@ -199,6 +199,20 @@ while (scalar @ARGV) { last; } + elsif ($arg eq "--rollback") { + die "$0: ‘--rollback’ has at most one argument\n" if scalar @ARGV > 1; + my $generation = shift @ARGV; + my @args = ("$Nix::Config::binDir/nix-env", "--profile", $profile); + if (defined $generation) { + die "invalid channel generation number ‘$generation’" unless $generation =~ /^[0-9]+$/; + push @args, "--switch-generation", $generation; + } else { + push @args, "--rollback"; + } + system(@args) == 0 or exit 1; + last; + } + elsif ($arg eq "--help") { exec "man nix-channel" or die; } |