1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7let
8 types = lib.types;
9
10 # Mapping of Mac App Store applications.
11 # Add new entries to this list via the App Store's share button
12 # https://apps.apple.com/us/app/logic-pro/id634148309?mt=12
13 # --------- ID HERE
14 allMasApps = {
15 # sort-lines:start
16 adguard = 1440147259;
17 amphetamine = 937984704;
18 final-cut-pro = 424389933;
19 logic-pro = 634148309;
20 magnet = 441258766;
21 motion = 434290957;
22 runcat = 1429033973;
23 wireguard = 1451685025;
24 # sort-lines:end
25 };
26
27 # the resolved configuration from the user
28 masApps = config.shared.darwin.macAppStoreApps;
29in
30{
31 options = {
32 # Installs Mac Applications via name using homebrew.
33 shared.darwin.macAppStoreApps = lib.mkOption {
34 type = types.listOf types.str;
35 default = [ ];
36 };
37 };
38 config = lib.mkIf (builtins.length masApps > 0) {
39 homebrew.enable = true;
40 homebrew.masApps = builtins.listToAttrs (
41 builtins.map (name: {
42 inherit name;
43 value = allMasApps.${name};
44 }) masApps
45 );
46 };
47}