summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2020-01-21 12:22:17 +0100
committerGitHub <noreply@github.com>2020-01-21 12:22:17 +0100
commita14315c96edcedddab74af8353cfec3017a8157d (patch)
tree5b058412b40c907c6f013a95bfbdc7fd68cf004b /modules/system
parent3b3ae7ab7dd0f8a7534eedd52ea53dd98e395651 (diff)
parent39bc7bb131a98f20bd57ef5ebe107e2e955a8c96 (diff)
Merge pull request #175 from treffynnon/more-system-defaults
[system.defaults] more sound, firewall/alf, spaces, loginwindow, SoftwareUpdate
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/defaults-write.nix12
-rw-r--r--modules/system/defaults/NSGlobalDomain.nix23
-rw-r--r--modules/system/defaults/SoftwareUpdate.nix15
-rw-r--r--modules/system/defaults/alf.nix69
-rw-r--r--modules/system/defaults/loginwindow.nix106
-rw-r--r--modules/system/defaults/spaces.nix20
6 files changed, 243 insertions, 2 deletions
diff --git a/modules/system/defaults-write.nix b/modules/system/defaults-write.nix
index 889400b..6c79138 100644
--- a/modules/system/defaults-write.nix
+++ b/modules/system/defaults-write.nix
@@ -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}
'';
diff --git a/modules/system/defaults/NSGlobalDomain.nix b/modules/system/defaults/NSGlobalDomain.nix
index 1f8d5ef..80be2b6 100644
--- a/modules/system/defaults/NSGlobalDomain.nix
+++ b/modules/system/defaults/NSGlobalDomain.nix
@@ -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;
diff --git a/modules/system/defaults/SoftwareUpdate.nix b/modules/system/defaults/SoftwareUpdate.nix
new file mode 100644
index 0000000..ec89bce
--- /dev/null
+++ b/modules/system/defaults/SoftwareUpdate.nix
@@ -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.
+ '';
+ };
+ };
+}
diff --git a/modules/system/defaults/alf.nix b/modules/system/defaults/alf.nix
new file mode 100644
index 0000000..f62ead2
--- /dev/null
+++ b/modules/system/defaults/alf.nix
@@ -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
+ '';
+ };
+ };
+}
diff --git a/modules/system/defaults/loginwindow.nix b/modules/system/defaults/loginwindow.nix
new file mode 100644
index 0000000..b60fc95
--- /dev/null
+++ b/modules/system/defaults/loginwindow.nix
@@ -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.
+ '';
+ };
+ };
+}
diff --git a/modules/system/defaults/spaces.nix b/modules/system/defaults/spaces.nix
new file mode 100644
index 0000000..89308a0
--- /dev/null
+++ b/modules/system/defaults/spaces.nix
@@ -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
+ '';
+ };
+ };
+}