From 96134616f97994465daa2cbba516d248f888f712 Mon Sep 17 00:00:00 2001 From: Qubasa Date: Fri, 14 Feb 2025 13:28:01 +0700 Subject: [PATCH] clan-cli: Make copy_from_nixstore work with single files --- pkgs/clan-cli/clan_cli/templates.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/clan-cli/clan_cli/templates.py b/pkgs/clan-cli/clan_cli/templates.py index 92e1fe7be..c3cc8aeae 100644 --- a/pkgs/clan-cli/clan_cli/templates.py +++ b/pkgs/clan-cli/clan_cli/templates.py @@ -128,6 +128,16 @@ class FoundTemplate: def copy_from_nixstore(src: Path, dest: Path) -> None: + if src.is_symlink(): + target = src.readlink() + src.symlink_to(target) + return + + if src.is_file(): + shutil.copy(src, dest) + dest.chmod(stat.S_IWRITE | stat.S_IREAD | stat.S_IRGRP) + return + # Walk through the source directory for root, _dirs, files in src.walk(on_error=log.error): relative_path = Path(root).relative_to(src)