mirror of
https://github.com/willemml/dotfiles.nix.git
synced 2025-04-13 19:57:19 +00:00
21 lines
841 B
Nix
21 lines
841 B
Nix
{ config, lib, pkgs, ... }:
|
|
let
|
|
appEnv = pkgs.buildEnv {
|
|
name = "home-manager-applications";
|
|
paths = config.home.packages;
|
|
pathsToLink = "/Applications";
|
|
};
|
|
in {
|
|
home.activation.addApplications = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
|
# Install MacOS applications to the user environment.
|
|
HM_APPS="$HOME/Applications/Home Manager Apps"
|
|
# Reset current state
|
|
[ -e "$HM_APPS" ] && $DRY_RUN_CMD rm -r "$HM_APPS"
|
|
$DRY_RUN_CMD mkdir -p "$HM_APPS"
|
|
# .app dirs need to be actual directories for Finder to detect them as Apps.
|
|
# In the env of Apps we build, the .apps are symlinks. We pass all of them as
|
|
# arguments to cp and make it dereference those using -H
|
|
$DRY_RUN_CMD cp --archive -H --dereference ${appEnv}/Applications/* "$HM_APPS"
|
|
$DRY_RUN_CMD chmod +w -R "$HM_APPS"
|
|
'';
|
|
}
|