Skip to content

Commit

Permalink
targets/darwin: allow configuring application linking (#4809)
Browse files Browse the repository at this point in the history
Darwin users can disable application linking or change the path where applications are linked.
  • Loading branch information
moni-dz authored Feb 22, 2025
1 parent cb3f6e9 commit fb568d7
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions modules/targets/darwin/linkapps.nix
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit fb568d7

Please sign in to comment.