From df31a338dcfbbc1561905eb02224912c82a92fc7 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 13 Apr 2015 12:41:31 +0200 Subject: [PATCH] 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 --- nixos/modules/installer/tools/nixos-rebuild.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh index 61b1508abdf..ccafa30856c 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