1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-28 10:47:19 +00:00

Merge pull request #175 from treffynnon/more-system-defaults

[system.defaults] more sound, firewall/alf, spaces, loginwindow, SoftwareUpdate
This commit is contained in:
Daiderd Jordan 2020-01-21 12:22:17 +01:00 committed by GitHub
commit a14315c96e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 247 additions and 2 deletions

View file

@ -14,7 +14,11 @@
./system/defaults/dock.nix
./system/defaults/finder.nix
./system/defaults/screencapture.nix
./system/defaults/alf.nix
./system/defaults/loginwindow.nix
./system/defaults/smb.nix
./system/defaults/SoftwareUpdate.nix
./system/defaults/spaces.nix
./system/defaults/trackpad.nix
./system/etc.nix
./system/keyboard.nix

View file

@ -26,8 +26,12 @@ let
LaunchServices = defaultsToList "com.apple.LaunchServices" cfg.LaunchServices;
dock = defaultsToList "com.apple.dock" cfg.dock;
finder = defaultsToList "com.apple.finder" cfg.finder;
alf = defaultsToList "/Library/Preferences/com.apple.alf" cfg.alf;
loginwindow = defaultsToList "/Library/Preferences/com.apple.loginwindow" cfg.loginwindow;
smb = defaultsToList "/Library/Preferences/SystemConfiguration/com.apple.smb.server" cfg.smb;
SoftwareUpdate = defaultsToList "/Library/Preferences/SystemConfiguration/com.apple.SoftwareUpdate" cfg.SoftwareUpdate;
screencapture = defaultsToList "com.apple.screencapture" cfg.screencapture;
spaces = defaultsToList "com.apple.spaces" cfg.spaces;
trackpad = defaultsToList "com.apple.AppleMultitouchTrackpad" cfg.trackpad;
trackpadBluetooth = defaultsToList "com.apple.driver.AppleBluetoothMultitouch.trackpad" cfg.trackpad;
@ -37,15 +41,18 @@ in
{
config = {
system.activationScripts.defaults.text = mkIfAttrs [ smb ]
system.activationScripts.defaults.text = mkIfAttrs [ alf loginwindow smb SoftwareUpdate ]
''
# Set defaults
echo >&2 "system defaults..."
${concatStringsSep "\n" alf}
${concatStringsSep "\n" loginwindow}
${concatStringsSep "\n" smb}
${concatStringsSep "\n" SoftwareUpdate}
'';
system.activationScripts.userDefaults.text = mkIfAttrs
[ NSGlobalDomain GlobalPreferences LaunchServices dock finder screencapture trackpad trackpadBluetooth ]
[ NSGlobalDomain GlobalPreferences LaunchServices dock finder screencapture spaces trackpad trackpadBluetooth ]
''
# Set defaults
echo >&2 "user defaults..."
@ -56,6 +63,7 @@ in
${concatStringsSep "\n" dock}
${concatStringsSep "\n" finder}
${concatStringsSep "\n" screencapture}
${concatStringsSep "\n" spaces}
${concatStringsSep "\n" trackpad}
${concatStringsSep "\n" trackpadBluetooth}
'';

View file

@ -224,6 +224,29 @@ in {
'';
};
system.defaults.NSGlobalDomain."com.apple.sound.beep.volume" = mkOption {
type = types.nullOr float;
default = null;
description = ''
# Apple menu > System Preferences > Sound
Sets the beep/alert volume level from 0.000 (muted) to 1.000 (100% volume).
75% = 0.7788008
50% = 0.6065307
25% = 0.4723665
'';
};
system.defaults.NSGlobalDomain."com.apple.sound.beep.feedback" = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
# Apple menu > System Preferences > Sound
Make a feedback sound when the system volume changed. This setting accepts
the integers 0 or 1. Defaults to 1.
'';
};
system.defaults.NSGlobalDomain."com.apple.trackpad.enableSecondaryClick" = mkOption {
type = types.nullOr types.bool;
default = null;

View file

@ -0,0 +1,15 @@
{ config, lib, ... }:
with lib;
{
options = {
system.defaults.SoftwareUpdate.AutomaticallyInstallMacOSUpdates = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Automatically install Mac OS software updates. Defaults to false.
'';
};
};
}

View file

@ -0,0 +1,69 @@
{ config, lib, ... }:
with lib;
{
options = {
system.defaults.alf.globalstate = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
# Apple menu > System Preferences > Security and Privacy > Firewall
Enable the internal firewall to prevent unauthorised applications, programs
and services from accepting incoming connections.
0 = disabled
1 = enabled
2 = blocks all connections except for essential services
'';
};
system.defaults.alf.allowsignedenabled = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
# Apple menu > System Preferences > Security and Privacy > Firewall
Allows any signed Application to accept incoming requests. Default is true.
0 = disabled
1 = enabled
'';
};
system.defaults.alf.allowdownloadsignedenabled = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
# Apple menu > System Preferences > Security and Privacy > Firewall
Allows any downloaded Application that has been signed to accept incoming requests. Default is 0.
0 = disabled
1 = enabled
'';
};
system.defaults.alf.loggingenabled = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
# Apple menu > System Preferences > Security and Privacy > Firewall
Enable logging of requests made to the firewall. Default is 0.
0 = disabled
1 = enabled
'';
};
system.defaults.alf.stealthenabled = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
# Apple menu > System Preferences > Security and firewall
Drops incoming requests via ICMP such as ping requests. Default is 0.
0 = disabled
1 = enabled
'';
};
};
}

View file

@ -0,0 +1,106 @@
{ config, lib, ... }:
with lib;
{
options = {
system.defaults.loginwindow.SHOWFULLNAME = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
# Apple menu > System Preferences > Users and Groups > Login Options
Displays login window as a name and password field instead of a list of users.
Default is false.
'';
};
system.defaults.loginwindow.autoLoginUser = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
# Apple menu > System Preferences > Users and Groups > Login Options
Auto login the supplied user on boot. Default is Off.
'';
};
system.defaults.loginwindow.GuestEnabled = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
# Apple menu > System Preferences > Users and Groups > Login Options
Allow users to login to the machine as guests using the Guest account. Default is true.
'';
};
system.defaults.loginwindow.LoginwindowText = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Text to be shown on the login window. Default "\\U03bb".
'';
};
system.defaults.loginwindow.ShutDownDisabled = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
# Apple menu > System Preferences > Users and Groups > Login Options
Hides the Shut Down button on the login screen. Default is false.
'';
};
system.defaults.loginwindow.SleepDisabled = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
# Apple menu > System Preferences > Users and Groups > Login Options
Hides the Sleep button on the login screen. Default is false.
'';
};
system.defaults.loginwindow.RestartDisabled = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
# Apple menu > System Preferences > Users and Groups > Login Options
Hides the Restart button on the login screen. Default is false.
'';
};
system.defaults.loginwindow.ShutDownDisabledWhileLoggedIn = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
# Apple menu > System Preferences > Users and Groups > Login Options
Disables the "Shutdown" option when users are logged in. Default is false.
'';
};
system.defaults.loginwindow.PowerOffDisabledWhileLoggedIn = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
# Apple menu > System Preferences > Users and Groups > Login Options
If set to true, the Power Off menu item will be disabled when the user is logged in. Default is false.
'';
};
system.defaults.loginwindow.RestartDisabledWhileLoggedIn = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
# Apple menu > System Preferences > Users and Groups > Login Options
Disables the Restart option when users are logged in. Default is false.
'';
};
system.defaults.loginwindow.DisableConsoleAccess = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Disables the ability for a user to access the console by typing >console
for a username at the login window. Default is false.
'';
};
};
}

View file

@ -0,0 +1,20 @@
{ config, lib, ... }:
with lib;
{
options = {
system.defaults.spaces.spans-displays = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
# Apple menu > System Preferences > Mission Control
Displays have separate Spaces (note a logout is required before
this setting will take affect).
false = each physical display has a separate space (Mac default)
true = one space spans across all physical displays
'';
};
};
}