Jump to content

A use case for symlink support


Recommended Posts

I've seen http://support.alfredapp.com/kb:symlinked-apps but I was wondering if you'd consider alternatives to support a fairly neat use case.


I'm trying to improve Mac OS support on nix (http://nixos.org) which is a neat package manager that helps support deterministic system state by never mutating anything in place. To do this effectively, it creates symlinks to directories of symlinks representing distinct profiles, with links into an underlying data store, much like how git stores blobs and has trees and commits pointing into the blob store. This allows multiple concurrent versions of packages to coexist and for people to set up throwaway environments that have fully deterministic state.


Anyway, the nix approach to your "main environment" on the command line is to have your $PATH pointing into bin in ~/.nix-profile, which is itself a symlink into your currently active profile containing symlinks into the store. I have arranged for my "active" Mac Apps to show up in ~/.nix-profile/Applications, which now just looks like homebrew cask would have ~/Applications look.


Unfortunately, Alfred's usual advice that applies to homebrew cask isn't as effective on nix, because it supports multiple concurrent versions of an app, so if I just add /nix/store to Alfred's search paths, I'll get all versions of my apps in the list.




I don't know how Alfred is implemented, so this might be a very silly suggestion. Would it be too hacky to get Alfred to just take a "stupid path" to search for .app files in with standard directory listing calls, skipping Spotlight altogether? Then I could add ~/.nix-profile/Applications to my "stupid search paths" and have it dynamically resolve based on my current nix environment?


If that's too silly of an idea, I'd appreciate suggestions on how to achieve the goal nicely without excessive hackery  :)



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...