1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-01 04:23:34 +02:00

targets/darwin: allow configuring application linking

This commit is contained in:
fortuneteller2k 2023-12-25 07:17:49 +08:00
parent a2523ea034
commit 259f39246d

View File

@ -1,9 +1,29 @@
{ config, lib, pkgs, ... }:
{
config = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin {
with lib;
let cfg = config.targets.darwin;
in {
options.targets.darwin.linkApps = {
enable = mkOption {
type = types.bool;
default = true;
example = false;
description =
"Whether to enable linking macOS applications to the user environment.";
};
directory = mkOption {
type = types.str;
default = "Applications/Home Manager Apps";
defaultText = "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;