1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01: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, pkgs, ... }:
{ with lib;
config = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin {
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. # 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 { apps = pkgs.buildEnv {
name = "home-manager-applications"; name = "home-manager-applications";
paths = config.home.packages; paths = config.home.packages;