1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-02 21:51:50 +02:00

nix-channel: Add --rollback flag

Fixes #368.
This commit is contained in:
Eelco Dolstra 2014-10-14 12:07:56 +02:00
parent c6849e2dee
commit 2c1711ae33
2 changed files with 68 additions and 1 deletions

View file

@ -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;
}