2021-02-04 00:46:16 +01:00
|
|
|
{ config, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
mkNullableOption = args:
|
|
|
|
lib.mkOption (args // {
|
|
|
|
type = types.nullOr args.type;
|
|
|
|
default = null;
|
|
|
|
});
|
|
|
|
|
|
|
|
mkNullableEnableOption = name:
|
|
|
|
lib.mkOption {
|
|
|
|
type = with types; nullOr bool;
|
|
|
|
default = null;
|
|
|
|
example = true;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "Whether to enable ${name}.";
|
2021-02-04 00:46:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
safari = config."com.apple.Safari";
|
|
|
|
in {
|
|
|
|
freeformType = with types; attrsOf (attrsOf anything);
|
|
|
|
|
|
|
|
options = {
|
|
|
|
NSGlobalDomain = {
|
|
|
|
AppleLanguages = mkNullableOption {
|
|
|
|
type = with types; listOf str;
|
|
|
|
example = [ "en" ];
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "Sets the language to use in the preferred order.";
|
2021-02-04 00:46:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
AppleLocale = mkNullableOption {
|
|
|
|
type = types.str;
|
|
|
|
example = "en_US";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "Configures the user locale.";
|
2021-02-04 00:46:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
AppleMeasurementUnits = mkNullableOption {
|
|
|
|
type = types.enum [ "Centimeters" "Inches" ];
|
|
|
|
example = "Centimeters";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "Sets the measurement unit.";
|
2021-02-04 00:46:16 +01:00
|
|
|
};
|
|
|
|
|
2024-02-21 22:15:28 +01:00
|
|
|
ApplePressAndHoldEnabled = mkNullableOption {
|
|
|
|
type = types.bool;
|
|
|
|
example = true;
|
|
|
|
description =
|
|
|
|
"Repeat a key when it is held down (false) or display the accented character selector (true)";
|
|
|
|
};
|
|
|
|
|
|
|
|
AppleShowAllExtensions = mkNullableOption {
|
|
|
|
type = types.bool;
|
|
|
|
example = true;
|
|
|
|
description = "Always show file extensions in Finder";
|
|
|
|
};
|
|
|
|
|
2021-02-04 00:46:16 +01:00
|
|
|
AppleTemperatureUnit = mkNullableOption {
|
|
|
|
type = types.enum [ "Celsius" "Fahrenheit" ];
|
|
|
|
example = "Celsius";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "Sets the temperature unit.";
|
2021-02-04 00:46:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
AppleMetricUnits = mkNullableEnableOption "the metric system";
|
|
|
|
|
2024-02-21 22:15:28 +01:00
|
|
|
KeyRepeat = mkNullableOption {
|
|
|
|
type = types.int;
|
|
|
|
example = 2;
|
|
|
|
description = ''
|
|
|
|
Interval between key repetitions when holding down a key. Lower is
|
|
|
|
faster. When setting through the control panel, 2 is the lowest value,
|
|
|
|
and 120 the highest.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-02-04 00:46:16 +01:00
|
|
|
NSAutomaticCapitalizationEnabled =
|
2022-12-03 05:20:00 +01:00
|
|
|
mkNullableEnableOption "automatic capitalization";
|
2021-02-04 00:46:16 +01:00
|
|
|
|
|
|
|
NSAutomaticDashSubstitutionEnabled =
|
|
|
|
mkNullableEnableOption "smart dashes";
|
|
|
|
|
|
|
|
NSAutomaticPeriodSubstitutionEnabled =
|
|
|
|
mkNullableEnableOption "period with double space";
|
|
|
|
|
|
|
|
NSAutomaticQuoteSubstitutionEnabled =
|
|
|
|
mkNullableEnableOption "smart quotes";
|
|
|
|
|
|
|
|
NSAutomaticSpellingCorrectionEnabled =
|
|
|
|
mkNullableEnableOption "spelling correction";
|
|
|
|
};
|
|
|
|
|
|
|
|
"com.apple.desktopservices" = {
|
|
|
|
DSDontWriteNetworkStores = mkNullableOption {
|
|
|
|
type = types.bool;
|
|
|
|
example = false;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-07-01 01:30:13 +02:00
|
|
|
Disable use of {file}`.DS_Store` files on network shares.
|
|
|
|
See [the
|
|
|
|
official article](https://support.apple.com/en-us/HT208209) for more info.
|
2021-02-04 00:46:16 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
DSDontWriteUSBStores = mkNullableOption {
|
|
|
|
type = types.bool;
|
|
|
|
example = false;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-07-01 01:30:13 +02:00
|
|
|
Disable use of {file}`.DS_Store` files on thumb drives.
|
2021-02-04 00:46:16 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
"com.apple.dock" = {
|
2024-02-21 22:15:28 +01:00
|
|
|
autohide = mkNullableOption {
|
|
|
|
type = types.bool;
|
|
|
|
example = true;
|
|
|
|
description = "Hide the Dock automatically";
|
|
|
|
};
|
|
|
|
expose-group-apps = mkNullableEnableOption
|
|
|
|
"grouping of windows by application in Mission Control";
|
|
|
|
orientation = mkNullableOption {
|
|
|
|
type = types.enum [ "left" "bottom" "right" ];
|
|
|
|
example = "left";
|
|
|
|
description = "Position of the Dock on the screen";
|
|
|
|
};
|
|
|
|
size-immutable = mkNullableEnableOption "locking of the dock size";
|
2021-02-04 00:46:16 +01:00
|
|
|
tilesize = mkNullableOption {
|
|
|
|
type = types.int;
|
|
|
|
example = 64;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "Sets the size of the dock.";
|
2021-02-04 00:46:16 +01:00
|
|
|
};
|
2024-02-21 22:15:28 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
"com.apple.finder" = {
|
|
|
|
AppleShowAllFiles = mkNullableOption {
|
|
|
|
type = types.bool;
|
|
|
|
example = true;
|
|
|
|
description = "Show hidden files in Finder";
|
|
|
|
};
|
|
|
|
|
|
|
|
FXRemoveOldTrashItems = mkNullableOption {
|
|
|
|
type = types.bool;
|
|
|
|
example = true;
|
|
|
|
description = "Automatically delete items from trash after 30 days";
|
|
|
|
};
|
|
|
|
|
|
|
|
ShowPathBar = mkNullableOption {
|
|
|
|
type = types.bool;
|
|
|
|
example = true;
|
|
|
|
description = "Show the path bar at the bottom of a Finder window";
|
|
|
|
};
|
|
|
|
|
|
|
|
ShowStatusBar = mkNullableOption {
|
|
|
|
type = types.bool;
|
|
|
|
example = true;
|
|
|
|
description = "Show the status bar at the bottom of a Finder window";
|
|
|
|
};
|
2021-02-04 00:46:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
"com.apple.menuextra.battery".ShowPercent = mkNullableOption {
|
|
|
|
type = types.enum [ "YES" "NO" ];
|
|
|
|
example = "NO";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2022-04-24 09:19:56 +02:00
|
|
|
This option no longer works on macOS 11 and later. Instead, use
|
2023-07-01 01:30:13 +02:00
|
|
|
{option}`targets.darwin.currentHostDefaults.\"com.apple.controlcenter\".BatteryShowPercentage`.
|
2021-11-29 16:18:26 +01:00
|
|
|
|
|
|
|
Whether to show battery percentage in the menu bar.
|
|
|
|
'';
|
2021-02-04 00:46:16 +01:00
|
|
|
};
|
|
|
|
|
2024-02-21 22:15:28 +01:00
|
|
|
"com.apple.menuextra.clock" = {
|
|
|
|
IsAnalog = mkNullableEnableOption
|
|
|
|
"showing an analog clock instead of a digital one";
|
|
|
|
|
|
|
|
Show24Hour = mkNullableEnableOption
|
|
|
|
"showing a 24-hour clock, instead of a 12-hour clock";
|
|
|
|
|
|
|
|
ShowAMPM = mkNullableOption {
|
|
|
|
type = types.bool;
|
|
|
|
description = ''
|
|
|
|
Show the AM/PM label. Useful if Show24Hour is false. Default is null.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
ShowDate = mkNullableOption {
|
|
|
|
type = types.enum [ 0 1 2 ];
|
|
|
|
description = ''
|
|
|
|
Show the full date. Default is null.
|
|
|
|
|
|
|
|
0 = Show the date
|
|
|
|
1 = Don't show
|
|
|
|
2 = Don't show
|
|
|
|
|
|
|
|
TODO: I don't know what the difference is between 1 and 2.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
ShowDayOfMonth = mkNullableEnableOption "showing the day of the month";
|
|
|
|
|
|
|
|
ShowDayOfWeek = mkNullableEnableOption "showing the day of the week";
|
|
|
|
|
|
|
|
ShowSeconds = mkNullableEnableOption
|
|
|
|
"showing the clock with second precision, instead of minutes";
|
|
|
|
};
|
|
|
|
|
2021-02-04 00:46:16 +01:00
|
|
|
"com.apple.Safari" = {
|
|
|
|
AutoOpenSafeDownloads =
|
|
|
|
mkNullableEnableOption "opening of downloaded files";
|
|
|
|
AutoFillPasswords =
|
|
|
|
mkNullableEnableOption "autofill of usernames and passwords";
|
|
|
|
AutoFillCreditCardData =
|
|
|
|
mkNullableEnableOption "autofill of credit card numbers";
|
|
|
|
IncludeDevelopMenu =
|
|
|
|
mkNullableEnableOption ''"Develop" menu in the menu bar'';
|
|
|
|
ShowOverlayStatusBar = mkNullableEnableOption "status bar";
|
|
|
|
|
|
|
|
WebKitDeveloperExtrasEnabledPreferenceKey = mkNullableOption {
|
|
|
|
type = types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2021-02-04 00:46:16 +01:00
|
|
|
Configures the web inspector.
|
|
|
|
|
2023-07-01 01:30:13 +02:00
|
|
|
::: {.warning}
|
|
|
|
Instead of setting this option directly, set
|
|
|
|
{option}`IncludeDevelopMenu` instead.
|
|
|
|
:::
|
2021-02-04 00:46:16 +01:00
|
|
|
'';
|
|
|
|
};
|
2021-11-29 16:18:26 +01:00
|
|
|
"WebKitPreferences.developerExtrasEnabled" = mkNullableOption {
|
|
|
|
type = types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2021-11-29 16:18:26 +01:00
|
|
|
Configures the web inspector.
|
|
|
|
|
2023-07-01 01:30:13 +02:00
|
|
|
::: {.warning}
|
|
|
|
Instead of setting this option directly, set
|
|
|
|
{option}`IncludeDevelopMenu` instead.
|
|
|
|
:::
|
2021-11-29 16:18:26 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
"com.apple.Safari.SandboxBroker" = {
|
|
|
|
ShowDevelopMenu = mkNullableOption {
|
|
|
|
type = types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2021-11-29 16:18:26 +01:00
|
|
|
Show the "Develop" menu in Safari's menubar.
|
|
|
|
|
2023-07-01 01:30:13 +02:00
|
|
|
::: {.warning}
|
|
|
|
Instead of setting this option directly, set
|
|
|
|
{option}`"com.apple.Safari".IncludeDevelopMenu` instead.
|
|
|
|
:::
|
2021-11-29 16:18:26 +01:00
|
|
|
'';
|
|
|
|
};
|
2021-02-04 00:46:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
"com.googlecode.iterm2" = {
|
|
|
|
AddNewTabAtEndOfTabs = mkNullableEnableOption
|
|
|
|
"placement of new tabs at the end of the tab bar";
|
|
|
|
|
|
|
|
AlternateMouseScroll = mkNullableEnableOption
|
|
|
|
"arrow keys when scrolling in alternate screen mode";
|
|
|
|
|
|
|
|
CopySelection =
|
|
|
|
mkNullableEnableOption "copy to clipboard upon selecting text";
|
|
|
|
|
|
|
|
OpenTmuxWindowsIn = mkNullableOption {
|
|
|
|
type = types.int;
|
|
|
|
example = 2;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2021-02-04 00:46:16 +01:00
|
|
|
Configures how to restore tmux windows when attaching to a session.
|
|
|
|
|
2023-07-01 02:40:42 +02:00
|
|
|
**Possible Values**
|
|
|
|
|
|
|
|
`0`
|
|
|
|
: Native windows
|
|
|
|
|
|
|
|
`1`
|
|
|
|
: Native tabs in a new window
|
|
|
|
|
|
|
|
`2`
|
|
|
|
: Tabs in the attaching window
|
2021-02-04 00:46:16 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
ExperimentalKeyHandling = mkNullableEnableOption
|
|
|
|
"experimental key handling for AquaSKK compatibility";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
"com.apple.Safari" = mkIf (safari.IncludeDevelopMenu != null) {
|
|
|
|
WebKitDeveloperExtrasEnabledPreferenceKey = safari.IncludeDevelopMenu;
|
2021-11-29 16:18:26 +01:00
|
|
|
"WebKitPreferences.developerExtrasEnabled" = safari.IncludeDevelopMenu;
|
2021-02-04 00:46:16 +01:00
|
|
|
};
|
2021-11-29 16:18:26 +01:00
|
|
|
"com.apple.Safari.SandboxBroker" =
|
|
|
|
mkIf (safari.IncludeDevelopMenu != null) {
|
|
|
|
ShowDevelopMenu = safari.IncludeDevelopMenu;
|
|
|
|
};
|
2021-02-04 00:46:16 +01:00
|
|
|
};
|
|
|
|
}
|