summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-04-13 12:41:31 +0200
committeraszlig <aszlig@redmoonstudios.org>2015-04-13 12:54:19 +0200
commitdf31a338dcfbbc1561905eb02224912c82a92fc7 (patch)
tree8cbf1f63a063f449f0ea66abec9c6ab750bb60a2 /nixos/modules
parent5075cbe6967324123e7a9fc38fcd35371f2b91df (diff)
downloadnixlib-df31a338dcfbbc1561905eb02224912c82a92fc7.tar
nixlib-df31a338dcfbbc1561905eb02224912c82a92fc7.tar.gz
nixlib-df31a338dcfbbc1561905eb02224912c82a92fc7.tar.bz2
nixlib-df31a338dcfbbc1561905eb02224912c82a92fc7.tar.lz
nixlib-df31a338dcfbbc1561905eb02224912c82a92fc7.tar.xz
nixlib-df31a338dcfbbc1561905eb02224912c82a92fc7.tar.zst
nixlib-df31a338dcfbbc1561905eb02224912c82a92fc7.zip
nixos-rebuild: Conditionally update channels.
This partially reverts commit 3a4fd0bfc6fb34a496708ee95891acb1648eedde.

Addresses another concern by @edolstra that users might not want to
update *all* channels. We're now reverting to the old behaviour but
after updating the "nixos" channel, we just check whether the channel
ships with a file called ".update-on-nixos-rebuild" and if it exists, we
update that channel as well.

Other channels than these are not touched anymore.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/installer/tools/nixos-rebuild.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh
index 61b1508abdfc..ccafa30856c5 100644
--- a/nixos/modules/installer/tools/nixos-rebuild.sh
+++ b/nixos/modules/installer/tools/nixos-rebuild.sh
@@ -93,9 +93,17 @@ if [ "$action" = switch -o "$action" = boot -o "$action" = test ]; then
 fi
 
 
-# If ‘--upgrade’ is given, run ‘nix-channel --update’.
+# If ‘--upgrade’ is given, run ‘nix-channel --update nixos’.
 if [ -n "$upgrade" -a -z "$_NIXOS_REBUILD_REEXEC" ]; then
-    nix-channel --update
+    nix-channel --update nixos
+
+    # If there are other channels that contain a file called
+    # ".update-on-nixos-rebuild", update them as well.
+    for channelpath in /nix/var/nix/profiles/per-user/root/channels/*; do
+        if [ -e "$channelpath/.update-on-nixos-rebuild" ]; then
+            nix-channel --update "$(basename "$channelpath")"
+        fi
+    done
 fi
 
 # Make sure that we use the Nix package we depend on, not something