Loading nixos/modules/system/boot/systemd/initrd.nix +4 −0 Original line number Diff line number Diff line Loading @@ -640,6 +640,10 @@ in ) cfg.automounts ); services."modprobe@" = lib.mkIf (config.system.build.kernel.config.isYes "MODULES") { serviceConfig.ExecSearchPath = lib.makeBinPath [ cfg.package.kmod ]; }; services.initrd-find-nixos-closure = lib.mkIf (!config.system.nixos-init.enable) { description = "Find NixOS closure"; Loading nixos/tests/systemd-initrd-modprobe.nix +4 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,10 @@ rtt = machine.succeed("cat /sys/module/tcp_hybla/parameters/rtt0") assert int(rtt) == 42, "Parameter should be respected for initrd kernel modules" with subtest("modprobe@ services work"): modprobe_service_status = machine.succeed("systemctl show --property ExecMainStatus modprobe@9pnet_virtio.service") t.assertEqual("ExecMainStatus=0\n", modprobe_service_status) # Make sure it sticks in stage 2 machine.switch_root() machine.wait_for_unit("multi-user.target") Loading pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/nix.py +6 −2 Original line number Diff line number Diff line Loading @@ -726,7 +726,11 @@ def switch_to_configuration( ) def upgrade_channels(all_channels: bool = False, sudo: bool = False) -> None: def upgrade_channels( all_channels: bool = False, sudo: bool = False, channels_dir: Path = Path("/nix/var/nix/profiles/per-user/root/channels/"), ) -> None: """Upgrade channels for classic Nix. It will either upgrade just the `nixos` channel (including any channel Loading @@ -739,7 +743,7 @@ def upgrade_channels(all_channels: bool = False, sudo: bool = False) -> None: ) channel_updated = False for channel_path in Path("/nix/var/nix/profiles/per-user/root/channels/").glob("*"): for channel_path in channels_dir.glob("*"): if channel_path.is_dir() and ( all_channels or channel_path.name == "nixos" Loading pkgs/by-name/ni/nixos-rebuild-ng/src/tests/test_nix.py +44 −25 Original line number Diff line number Diff line Loading @@ -882,44 +882,63 @@ def test_switch_to_configuration_with_systemd_run( ) @patch( "pathlib.Path.glob", autospec=True, return_value=[ Path("/nix/var/nix/profiles/per-user/root/channels/nixos"), Path("/nix/var/nix/profiles/per-user/root/channels/nixos-hardware"), Path("/nix/var/nix/profiles/per-user/root/channels/home-manager"), ], ) @patch("pathlib.Path.is_dir", autospec=True, return_value=True) @patch("os.geteuid", autospec=True, return_value=1000) @patch(get_qualified_name(n.run_wrapper, n), autospec=True) def test_upgrade_channels( mock_run: Mock, mock_geteuid: Mock, mock_is_dir: Mock, mock_glob: Mock, ) -> None: def test_upgrade_channels(mock_run: Mock, mock_geteuid: Mock, tmpdir: Path) -> None: tmp_path = Path(tmpdir) with pytest.raises(m.NixOSRebuildError) as e: n.upgrade_channels(all_channels=False, sudo=False) n.upgrade_channels(all_channels=False, sudo=False, channels_dir=tmp_path) assert str(e.value) == ( "error: if you pass the '--upgrade' or '--upgrade-all' flag, you must " "also pass '--sudo' or run the command as root (e.g., with sudo)" ) n.upgrade_channels(all_channels=False, sudo=True) mock_run.assert_called_once_with( ["nix-channel", "--update", "nixos"], check=False, sudo=True (tmp_path / "nixos").mkdir() (tmp_path / "nixos-hardware").mkdir() (tmp_path / "nixos-hardware" / ".update-on-nixos-rebuild").touch() (tmp_path / "home-manager").mkdir() # should work because we are passing sudo=True even with os.geteuid == 1000 n.upgrade_channels(all_channels=False, sudo=True, channels_dir=tmp_path) mock_run.assert_has_calls( [ call( ["nix-channel", "--update", "nixos-hardware"], check=False, sudo=True, ), call( ["nix-channel", "--update", "nixos"], check=False, sudo=True, ), ], any_order=True, ) mock_run.reset_mock() # root check mock_geteuid.return_value = 0 n.upgrade_channels(all_channels=True, sudo=False) n.upgrade_channels(all_channels=True, sudo=False, channels_dir=tmp_path) mock_run.assert_has_calls( [ call(["nix-channel", "--update", "nixos"], check=False, sudo=False), call( ["nix-channel", "--update", "nixos-hardware"], check=False, sudo=False ["nix-channel", "--update", "home-manager"], check=False, sudo=False, ), call(["nix-channel", "--update", "home-manager"], check=False, sudo=False), ] call( ["nix-channel", "--update", "nixos-hardware"], check=False, sudo=False, ), call( ["nix-channel", "--update", "nixos"], check=False, sudo=False, ), ], any_order=True, ) pkgs/os-specific/linux/kernel/kernels-org.json +8 −8 Original line number Diff line number Diff line Loading @@ -25,23 +25,23 @@ "lts": true }, "6.12": { "version": "6.12.82", "hash": "sha256:1a8r1wzfssrnqbf4yvbcfynf5w6la4vy1w5wlns1p63krl2hnmqf", "version": "6.12.83", "hash": "sha256:0cfzvhm876jm61cy023apwmi5axjilwfc0xnag9jd9fzs4n1gqrr", "lts": true }, "6.18": { "version": "6.18.23", "hash": "sha256:0d2ihdz5hdy1ywhck76y9rnzzvkl2lhrb5xvc6w5l4ydpxv8wb9a", "version": "6.18.24", "hash": "sha256:0pr5s7hkmn7n17bm7p6sqrkq8g9z42jnvqihv96kn42qrrbwa1y2", "lts": true }, "6.19": { "version": "6.19.13", "hash": "sha256:0j2ncikwi4mkx9v33ahzmi2qq2bx5f82701nnha1grs0lzzb2n85", "version": "6.19.14", "hash": "sha256:11giqsz9qa7s9lm94nn4h1bcb2411crsbfyvzrvhfjmy75kvzs6d", "lts": false }, "7.0": { "version": "7.0", "hash": "sha256:1w4i705i0nl1xqv7fdhdbhy7j3xrzhl31fabs6vmgiw7nf06szxv", "version": "7.0.1", "hash": "sha256:1gw7v1j0pp2w6fm5y1n0krhnfvgab2jkrvcvwl8hx614dnikbjdj", "lts": false } } Loading
nixos/modules/system/boot/systemd/initrd.nix +4 −0 Original line number Diff line number Diff line Loading @@ -640,6 +640,10 @@ in ) cfg.automounts ); services."modprobe@" = lib.mkIf (config.system.build.kernel.config.isYes "MODULES") { serviceConfig.ExecSearchPath = lib.makeBinPath [ cfg.package.kmod ]; }; services.initrd-find-nixos-closure = lib.mkIf (!config.system.nixos-init.enable) { description = "Find NixOS closure"; Loading
nixos/tests/systemd-initrd-modprobe.nix +4 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,10 @@ rtt = machine.succeed("cat /sys/module/tcp_hybla/parameters/rtt0") assert int(rtt) == 42, "Parameter should be respected for initrd kernel modules" with subtest("modprobe@ services work"): modprobe_service_status = machine.succeed("systemctl show --property ExecMainStatus modprobe@9pnet_virtio.service") t.assertEqual("ExecMainStatus=0\n", modprobe_service_status) # Make sure it sticks in stage 2 machine.switch_root() machine.wait_for_unit("multi-user.target") Loading
pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/nix.py +6 −2 Original line number Diff line number Diff line Loading @@ -726,7 +726,11 @@ def switch_to_configuration( ) def upgrade_channels(all_channels: bool = False, sudo: bool = False) -> None: def upgrade_channels( all_channels: bool = False, sudo: bool = False, channels_dir: Path = Path("/nix/var/nix/profiles/per-user/root/channels/"), ) -> None: """Upgrade channels for classic Nix. It will either upgrade just the `nixos` channel (including any channel Loading @@ -739,7 +743,7 @@ def upgrade_channels(all_channels: bool = False, sudo: bool = False) -> None: ) channel_updated = False for channel_path in Path("/nix/var/nix/profiles/per-user/root/channels/").glob("*"): for channel_path in channels_dir.glob("*"): if channel_path.is_dir() and ( all_channels or channel_path.name == "nixos" Loading
pkgs/by-name/ni/nixos-rebuild-ng/src/tests/test_nix.py +44 −25 Original line number Diff line number Diff line Loading @@ -882,44 +882,63 @@ def test_switch_to_configuration_with_systemd_run( ) @patch( "pathlib.Path.glob", autospec=True, return_value=[ Path("/nix/var/nix/profiles/per-user/root/channels/nixos"), Path("/nix/var/nix/profiles/per-user/root/channels/nixos-hardware"), Path("/nix/var/nix/profiles/per-user/root/channels/home-manager"), ], ) @patch("pathlib.Path.is_dir", autospec=True, return_value=True) @patch("os.geteuid", autospec=True, return_value=1000) @patch(get_qualified_name(n.run_wrapper, n), autospec=True) def test_upgrade_channels( mock_run: Mock, mock_geteuid: Mock, mock_is_dir: Mock, mock_glob: Mock, ) -> None: def test_upgrade_channels(mock_run: Mock, mock_geteuid: Mock, tmpdir: Path) -> None: tmp_path = Path(tmpdir) with pytest.raises(m.NixOSRebuildError) as e: n.upgrade_channels(all_channels=False, sudo=False) n.upgrade_channels(all_channels=False, sudo=False, channels_dir=tmp_path) assert str(e.value) == ( "error: if you pass the '--upgrade' or '--upgrade-all' flag, you must " "also pass '--sudo' or run the command as root (e.g., with sudo)" ) n.upgrade_channels(all_channels=False, sudo=True) mock_run.assert_called_once_with( ["nix-channel", "--update", "nixos"], check=False, sudo=True (tmp_path / "nixos").mkdir() (tmp_path / "nixos-hardware").mkdir() (tmp_path / "nixos-hardware" / ".update-on-nixos-rebuild").touch() (tmp_path / "home-manager").mkdir() # should work because we are passing sudo=True even with os.geteuid == 1000 n.upgrade_channels(all_channels=False, sudo=True, channels_dir=tmp_path) mock_run.assert_has_calls( [ call( ["nix-channel", "--update", "nixos-hardware"], check=False, sudo=True, ), call( ["nix-channel", "--update", "nixos"], check=False, sudo=True, ), ], any_order=True, ) mock_run.reset_mock() # root check mock_geteuid.return_value = 0 n.upgrade_channels(all_channels=True, sudo=False) n.upgrade_channels(all_channels=True, sudo=False, channels_dir=tmp_path) mock_run.assert_has_calls( [ call(["nix-channel", "--update", "nixos"], check=False, sudo=False), call( ["nix-channel", "--update", "nixos-hardware"], check=False, sudo=False ["nix-channel", "--update", "home-manager"], check=False, sudo=False, ), call(["nix-channel", "--update", "home-manager"], check=False, sudo=False), ] call( ["nix-channel", "--update", "nixos-hardware"], check=False, sudo=False, ), call( ["nix-channel", "--update", "nixos"], check=False, sudo=False, ), ], any_order=True, )
pkgs/os-specific/linux/kernel/kernels-org.json +8 −8 Original line number Diff line number Diff line Loading @@ -25,23 +25,23 @@ "lts": true }, "6.12": { "version": "6.12.82", "hash": "sha256:1a8r1wzfssrnqbf4yvbcfynf5w6la4vy1w5wlns1p63krl2hnmqf", "version": "6.12.83", "hash": "sha256:0cfzvhm876jm61cy023apwmi5axjilwfc0xnag9jd9fzs4n1gqrr", "lts": true }, "6.18": { "version": "6.18.23", "hash": "sha256:0d2ihdz5hdy1ywhck76y9rnzzvkl2lhrb5xvc6w5l4ydpxv8wb9a", "version": "6.18.24", "hash": "sha256:0pr5s7hkmn7n17bm7p6sqrkq8g9z42jnvqihv96kn42qrrbwa1y2", "lts": true }, "6.19": { "version": "6.19.13", "hash": "sha256:0j2ncikwi4mkx9v33ahzmi2qq2bx5f82701nnha1grs0lzzb2n85", "version": "6.19.14", "hash": "sha256:11giqsz9qa7s9lm94nn4h1bcb2411crsbfyvzrvhfjmy75kvzs6d", "lts": false }, "7.0": { "version": "7.0", "hash": "sha256:1w4i705i0nl1xqv7fdhdbhy7j3xrzhl31fabs6vmgiw7nf06szxv", "version": "7.0.1", "hash": "sha256:1gw7v1j0pp2w6fm5y1n0krhnfvgab2jkrvcvwl8hx614dnikbjdj", "lts": false } }