From 8e90853f172ea05b51f7d40c307e1b58c9e44dab Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 4 Nov 2019 12:39:47 +1000 Subject: [PATCH 1/7] adds com.apple.sound.beep.volume --- modules/system/defaults/NSGlobalDomain.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/system/defaults/NSGlobalDomain.nix b/modules/system/defaults/NSGlobalDomain.nix index d519ce08..8164faf4 100644 --- a/modules/system/defaults/NSGlobalDomain.nix +++ b/modules/system/defaults/NSGlobalDomain.nix @@ -224,6 +224,19 @@ 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.trackpad.enableSecondaryClick" = mkOption { type = types.nullOr types.bool; default = null; From 47a7731943b07de4a4fdd59d2236939d8128bd2e Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 4 Nov 2019 12:49:09 +1000 Subject: [PATCH 2/7] adds com.apple.sound.beep.feedback --- modules/system/defaults/NSGlobalDomain.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/system/defaults/NSGlobalDomain.nix b/modules/system/defaults/NSGlobalDomain.nix index 8164faf4..bc389215 100644 --- a/modules/system/defaults/NSGlobalDomain.nix +++ b/modules/system/defaults/NSGlobalDomain.nix @@ -237,6 +237,16 @@ in { ''; }; + 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; From 400a367d4ef48564cc85ce61c6d2e3f3a751b0d9 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 4 Nov 2019 13:56:21 +1000 Subject: [PATCH 3/7] adds com.apple.alf --- modules/module-list.nix | 1 + modules/system/defaults-write.nix | 4 +- modules/system/defaults/alf.nix | 69 +++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 modules/system/defaults/alf.nix diff --git a/modules/module-list.nix b/modules/module-list.nix index 4c2223d3..b36d85cf 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -14,6 +14,7 @@ ./system/defaults/dock.nix ./system/defaults/finder.nix ./system/defaults/screencapture.nix + ./system/defaults/alf.nix ./system/defaults/smb.nix ./system/defaults/trackpad.nix ./system/etc.nix diff --git a/modules/system/defaults-write.nix b/modules/system/defaults-write.nix index 889400b9..bf9f2f45 100644 --- a/modules/system/defaults-write.nix +++ b/modules/system/defaults-write.nix @@ -26,6 +26,7 @@ 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; smb = defaultsToList "/Library/Preferences/SystemConfiguration/com.apple.smb.server" cfg.smb; screencapture = defaultsToList "com.apple.screencapture" cfg.screencapture; trackpad = defaultsToList "com.apple.AppleMultitouchTrackpad" cfg.trackpad; @@ -37,10 +38,11 @@ in { config = { - system.activationScripts.defaults.text = mkIfAttrs [ smb ] + system.activationScripts.defaults.text = mkIfAttrs [ alf smb ] '' # Set defaults echo >&2 "system defaults..." + ${concatStringsSep "\n" alf} ${concatStringsSep "\n" smb} ''; diff --git a/modules/system/defaults/alf.nix b/modules/system/defaults/alf.nix new file mode 100644 index 00000000..f62ead23 --- /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 + ''; + }; + }; +} From 626a112ce3c7a2c6944252d28bda930302bd6cd5 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 4 Nov 2019 14:06:54 +1000 Subject: [PATCH 4/7] adds com.apple.spaces --- modules/module-list.nix | 1 + modules/system/defaults-write.nix | 4 +++- modules/system/defaults/spaces.nix | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 modules/system/defaults/spaces.nix diff --git a/modules/module-list.nix b/modules/module-list.nix index b36d85cf..0a777abe 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -16,6 +16,7 @@ ./system/defaults/screencapture.nix ./system/defaults/alf.nix ./system/defaults/smb.nix + ./system/defaults/spaces.nix ./system/defaults/trackpad.nix ./system/etc.nix ./system/keyboard.nix diff --git a/modules/system/defaults-write.nix b/modules/system/defaults-write.nix index bf9f2f45..d413dc53 100644 --- a/modules/system/defaults-write.nix +++ b/modules/system/defaults-write.nix @@ -29,6 +29,7 @@ let alf = defaultsToList "/Library/Preferences/com.apple.alf" cfg.alf; smb = defaultsToList "/Library/Preferences/SystemConfiguration/com.apple.smb.server" cfg.smb; 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; @@ -47,7 +48,7 @@ in ''; 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..." @@ -58,6 +59,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/spaces.nix b/modules/system/defaults/spaces.nix new file mode 100644 index 00000000..89308a04 --- /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 + ''; + }; + }; +} From 6100c826d40cd6b97ad8f3ddde4c2219c4ea637b Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 4 Nov 2019 14:35:56 +1000 Subject: [PATCH 5/7] adds com.apple.loginwindow --- modules/module-list.nix | 1 + modules/system/defaults-write.nix | 4 +- modules/system/defaults/loginwindow.nix | 106 ++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 modules/system/defaults/loginwindow.nix diff --git a/modules/module-list.nix b/modules/module-list.nix index 0a777abe..f3019d25 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -15,6 +15,7 @@ ./system/defaults/finder.nix ./system/defaults/screencapture.nix ./system/defaults/alf.nix + ./system/defaults/loginwindow.nix ./system/defaults/smb.nix ./system/defaults/spaces.nix ./system/defaults/trackpad.nix diff --git a/modules/system/defaults-write.nix b/modules/system/defaults-write.nix index d413dc53..adbe9394 100644 --- a/modules/system/defaults-write.nix +++ b/modules/system/defaults-write.nix @@ -27,6 +27,7 @@ let 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; screencapture = defaultsToList "com.apple.screencapture" cfg.screencapture; spaces = defaultsToList "com.apple.spaces" cfg.spaces; @@ -39,11 +40,12 @@ in { config = { - system.activationScripts.defaults.text = mkIfAttrs [ alf smb ] + system.activationScripts.defaults.text = mkIfAttrs [ alf loginwindow smb ] '' # Set defaults echo >&2 "system defaults..." ${concatStringsSep "\n" alf} + ${concatStringsSep "\n" loginwindow} ${concatStringsSep "\n" smb} ''; diff --git a/modules/system/defaults/loginwindow.nix b/modules/system/defaults/loginwindow.nix new file mode 100644 index 00000000..f2400bd8 --- /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.bool; + default = null; + description = '' + # Apple menu > System Preferences > Users and Groups > Login Options + Auto login the default user on boot. Default is false. + ''; + }; + + 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. + ''; + }; + }; +} From 42c8f9bce3d0580cd3f155ef29e3f779ac716c5b Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 4 Nov 2019 14:54:31 +1000 Subject: [PATCH 6/7] adds com.apple.SoftwareUpdate --- modules/module-list.nix | 1 + modules/system/defaults-write.nix | 4 +++- modules/system/defaults/SoftwareUpdate.nix | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 modules/system/defaults/SoftwareUpdate.nix diff --git a/modules/module-list.nix b/modules/module-list.nix index f3019d25..cb38af00 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -17,6 +17,7 @@ ./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 diff --git a/modules/system/defaults-write.nix b/modules/system/defaults-write.nix index adbe9394..6c79138d 100644 --- a/modules/system/defaults-write.nix +++ b/modules/system/defaults-write.nix @@ -29,6 +29,7 @@ let 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; @@ -40,13 +41,14 @@ in { config = { - system.activationScripts.defaults.text = mkIfAttrs [ alf loginwindow 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 diff --git a/modules/system/defaults/SoftwareUpdate.nix b/modules/system/defaults/SoftwareUpdate.nix new file mode 100644 index 00000000..ec89bce5 --- /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. + ''; + }; + }; +} From 39bc7bb131a98f20bd57ef5ebe107e2e955a8c96 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 4 Nov 2019 15:28:38 +1000 Subject: [PATCH 7/7] fix autologin name docs --- modules/system/defaults/loginwindow.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/system/defaults/loginwindow.nix b/modules/system/defaults/loginwindow.nix index f2400bd8..b60fc95a 100644 --- a/modules/system/defaults/loginwindow.nix +++ b/modules/system/defaults/loginwindow.nix @@ -15,11 +15,11 @@ with lib; }; system.defaults.loginwindow.autoLoginUser = mkOption { - type = types.nullOr types.bool; + type = types.nullOr types.str; default = null; description = '' # Apple menu > System Preferences > Users and Groups > Login Options - Auto login the default user on boot. Default is false. + Auto login the supplied user on boot. Default is Off. ''; };