fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , ...} : 2 3with lib ; 4 5let 6mkNullableOption = args : 7lib . mkOption ( args // { 8type = types . nullOr args . type ; 9default = null ; 10}); 11 12mkNullableEnableOption = name : 13lib . mkOption { 14type = with types ; nullOr bool ; 15default = null ; 16example = true ; 17description = "Whether to enable ${ name } ." ; 18}; 19 20safari = config . "com.apple.Safari" ; 21in { 22freeformType = with types ; attrsOf ( attrsOf anything ); 23 24options = { 25NSGlobalDomain = { 26AppleLanguages = mkNullableOption { 27type = with types ; listOf str ; 28example = [ "en" ]; 29description = "Sets the language to use in the preferred order." ; 30}; 31 32AppleLocale = mkNullableOption { 33type = types . str ; 34example = "en_US" ; 35description = "Configures the user locale." ; 36}; 37 38AppleMeasurementUnits = mkNullableOption { 39type = types . enum [ "Centimeters" "Inches" ]; 40example = "Centimeters" ; 41description = "Sets the measurement unit." ; 42}; 43 44AppleTemperatureUnit = mkNullableOption { 45type = types . enum [ "Celsius" "Fahrenheit" ]; 46example = "Celsius" ; 47description = "Sets the temperature unit." ; 48}; 49 50AppleMetricUnits = mkNullableEnableOption "the metric system" ; 51 52NSAutomaticCapitalizationEnabled = 53mkNullableEnableOption "automatic capitalization" ; 54 55NSAutomaticDashSubstitutionEnabled = 56mkNullableEnableOption "smart dashes" ; 57 58NSAutomaticPeriodSubstitutionEnabled = 59mkNullableEnableOption "period with double space" ; 60 61NSAutomaticQuoteSubstitutionEnabled = 62mkNullableEnableOption "smart quotes" ; 63 64NSAutomaticSpellingCorrectionEnabled = 65mkNullableEnableOption "spelling correction" ; 66}; 67 68"com.apple.desktopservices" = { 69DSDontWriteNetworkStores = mkNullableOption { 70type = types . bool ; 71example = false ; 72description = '' 73Disable use of {file}`.DS_Store` files on network shares. 74See [the 75official article](https://support.apple.com/en-us/HT208209) for more info. 76'' ; 77}; 78DSDontWriteUSBStores = mkNullableOption { 79type = types . bool ; 80example = false ; 81description = '' 82Disable use of {file}`.DS_Store` files on thumb drives. 83'' ; 84}; 85}; 86 87"com.apple.dock" = { 88tilesize = mkNullableOption { 89type = types . int ; 90example = 64 ; 91description = "Sets the size of the dock." ; 92}; 93size-immutable = mkNullableEnableOption "locking of the dock size" ; 94expose-group-apps = mkNullableEnableOption 95"grouping of windows by application in Mission Control" ; 96}; 97 98"com.apple.menuextra.battery" . ShowPercent = mkNullableOption { 99type = types . enum [ "YES" "NO" ]; 100example = "NO" ; 101description = '' 102This option no longer works on macOS 11 and later. Instead, use 103{option}`targets.darwin.currentHostDefaults.\"com.apple.controlcenter\".BatteryShowPercentage`. 104 105Whether to show battery percentage in the menu bar. 106'' ; 107}; 108 109"com.apple.Safari" = { 110AutoOpenSafeDownloads = 111mkNullableEnableOption "opening of downloaded files" ; 112AutoFillPasswords = 113mkNullableEnableOption "autofill of usernames and passwords" ; 114AutoFillCreditCardData = 115mkNullableEnableOption "autofill of credit card numbers" ; 116IncludeDevelopMenu = 117mkNullableEnableOption ''"Develop" menu in the menu bar'' ; 118ShowOverlayStatusBar = mkNullableEnableOption "status bar" ; 119 120WebKitDeveloperExtrasEnabledPreferenceKey = mkNullableOption { 121type = types . bool ; 122description = '' 123Configures the web inspector. 124 125::: {.warning} 126Instead of setting this option directly, set 127{option}`IncludeDevelopMenu` instead. 128::: 129'' ; 130}; 131"WebKitPreferences.developerExtrasEnabled" = mkNullableOption { 132type = types . bool ; 133description = '' 134Configures the web inspector. 135 136::: {.warning} 137Instead of setting this option directly, set 138{option}`IncludeDevelopMenu` instead. 139::: 140'' ; 141}; 142}; 143 144"com.apple.Safari.SandboxBroker" = { 145ShowDevelopMenu = mkNullableOption { 146type = types . bool ; 147description = '' 148Show the "Develop" menu in Safari's menubar. 149 150::: {.warning} 151Instead of setting this option directly, set 152{option}`"com.apple.Safari".IncludeDevelopMenu` instead. 153::: 154'' ; 155}; 156}; 157 158"com.googlecode.iterm2" = { 159AddNewTabAtEndOfTabs = mkNullableEnableOption 160"placement of new tabs at the end of the tab bar" ; 161 162AlternateMouseScroll = mkNullableEnableOption 163"arrow keys when scrolling in alternate screen mode" ; 164 165CopySelection = 166mkNullableEnableOption "copy to clipboard upon selecting text" ; 167 168OpenTmuxWindowsIn = mkNullableOption { 169type = types . int ; 170example = 2 ; 171description = '' 172Configures how to restore tmux windows when attaching to a session. 173 174**Possible Values** 175 176`0` 177: Native windows 178 179`1` 180: Native tabs in a new window 181 182`2` 183: Tabs in the attaching window 184'' ; 185}; 186 187ExperimentalKeyHandling = mkNullableEnableOption 188"experimental key handling for AquaSKK compatibility" ; 189}; 190}; 191 192config = { 193"com.apple.Safari" = mkIf ( safari . IncludeDevelopMenu != null ) { 194WebKitDeveloperExtrasEnabledPreferenceKey = safari . IncludeDevelopMenu ; 195"WebKitPreferences.developerExtrasEnabled" = safari . IncludeDevelopMenu ; 196}; 197"com.apple.Safari.SandboxBroker" = 198mkIf ( safari . IncludeDevelopMenu != null ) { 199ShowDevelopMenu = safari . IncludeDevelopMenu ; 200}; 201}; 202}