3
0
Fork 0
forked from mirrors/nixpkgs

nixos-rebuild: Conditionally update channels.

This partially reverts commit 3a4fd0bfc6.

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>
This commit is contained in:
aszlig 2015-04-13 12:41:31 +02:00
parent 5075cbe696
commit df31a338dc
No known key found for this signature in database
GPG key ID: D0EBD0EC8C2DC961

View file

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