From 2c7659b1ff1bea0dc112ca15de0773c14aeedffa Mon Sep 17 00:00:00 2001 From: programmerlexi Date: Mon, 12 May 2025 19:31:04 +0200 Subject: [PATCH] nixos/limine: atomically copy files --- nixos/modules/system/boot/loader/limine/limine-install.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/modules/system/boot/loader/limine/limine-install.py b/nixos/modules/system/boot/loader/limine/limine-install.py index 44dee4645e05..d04266824e55 100644 --- a/nixos/modules/system/boot/loader/limine/limine-install.py +++ b/nixos/modules/system/boot/loader/limine/limine-install.py @@ -203,7 +203,8 @@ def copy_file(from_path: str, to_path: str): if not os.path.exists(dirname): os.makedirs(dirname) - shutil.copyfile(from_path, to_path) + shutil.copyfile(from_path, to_path + ".tmp") + os.rename(to_path + ".tmp", to_path) def option_from_config(name: str, config_path: List[str], conversion: Callable[[str], str] | None = None) -> str: if config(*config_path):