mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-19 14:53:00 +00:00
Darwin users can disable application linking or change the path where applications are linked.
29 lines
825 B
Nix
29 lines
825 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";
|
|
};
|
|
}
|