mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-21 17:59:39 +01:00
36 lines
843 B
Nix
36 lines
843 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.targets.darwin;
|
|
in
|
|
{
|
|
options.targets.darwin.linkApps = {
|
|
enable = lib.mkEnableOption "linking macOS applications to the user environment" // {
|
|
default = true;
|
|
};
|
|
|
|
directory = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "Applications/Home Manager Apps";
|
|
description = "Path to link apps relative to the home directory.";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf (pkgs.stdenv.hostPlatform.isDarwin && cfg.linkApps.enable) {
|
|
# Install MacOS applications to the user environment.
|
|
home.file.${cfg.linkApps.directory}.source =
|
|
let
|
|
apps = pkgs.buildEnv {
|
|
name = "home-manager-applications";
|
|
paths = config.home.packages;
|
|
pathsToLink = "/Applications";
|
|
};
|
|
in
|
|
"${apps}/Applications";
|
|
};
|
|
}
|