Spotlight on MacOS Monterey

I recently switched to a new apple silicon Macbook Pro on Monterey and i can’t seem to get spotlight to index my ‘Nix Store’ apfs volume (It’s using the default settings, in my Macintosh HD Volume Group as an AFPS Volume).

I don’t remember having problems before. My major issue i’m running into without spotlight indexing is that i can’t locate applications i install (e.g. Emacs.app) without taking special precautions like making an explicit alias.

I have tried completely wiping the volume, completely wiping spotlight index with mdutil -aE && mdutil -ai off && mdutil -ai on, rebooting and reinstalling nix from scratch. Can’t seem to get indexing to go no matter what i do.

This is the output of mdutil -as:

/:
	Indexing enabled. 
/System/Volumes/Data:
	Indexing enabled. 

So the ‘Nix Store’ Volume is not there, i don’t know if it is supposed to be.

I also tried the GUI trick of adding /nix/store to Spotlight Privacy and then removing it. It gives an error when i try to add the path:

I don’t know if this is something that is supposed to work with my system in this state, though. Does seem like a bug of some sort.

Not having much googling around. Do other people not have this problem on Monterey? Does your APFS Volume

Thanks

1 Like

Some of the interface stuff seems buggy on the macOS side, but I can’t say I’m terribly surprised and the underlying behavior is expected. (I guess it’s currently collateral damage in an effort to keep spotlight from blowing resources indexing the whole nix store, which is broadly not what people want.)

It was very-technically an unintended side-effect of this change install: hide the store volume on darwin · NixOS/nix@caface1 · GitHub, but it was something people were trying to figure out how to fix at the time anyways.

I figured out that the change above was also disabling spotlight and documented it in focus on golden-path covering most scenarios · NixOS/nix@2b0a81d · GitHub, (though it looks I accidentally tossed it back out the window when I cleaned that section of the docs up in a PR that merged earlier this year, darwin: encrypt nix volume if filevault is enabled · NixOS/nix@eab14a6 · GitHub).

In any case, spotlight should start indexing it if you remove nobrowse from /etc/fstab (you’ll need to do this with sudo vifs). I’m not sure if this will be the behavior you want. In my recollection, there was a lot of misinformation/superstition around spotlight/mdutil when I looked into this (I don’t think I ever found official documentation confirming that nobrowse disables it, for example).

It’d be good to be able to have our cake and eat it too, if you know much about spotlight or at least have a little time to give it a vigorous shake.

1 Like

I went ahead and opened a PR to re-add this information document some darwin mount settings by abathur · Pull Request #5730 · NixOS/nix · GitHub

1 Like