when running nix-shell and you face an error like this:
error: opening lock file '/nix/store/jb10cjj4s2jlmnp9090j87iak0f7np7d-source.lock': Permission denied
try to find the the locked file:
ls -la /nix/store/*.lock
if you find the exact file which has been locked, you just need to delete it:(you need to have single-user nix)
sudo rm /nix/store/jb10cjj4s2jlmnp9090j87iak0f7np7d-source.lock
if this file is not exist just give permission to the nix folder.
sudo chown -R username:staff /nix