about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/manual/nix-channel.xml15
-rwxr-xr-xscripts/nix-channel.in9
2 files changed, 14 insertions, 10 deletions
diff --git a/doc/manual/nix-channel.xml b/doc/manual/nix-channel.xml
index 22d8900d8f1c..68dcfd45d4d6 100644
--- a/doc/manual/nix-channel.xml
+++ b/doc/manual/nix-channel.xml
@@ -22,7 +22,7 @@
       <arg choice='plain'><option>--add</option> <replaceable>url</replaceable> <arg choice='opt'><replaceable>name</replaceable></arg></arg>
       <arg choice='plain'><option>--remove</option> <replaceable>url</replaceable></arg>
       <arg choice='plain'><option>--list</option></arg>
-      <arg choice='plain'><option>--update</option></arg>
+      <arg choice='plain'><option>--update</option> <arg rep='repeat'><replaceable>names</replaceable></arg></arg>
     </group>
   </cmdsynopsis>
 </refsynopsisdiv>
@@ -67,14 +67,15 @@ condition="manual">See also <xref linkend="sec-channels"
 
   </varlistentry>
 
-  <varlistentry><term><option>--update</option></term>
+  <varlistentry><term><option>--update</option> [<replaceable>names</replaceable>…]</term>
 
     <listitem><para>Downloads the Nix expressions of all subscribed
-    channels, makes them the default for <command>nix-env</command>
-    operations (by symlinking them from the directory
-    <filename>~/.nix-defexpr</filename>), and performs a
-    <command>nix-pull</command> on the manifests of all channels to
-    make pre-built binaries available.</para></listitem>
+    channels (or only those included in
+    <replaceable>names</replaceable> if specified), makes them the
+    default for <command>nix-env</command> operations (by symlinking
+    them from the directory <filename>~/.nix-defexpr</filename>), and
+    performs a <command>nix-pull</command> on the manifests of all
+    channels to make pre-built binaries available.</para></listitem>
 
   </varlistentry>
 
diff --git a/scripts/nix-channel.in b/scripts/nix-channel.in
index 8f0fbbaa5097..6883ffd18db2 100755
--- a/scripts/nix-channel.in
+++ b/scripts/nix-channel.in
@@ -76,6 +76,8 @@ sub removeChannel {
 # Fetch Nix expressions and pull manifests from the subscribed
 # channels.
 sub update {
+    my @channelNames = @_;
+        
     readChannels;
 
     # Create the manifests directory if it doesn't exist.
@@ -87,6 +89,8 @@ sub update {
     # Download each channel.
     my $exprs = "";
     foreach my $name (keys %channels) {
+        next if scalar @channelNames > 0 && ! grep { $_ eq $name } @{channelNames};
+        
         my $url = $channels{$name};
         my $origUrl = "$url/MANIFEST";
 
@@ -141,7 +145,7 @@ Usage:
   nix-channel --add URL [CHANNEL-NAME]
   nix-channel --remove CHANNEL-NAME
   nix-channel --list
-  nix-channel --update
+  nix-channel --update [CHANNEL-NAME...]
 EOF
     exit 1;
 }
@@ -182,8 +186,7 @@ while (scalar @ARGV) {
     }
 
     elsif ($arg eq "--update") {
-        usageError if scalar @ARGV != 0;
-        update;
+        update(@ARGV);
         last;
     }