Fixed issue with paths being remounted

I noticed switching got slower and slower as I kept switching and there
were a lot of duplicate directories in my mount output.

See: https://discourse.nixos.org/t/duplicate-boot-entries-in-mount-output/26923/
This commit is contained in:
Alejandro Angulo 2023-04-02 09:20:23 -07:00
parent 00762bbc4e
commit 30832c3ac1
Signed by: alejandro-angulo
GPG key ID: 75579581C74554B6

View file

@ -17,10 +17,21 @@
boot.loader.grub.zfsSupport = true;
boot.loader.grub.extraPrepareConfig = ''
mkdir -p /boot/efis
for i in /boot/efis/*; do mount $i ; done
for i in /boot/efis/* ; do
(mount | grep -q "$i")
isDirectoryMounted=$?
if (test $isDirectoryMounted -ne 0); then
mount "$i"
fi
done
mkdir -p /boot/efi
# mount /boot/efi
(mount | grep -q /boot/efi)
isDirectoryMounted=$?
if (test $isDirectoryMounted -ne 0); then
mount /boot/efi
fi
'';
boot.loader.grub.extraInstallCommands = ''
ESP_MIRROR=$(mktemp -d)