From a3a330b5ec67f47871423fcca82cd8df711eff94 Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Fri, 26 Apr 2024 01:27:32 -0300 Subject: [PATCH] nix/build: rmdir workaround in submodules.sh sometimes empty directories are kept, perhaps due to regex changes on newly-generated projects' flakes --- nix/build/submodules.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nix/build/submodules.sh b/nix/build/submodules.sh index f3cf2d60e..9ade6a060 100644 --- a/nix/build/submodules.sh +++ b/nix/build/submodules.sh @@ -6,6 +6,11 @@ for submodule in $submodules; do subsrc="$(echo "$submodule" | cut -d':' -f1)" subdest="$(echo "$submodule" | cut -d':' -f2)" + + # Remove empty directory in case there was a submodule there + # so the link doesn't fail + rmdir "$subdest" >/dev/null 2>/dev/null || true + mkdir -p "$(dirname "$subdest")" ln -s "$subsrc" -T "$subdest" || echo "Warning: Failed to link submodule to '$subdest'" >&2 done