From fb568d75cf6c81f30d49eeb73787e9b56454ba16 Mon Sep 17 00:00:00 2001 From: moni Date: Sat, 22 Feb 2025 15:00:52 -0800 Subject: [PATCH] targets/darwin: allow configuring application linking (#4809) Darwin users can disable application linking or change the path where applications are linked. --- modules/targets/darwin/linkapps.nix | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/modules/targets/darwin/linkapps.nix b/modules/targets/darwin/linkapps.nix index 0d434234b..caa461f45 100644 --- a/modules/targets/darwin/linkapps.nix +++ b/modules/targets/darwin/linkapps.nix @@ -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;