Skip to content

Instantly share code, notes, and snippets.

@elliottminns
Last active April 14, 2025 10:05
Show Gist options
  • Save elliottminns/211ef645ebd484eb9a5228570bb60ec3 to your computer and use it in GitHub Desktop.
Save elliottminns/211ef645ebd484eb9a5228570bb60ec3 to your computer and use it in GitHub Desktop.
system.activationScripts.applications.text = let
env = pkgs.buildEnv {
name = "system-applications";
paths = config.environment.systemPackages;
pathsToLink = "/Applications";
};
in
pkgs.lib.mkForce ''
# Set up applications.
echo "setting up /Applications..." >&2
rm -rf /Applications/Nix\ Apps
mkdir -p /Applications/Nix\ Apps
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
while read -r src; do
app_name=$(basename "$src")
echo "copying $src" >&2
${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
done
'';
@waseemhnyc
Copy link

+1 ☝️ to using @hraban https://github.com/hraban/mac-app-util

Worked like a charm

@frarredondo
Copy link

++1 ☝🏽using https://github.com/hraban/mac-app-util

Worked perfectly and was super easy to add to my config file.

@tylercritchlow
Copy link

++1 ☝🏽using https://github.com/hraban/mac-app-util

Worked perfectly and was super easy to add to my config file.

Do you mind sharing your flake.nix with mac-app-util? I tried it, and it doesn't work for me.

@frarredondo
Copy link

@tylercritchlow Sure! I've uploaded a copy here: https://gist.github.com/frarredondo/192930a454c992f306143bfc4eefc948

I will say that after posting my comment above i very quickly learned that very few packages were actually available for aarch64-darwin and found that i needed to install everything via homebrew so i didn't see the point in using nix at least on apple silicon atm and uninstalled it and went back to using homebrew for package management.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment