···281281 copy_flags = common_flags | vars(args_groups["copy_flags"])
282282283283 if args.upgrade or args.upgrade_all:
284284- nix.upgrade_channels(bool(args.upgrade_all))
284284+ nix.upgrade_channels(args.upgrade_all, args.sudo)
285285286286 action = Action(args.action)
287287 # Only run shell scripts from the Nixpkgs tree if the action is
···693693 )
694694695695696696-def upgrade_channels(all_channels: bool = False) -> None:
696696+def upgrade_channels(all_channels: bool = False, sudo: bool = False) -> None:
697697 """Upgrade channels for classic Nix.
698698699699 It will either upgrade just the `nixos` channel (including any channel
700700 that has a `.update-on-nixos-rebuild` file) or all.
701701 """
702702+ if not sudo and os.geteuid() != 0:
703703+ raise NixOSRebuildError(
704704+ "if you pass the '--upgrade' or '--upgrade-all' flag, you must "
705705+ "also pass '--sudo' or run the command as root (e.g., with sudo)"
706706+ )
707707+702708 for channel_path in Path("/nix/var/nix/profiles/per-user/root/channels/").glob("*"):
703709 if channel_path.is_dir() and (
704710 all_channels
705711 or channel_path.name == "nixos"
706712 or (channel_path / ".update-on-nixos-rebuild").exists()
707713 ):
708708- run_wrapper(["nix-channel", "--update", channel_path.name], check=False)
714714+ run_wrapper(
715715+ ["nix-channel", "--update", channel_path.name],
716716+ check=False,
717717+ sudo=sudo,
718718+ )
···7777 disabledTests = [
7878 # Assertion issues
7979 "test_textual_env_var"
8080-8181- # Fail since tree-sitter-markdown was updated to 0.5.0
8282- # ValueError: Incompatible Language version 15. Must be between 13 and 14
8383- # https://github.com/Textualize/textual/issues/5868
8484- "test_setting_builtin_language_via_attribute"
8585- "test_setting_builtin_language_via_constructor"
8680 ];
87818882 pytestFlags = [