1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

targets/darwin: allow configuring application linking (#4809)

Darwin users can disable application linking or change the path where applications are linked.
This commit is contained in:
moni 2025-02-22 15:00:52 -08:00 committed by GitHub
parent cb3f6e9b59
commit fb568d75cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,9 +1,24 @@
{ config, lib, pkgs, ... }:
{
config = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin {
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."Applications/Home Manager Apps".source = let
home.file.${cfg.linkApps.directory}.source = let
apps = pkgs.buildEnv {
name = "home-manager-applications";
paths = config.home.packages;